From 76cf6e183c71820c4b2b67bb69abb730ad8f2333 Mon Sep 17 00:00:00 2001 From: API Team Date: Wed, 5 Aug 2026 14:05:07 +0000 Subject: [PATCH] [GitHub Bot] Generated python SDK --- .../.openapi-generator/FILES | 8 + thousandeyes-sdk-administrative/README.md | 6 +- .../docs/AccountGroupsApi.md | 10 +- .../docs/RolesApi.md | 4 +- .../docs/UsersApi.md | 4 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 3252 +++ .../test_account_groups_api_integration.py | 1820 ++ .../test/test_permissions_api_integration.py | 233 + .../test/test_roles_api_integration.py | 1224 ++ .../test/test_user_events_api_integration.py | 373 + .../test/test_users_api_integration.py | 1695 ++ .../test/test_utils.py | 23 +- .../.openapi-generator/FILES | 9 + thousandeyes-sdk-agents/README.md | 2 +- .../docs/CloudAndEnterpriseAgentsApi.md | 10 +- .../docs/EnterpriseAgentClusterApi.md | 8 +- .../docs/TestsAssignmentOnAgentsApi.md | 6 +- 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 | 238 + ...gent_notification_rules_api_integration.py | 517 + ...d_and_enterprise_agents_api_integration.py | 1250 ++ ...nterprise_agent_cluster_api_integration.py | 809 + .../test_local_problems_api_integration.py | 344 + ...ts_assignment_on_agents_api_integration.py | 1280 ++ thousandeyes-sdk-agents/test/test_utils.py | 23 +- .../.openapi-generator/FILES | 6 + thousandeyes-sdk-alerts/README.md | 4 +- thousandeyes-sdk-alerts/docs/AlertRulesApi.md | 4 +- .../docs/AlertSuppressionWindowsApi.md | 10 +- thousandeyes-sdk-alerts/docs/AlertsApi.md | 2 +- 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 | 2130 ++ ...ert_suppression_windows_api_integration.py | 1625 ++ .../test/test_alerts_api_integration.py | 680 + thousandeyes-sdk-alerts/test/test_utils.py | 23 +- .../.openapi-generator/FILES | 4 + thousandeyes-sdk-bgp-monitors/README.md | 2 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 131 + .../test/test_bgp_monitors_api_integration.py | 203 + .../test/test_utils.py | 23 +- .../.openapi-generator/FILES | 22 + thousandeyes-sdk-connectors/README.md | 16 +- .../docs/CredentialVaultOperationsApi.md | 4 +- .../docs/CyberArkConjurConnectorsApi.md | 4 +- .../docs/GenericConnectorsApi.md | 4 +- .../docs/PanoramaConnector.md | 36 + .../docs/PanoramaConnectorAuth.md | 34 + .../docs/PanoramaConnectors.md | 31 + .../docs/PanoramaConnectorsApi.md | 609 + .../docs/PanoramaKeyGenAuthentication.md | 33 + .../docs/PanoramaTokenAuthentication.md | 31 + .../docs/WebhookOperationsApi.md | 4 +- .../thousandeyes_sdk/connectors/__init__.py | 6 + .../connectors/api/__init__.py | 1 + .../connectors/api/panorama_connectors_api.py | 2157 ++ .../connectors/models/__init__.py | 5 + .../connectors/models/panorama_connector.py | 118 + .../models/panorama_connector_auth.py | 143 + .../connectors/models/panorama_connectors.py | 101 + .../models/panorama_key_gen_authentication.py | 101 + .../models/panorama_token_authentication.py | 96 + thousandeyes-sdk-connectors/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 3761 ++++ ...ential_vault_operations_api_integration.py | 1401 ++ .../test_cyber_ark_conjur_connectors_api.py | 2 +- ...r_ark_conjur_connectors_api_integration.py | 1548 ++ .../test/test_generic_connectors_api.py | 2 +- ...test_generic_connectors_api_integration.py | 1632 ++ .../test/test_operation_connectors_api.py | 2 +- ...st_operation_connectors_api_integration.py | 234 + .../test/test_panorama_connectors_api.py | 314 + ...est_panorama_connectors_api_integration.py | 1496 ++ .../test/test_utils.py | 23 +- ...test_webhook_operations_api_integration.py | 1434 ++ .../.openapi-generator/FILES | 4 + thousandeyes-sdk-credentials/README.md | 4 +- .../docs/CredentialsApi.md | 4 +- thousandeyes-sdk-credentials/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 604 + .../test/test_credentials_api_integration.py | 1140 + .../test/test_utils.py | 23 +- .../.openapi-generator/FILES | 16 + thousandeyes-sdk-dashboards/README.md | 9 +- .../docs/ApiDashboard.md | 1 + .../docs/ApiListWidgetRow.md | 30 + .../docs/ApiListWidgetRowLinks.md | 30 + .../docs/ApiListWidgetRowValue.md | 29 + .../docs/ApiTimeseriesWidget.md | 5 +- .../docs/ApiTimeseriesWidgetProperties.md | 34 + thousandeyes-sdk-dashboards/docs/ApiWidget.md | 5 +- .../docs/ApiWidgetsDataV2.md | 2 + thousandeyes-sdk-dashboards/docs/Dashboard.md | 1 + .../docs/DashboardSnapshotsApi.md | 4 +- .../docs/DashboardsApi.md | 6 +- .../docs/DashboardsFiltersApi.md | 4 +- .../docs/RefreshRate.md | 12 + .../thousandeyes_sdk/dashboards/__init__.py | 5 + .../dashboards/models/__init__.py | 5 + .../dashboards/models/api_dashboard.py | 5 +- .../dashboards/models/api_list_widget_row.py | 104 + .../models/api_list_widget_row_links.py | 91 + .../models/api_list_widget_row_value.py | 163 + .../models/api_timeseries_widget.py | 12 +- .../api_timeseries_widget_properties.py | 107 + .../dashboards/models/api_widgets_data_v2.py | 14 +- .../dashboards/models/dashboard.py | 5 +- .../dashboards/models/refresh_rate.py | 46 + thousandeyes-sdk-dashboards/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 5133 +++++ .../test/test_dashboard_snapshots_api.py | 192 +- ...est_dashboard_snapshots_api_integration.py | 2644 +++ .../test/test_dashboards_api.py | 196 +- .../test/test_dashboards_api_integration.py | 5151 +++++ ...test_dashboards_filters_api_integration.py | 1714 ++ .../test/test_utils.py | 23 +- .../.openapi-generator/FILES | 4 + thousandeyes-sdk-emulation/README.md | 4 +- .../docs/EmulationApi.md | 4 +- thousandeyes-sdk-emulation/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 340 + .../test/test_emulation_api_integration.py | 572 + thousandeyes-sdk-emulation/test/test_utils.py | 23 +- .../.openapi-generator/FILES | 7 + thousandeyes-sdk-endpoint-agents/README.md | 2 +- .../docs/AgentSearchFilters.md | 2 + .../docs/EndpointAgentsApi.md | 20 +- .../docs/EndpointAgentsTransferApi.md | 4 +- .../models/agent_search_filters.py | 6 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 2516 +++ ...ndpoint_agent_log_items_api_integration.py | 421 + .../test/test_endpoint_agents_api.py | 2 + .../test_endpoint_agents_api_integration.py | 2884 +++ ...ndpoint_agents_transfer_api_integration.py | 318 + .../test_endpoint_proxies_api_integration.py | 176 + .../test/test_utils.py | 23 +- .../.openapi-generator/FILES | 6 + .../README.md | 4 +- ...oServerEndpointInstantScheduledTestsApi.md | 2 +- ...PServerEndpointInstantScheduledTestsApi.md | 2 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 499 + ...instant_scheduled_tests_api_integration.py | 390 + ...instant_scheduled_tests_api_integration.py | 478 + ...instant_scheduled_tests_api_integration.py | 260 + .../test/test_utils.py | 23 +- .../.openapi-generator/FILES | 4 + thousandeyes-sdk-endpoint-labels/README.md | 4 +- .../docs/EndpointAgentLabelsApi.md | 8 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 575 + ...t_endpoint_agent_labels_api_integration.py | 1093 + .../test/test_utils.py | 23 +- .../.openapi-generator/FILES | 8 + .../README.md | 4 +- .../DynamicEndpointTestsDataSearchFilter.md | 2 + ...pointNetworkTopologyResultRequestFilter.md | 2 + .../docs/EndpointResultRequestFilter.md | 2 + .../docs/EndpointTestsDataSearchFilter.md | 2 + ...TPServerEndpointScheduledTestResultsApi.md | 10 +- .../docs/HttpEndpointTestsDataSearchFilter.md | 2 + .../LocalNetworkEndpointTestResultsApi.md | 6 +- ...ultiTestIdEndpointTestsDataSearchFilter.md | 2 + .../NetworkDynamicEndpointTestResultsApi.md | 4 +- .../NetworkEndpointScheduledTestResultsApi.md | 8 +- ...RealUserEndpointTestResultRequestFilter.md | 2 + .../docs/RealUserEndpointTestResultsApi.md | 6 +- ...namic_endpoint_tests_data_search_filter.py | 6 +- ..._network_topology_result_request_filter.py | 6 +- .../models/endpoint_result_request_filter.py | 8 +- .../endpoint_tests_data_search_filter.py | 8 +- .../http_endpoint_tests_data_search_filter.py | 8 +- ...st_id_endpoint_tests_data_search_filter.py | 8 +- ...ser_endpoint_test_result_request_filter.py | 6 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 7530 +++++++ ...ver_endpoint_scheduled_test_results_api.py | 4 + ..._scheduled_test_results_api_integration.py | 2418 ++ ...local_network_endpoint_test_results_api.py | 12 +- ...k_endpoint_test_results_api_integration.py | 1919 ++ ...twork_dynamic_endpoint_test_results_api.py | 2 + ...c_endpoint_test_results_api_integration.py | 2307 ++ ...ork_endpoint_scheduled_test_results_api.py | 6 +- ..._scheduled_test_results_api_integration.py | 2987 +++ ...est_real_user_endpoint_test_results_api.py | 6 + ...r_endpoint_test_results_api_integration.py | 2819 +++ .../test/test_utils.py | 23 +- .../.openapi-generator/FILES | 8 + thousandeyes-sdk-endpoint-tests/README.md | 4 +- .../AgentToServerEndpointDynamicTestsApi.md | 4 +- .../AgentToServerEndpointScheduledTestsApi.md | 4 +- .../HTTPServerEndpointScheduledTestsApi.md | 4 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 2809 +++ ..._endpoint_dynamic_tests_api_integration.py | 1548 ++ ...ndpoint_scheduled_tests_api_integration.py | 1561 ++ ...ndpoint_real_user_tests_api_integration.py | 176 + ...ndpoint_scheduled_tests_api_integration.py | 285 + ...ndpoint_scheduled_tests_api_integration.py | 1688 ++ .../test/test_utils.py | 23 +- .../.openapi-generator/FILES | 50 +- thousandeyes-sdk-event-detection/README.md | 25 +- .../docs/AgentBranchEventDetail.md | 44 + .../docs/AgentBranchEventGrouping.md | 30 + .../docs/AgentEventDetail.md | 44 + .../docs/AgentEventGrouping.md | 29 + .../docs/AgentLocalEventDetail.md | 3 +- .../docs/ApplicationEventDetail.md | 44 + .../docs/ApplicationEventGrouping.md | 29 + .../docs/DnsEventDetail.md | 3 +- .../docs/DnsNameEventDetail.md | 44 + .../docs/DnsNameEventGrouping.md | 29 + .../docs/DnsServerEventDetail.md | 44 + .../docs/DnsServerEventGrouping.md | 29 + .../docs/DomainEventDetail.md | 44 + .../docs/DomainEventGrouping.md | 29 + .../docs/Event.md | 3 +- ...AgentType.md => EventAffectedAgentType.md} | 4 +- .../docs/EventAgentType.md | 12 + .../docs/EventApiAffectedAgent.md | 2 +- .../docs/EventDetail.md | 7 +- .../docs/EventDetailBase.md | 3 +- .../docs/EventType.md | 2 +- .../docs/EventsApi.md | 6 +- .../docs/GatewayEventDetail.md | 44 + .../docs/GatewayEventGrouping.md | 30 + .../docs/NameServerEventDetail.md | 44 + .../docs/NameServerEventGrouping.md | 29 + .../docs/NetworkEventDetail.md | 3 +- .../docs/NetworkPopEventDetail.md | 3 +- .../docs/ProxyEventDetail.md | 3 +- .../docs/SimpleEventDetail.md | 2 +- .../docs/TargetEventDetail.md | 3 +- .../docs/TargetNetworkEventDetail.md | 3 +- .../docs/VpnEventDetail.md | 44 + .../docs/VpnEventGrouping.md | 30 + .../docs/WirelessEventDetail.md | 44 + .../docs/WirelessEventGrouping.md | 30 + .../event_detection/__init__.py | 23 +- .../event_detection/api/events_api.py | 24 +- .../event_detection/models/__init__.py | 23 +- .../models/agent_branch_event_detail.py | 164 + .../models/agent_branch_event_grouping.py | 93 + .../models/agent_event_detail.py | 164 + .../models/agent_event_grouping.py | 89 + .../models/agent_local_event_detail.py | 7 +- .../models/application_event_detail.py | 164 + .../models/application_event_grouping.py | 89 + .../models/dns_event_detail.py | 7 +- .../models/dns_name_event_detail.py | 164 + .../models/dns_name_event_grouping.py | 89 + .../models/dns_server_event_detail.py | 164 + .../models/dns_server_event_grouping.py | 89 + .../models/domain_event_detail.py | 164 + .../models/domain_event_grouping.py | 89 + .../event_detection/models/event.py | 7 +- ...t_type.py => event_affected_agent_type.py} | 9 +- .../models/event_agent_type.py | 41 + .../models/event_api_affected_agent.py | 4 +- .../event_detection/models/event_detail.py | 156 +- .../models/event_detail_base.py | 7 +- .../event_detection/models/event_type.py | 12 +- .../models/gateway_event_detail.py | 164 + .../models/gateway_event_grouping.py | 93 + .../models/name_server_event_detail.py | 164 + .../models/name_server_event_grouping.py | 89 + .../models/network_event_detail.py | 7 +- .../models/network_pop_event_detail.py | 7 +- .../models/proxy_event_detail.py | 7 +- .../models/simple_event_detail.py | 2 +- .../models/target_event_detail.py | 7 +- .../models/target_network_event_detail.py | 7 +- .../models/vpn_event_detail.py | 164 + .../models/vpn_event_grouping.py | 93 + .../models/wireless_event_detail.py | 164 + .../models/wireless_event_grouping.py | 93 + .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 460 + .../test/test_events_api.py | 31 +- .../test/test_events_api_integration.py | 789 + .../test/test_utils.py | 23 +- .../.openapi-generator/FILES | 18 + thousandeyes-sdk-instant-tests/README.md | 7 +- .../docs/APIInstantTestsApi.md | 4 +- .../docs/AgentToAgentInstantTestsApi.md | 4 +- .../docs/AgentToServerInstantTestsApi.md | 4 +- .../docs/DNSSECInstantTestsApi.md | 4 +- .../docs/DNSServerInstantTestsApi.md | 4 +- .../docs/DNSTraceInstantTestsApi.md | 4 +- .../docs/FTPServerInstantTestsApi.md | 4 +- .../docs/HTTPPageLoadInstantTestsApi.md | 4 +- .../docs/HTTPServerInstantTestsApi.md | 4 +- .../docs/PageLoadInstantTest.md | 1 + .../docs/PageLoadInstantTestRequest.md | 1 + .../docs/PageLoadInstantTestResponse.md | 1 + .../docs/PageLoadProperties.md | 1 + .../docs/SIPServerInstantTestsApi.md | 4 +- .../docs/TestChromiumTrack.md | 12 + .../docs/VoiceInstantTestsApi.md | 4 +- .../docs/WebTransactionInstantTest.md | 2 + .../docs/WebTransactionInstantTestRequest.md | 2 + .../docs/WebTransactionInstantTestResponse.md | 2 + .../docs/WebTransactionInstantTestsApi.md | 4 +- .../docs/WebTransactionProperties.md | 2 + .../instant_tests/__init__.py | 1 + .../instant_tests/models/__init__.py | 1 + .../models/page_load_instant_test.py | 5 +- .../models/page_load_instant_test_request.py | 5 +- .../models/page_load_instant_test_response.py | 5 +- .../models/page_load_properties.py | 5 +- .../models/test_chromium_track.py | 41 + .../models/web_transaction_instant_test.py | 7 +- .../web_transaction_instant_test_request.py | 7 +- .../web_transaction_instant_test_response.py | 7 +- .../models/web_transaction_properties.py | 7 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 3986 ++++ ..._to_agent_instant_tests_api_integration.py | 824 + ...to_server_instant_tests_api_integration.py | 833 + .../test_api_instant_tests_api_integration.py | 1724 ++ ...ns_server_instant_tests_api_integration.py | 839 + ...dns_trace_instant_tests_api_integration.py | 734 + ...st_dnssec_instant_tests_api_integration.py | 725 + ...tp_server_instant_tests_api_integration.py | 869 + .../test_http_page_load_instant_tests_api.py | 2 + ...page_load_instant_tests_api_integration.py | 1409 ++ ...tp_server_instant_tests_api_integration.py | 1328 ++ .../test_instant_tests_api_integration.py | 35 + ...ip_server_instant_tests_api_integration.py | 876 + .../test/test_utils.py | 23 +- ...est_voice_instant_tests_api_integration.py | 788 + .../test_web_transaction_instant_tests_api.py | 4 + ...ansaction_instant_tests_api_integration.py | 1436 ++ .../.openapi-generator/FILES | 5 + thousandeyes-sdk-internet-insights/README.md | 4 +- .../InternetInsightsCatalogProvidersApi.md | 2 +- .../docs/InternetInsightsOutagesApi.md | 2 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 899 + ...ights_catalog_providers_api_integration.py | 669 + ...ternet_insights_outages_api_integration.py | 972 + .../test/test_utils.py | 23 +- .../.openapi-generator/FILES | 4 + thousandeyes-sdk-snapshots/README.md | 4 +- .../docs/TestSnapshotsApi.md | 2 +- thousandeyes-sdk-snapshots/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 213 + .../test_test_snapshots_api_integration.py | 427 + thousandeyes-sdk-snapshots/test/test_utils.py | 23 +- .../.openapi-generator/FILES | 10 + thousandeyes-sdk-streaming/README.md | 8 +- .../docs/ConnectedDevices.md | 30 + .../docs/CreateStreamResponse.md | 1 + .../docs/GetStreamResponse.md | 1 + .../docs/InputConfig.md | 30 + .../docs/InputConfigMetric.md | 30 + thousandeyes-sdk-streaming/docs/PutStream.md | 1 + thousandeyes-sdk-streaming/docs/Stream.md | 1 + .../docs/StreamingApi.md | 8 +- .../thousandeyes_sdk/streaming/__init__.py | 5 +- .../streaming/api/streaming_api.py | 2 +- .../streaming/models/__init__.py | 5 +- .../streaming/models/api_error.py | 2 +- .../models/api_error_integration_limits.py | 2 +- .../streaming/models/audit_operation.py | 2 +- .../models/audit_operation_with_update.py | 2 +- .../streaming/models/bad_request_error.py | 2 +- .../streaming/models/connected_devices.py | 87 + .../models/create_stream_response.py | 10 +- .../streaming/models/data_model_version.py | 2 +- .../streaming/models/endpoint_agent_label.py | 2 +- .../streaming/models/endpoint_agent_tag.py | 2 +- .../streaming/models/endpoint_type.py | 2 +- .../streaming/models/exporter_config.py | 2 +- .../models/exporter_config_authorization.py | 2 +- .../models/exporter_config_o_auth2.py | 2 +- .../models/exporter_config_splunk_hec.py | 2 +- .../streaming/models/filters.py | 2 +- .../streaming/models/filters_test_types.py | 2 +- .../streaming/models/get_stream_response.py | 10 +- .../streaming/models/input_config.py | 91 + .../streaming/models/input_config_metric.py | 91 + .../streaming/models/put_stream.py | 10 +- .../streaming/models/signal.py | 2 +- .../streaming/models/stream.py | 10 +- .../streaming/models/stream_links.py | 2 +- .../streaming/models/stream_response.py | 2 +- .../streaming/models/stream_self_link.py | 2 +- .../streaming/models/stream_status.py | 2 +- .../streaming/models/stream_status_type.py | 2 +- .../streaming/models/stream_type.py | 2 +- .../streaming/models/tag_match.py | 2 +- .../streaming/models/test_match.py | 2 +- .../streaming/models/test_match_domain.py | 2 +- .../streaming/models/test_type.py | 2 +- .../streaming/models/unauthorized_error.py | 2 +- thousandeyes-sdk-streaming/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 808 + .../test/test_streaming_api.py | 51 +- .../test/test_streaming_api_integration.py | 1502 ++ thousandeyes-sdk-streaming/test/test_utils.py | 23 +- .../.openapi-generator/FILES | 5 + thousandeyes-sdk-tags/README.md | 4 +- .../docs/TagAssignmentApi.md | 14 +- thousandeyes-sdk-tags/docs/TagsApi.md | 20 +- .../tags/api/tag_assignment_api.py | 6 +- .../src/thousandeyes_sdk/tags/api/tags_api.py | 10 +- .../src/thousandeyes_sdk/tags/models/tag.py | 5 + .../thousandeyes_sdk/tags/models/tag_info.py | 5 + 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 | 1717 ++ .../test/test_tags_api_integration.py | 2469 +++ thousandeyes-sdk-tags/test/test_utils.py | 23 +- .../.openapi-generator/FILES | 21 + thousandeyes-sdk-test-results/README.md | 6 +- .../docs/ConsoleLogs.md | 32 + .../docs/ConsoleLogsResult.md | 33 + .../docs/ConsoleLogsTestResults.md | 31 + .../docs/NetworkTestResult.md | 3 +- .../docs/NetworkTestResultsApi.md | 6 +- .../docs/WebHTTPServerTestResultsApi.md | 2 +- .../docs/WebTransactionsTestResultsApi.md | 93 + .../thousandeyes_sdk/test_results/__init__.py | 3 + .../api/web_transactions_test_results_api.py | 331 + .../test_results/models/__init__.py | 3 + .../test_results/models/console_logs.py | 91 + .../models/console_logs_result.py | 116 + .../models/console_logs_test_results.py | 107 + .../models/network_test_result.py | 10 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 6521 ++++++ .../test_api_test_results_api_integration.py | 965 + ...dns_server_test_results_api_integration.py | 945 + ..._dns_trace_test_results_api_integration.py | 482 + ...est_dnssec_test_results_api_integration.py | 472 + ...etwork_bgp_test_results_api_integration.py | 853 + .../test/test_network_test_results_api.py | 38 +- ...st_network_test_results_api_integration.py | 1442 ++ .../test/test_utils.py | 23 +- ...rtp_server_test_results_api_integration.py | 490 + ...sip_server_test_results_api_integration.py | 500 + ...ftp_server_test_results_api_integration.py | 494 + ...ttp_server_test_results_api_integration.py | 676 + ..._page_load_test_results_api_integration.py | 1307 ++ .../test_web_transactions_test_results_api.py | 136 + ...ansactions_test_results_api_integration.py | 2191 ++ .../.openapi-generator/FILES | 20 + thousandeyes-sdk-tests/README.md | 7 +- thousandeyes-sdk-tests/docs/APITestsApi.md | 10 +- .../docs/AgentToAgentTestsApi.md | 10 +- .../docs/AgentToServerTestsApi.md | 10 +- thousandeyes-sdk-tests/docs/BGPTestsApi.md | 10 +- thousandeyes-sdk-tests/docs/DNSSECTestsApi.md | 10 +- .../docs/DNSServerTestsApi.md | 10 +- .../docs/DNSTraceTestsApi.md | 10 +- .../docs/FTPServerTestsApi.md | 10 +- .../docs/HTTPServerTestsApi.md | 10 +- .../docs/PageLoadInstantTest.md | 1 + .../docs/PageLoadProperties.md | 1 + thousandeyes-sdk-tests/docs/PageLoadTest.md | 1 + .../docs/PageLoadTestRequest.md | 1 + .../docs/PageLoadTestResponse.md | 1 + .../docs/PageLoadTestsApi.md | 10 +- .../PathVisualizationInterfaceGroupsApi.md | 4 +- .../docs/SIPServerTestsApi.md | 10 +- .../docs/TestChromiumTrack.md | 12 + .../docs/UnexpandedPageLoadTest.md | 1 + .../docs/UnexpandedWebTransactionTest.md | 2 + thousandeyes-sdk-tests/docs/VoiceTestsApi.md | 10 +- .../docs/WebTransactionInstantTest.md | 2 + .../docs/WebTransactionProperties.md | 2 + .../docs/WebTransactionTest.md | 2 + .../docs/WebTransactionTestRequest.md | 2 + .../docs/WebTransactionTestResponse.md | 2 + .../docs/WebTransactionTestsApi.md | 10 +- .../src/thousandeyes_sdk/tests/__init__.py | 1 + .../thousandeyes_sdk/tests/models/__init__.py | 1 + .../tests/models/page_load_instant_test.py | 5 +- .../tests/models/page_load_properties.py | 5 +- .../tests/models/page_load_test.py | 5 +- .../tests/models/page_load_test_request.py | 5 +- .../tests/models/page_load_test_response.py | 5 +- .../tests/models/test_chromium_track.py | 41 + .../tests/models/unexpanded_page_load_test.py | 5 +- .../models/unexpanded_web_transaction_test.py | 7 +- .../models/web_transaction_instant_test.py | 7 +- .../models/web_transaction_properties.py | 7 +- .../tests/models/web_transaction_test.py | 7 +- .../models/web_transaction_test_request.py | 7 +- .../models/web_transaction_test_response.py | 7 +- thousandeyes-sdk-tests/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + thousandeyes-sdk-tests/test/mock_manifest.py | 18334 ++++++++++++++++ ...st_agent_to_agent_tests_api_integration.py | 2669 +++ ...t_agent_to_server_tests_api_integration.py | 2506 +++ .../test/test_api_tests_api_integration.py | 4753 ++++ .../test/test_bgp_tests_api_integration.py | 2105 ++ .../test_dns_server_tests_api_integration.py | 2720 +++ .../test_dns_trace_tests_api_integration.py | 2356 ++ .../test/test_dnssec_tests_api_integration.py | 2335 ++ .../test_ftp_server_tests_api_integration.py | 2746 +++ .../test_http_server_tests_api_integration.py | 3845 ++++ .../test/test_page_load_tests_api.py | 7 + .../test_page_load_tests_api_integration.py | 4076 ++++ ...zation_interface_groups_api_integration.py | 1067 + .../test_sip_server_tests_api_integration.py | 2757 +++ .../test/test_tests_api_integration.py | 445 + thousandeyes-sdk-tests/test/test_utils.py | 23 +- .../test/test_voice_tests_api_integration.py | 2585 +++ .../test/test_web_transaction_tests_api.py | 14 + ...t_web_transaction_tests_api_integration.py | 4116 ++++ .../.openapi-generator/FILES | 5 + thousandeyes-sdk-usage/README.md | 4 +- thousandeyes-sdk-usage/docs/QuotasApi.md | 8 +- thousandeyes-sdk-usage/docs/UsageApi.md | 2 +- 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 | 1343 ++ .../test/test_usage_api_integration.py | 878 + thousandeyes-sdk-usage/test/test_utils.py | 23 +- 546 files changed, 210491 insertions(+), 630 deletions(-) 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-bgp-monitors/test/conftest.py create mode 100644 thousandeyes-sdk-bgp-monitors/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-bgp-monitors/test/mock_manifest.py create mode 100644 thousandeyes-sdk-bgp-monitors/test/test_bgp_monitors_api_integration.py create mode 100644 thousandeyes-sdk-connectors/docs/PanoramaConnector.md create mode 100644 thousandeyes-sdk-connectors/docs/PanoramaConnectorAuth.md create mode 100644 thousandeyes-sdk-connectors/docs/PanoramaConnectors.md create mode 100644 thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md create mode 100644 thousandeyes-sdk-connectors/docs/PanoramaKeyGenAuthentication.md create mode 100644 thousandeyes-sdk-connectors/docs/PanoramaTokenAuthentication.md create mode 100644 thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/api/panorama_connectors_api.py create mode 100644 thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connector.py create mode 100644 thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connector_auth.py create mode 100644 thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connectors.py create mode 100644 thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_key_gen_authentication.py create mode 100644 thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_token_authentication.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_panorama_connectors_api.py create mode 100644 thousandeyes-sdk-connectors/test/test_panorama_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/docs/ApiListWidgetRow.md create mode 100644 thousandeyes-sdk-dashboards/docs/ApiListWidgetRowLinks.md create mode 100644 thousandeyes-sdk-dashboards/docs/ApiListWidgetRowValue.md create mode 100644 thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidgetProperties.md create mode 100644 thousandeyes-sdk-dashboards/docs/RefreshRate.md create mode 100644 thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row.py create mode 100644 thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row_links.py create mode 100644 thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row_value.py create mode 100644 thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_timeseries_widget_properties.py create mode 100644 thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/refresh_rate.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/docs/AgentBranchEventDetail.md create mode 100644 thousandeyes-sdk-event-detection/docs/AgentBranchEventGrouping.md create mode 100644 thousandeyes-sdk-event-detection/docs/AgentEventDetail.md create mode 100644 thousandeyes-sdk-event-detection/docs/AgentEventGrouping.md create mode 100644 thousandeyes-sdk-event-detection/docs/ApplicationEventDetail.md create mode 100644 thousandeyes-sdk-event-detection/docs/ApplicationEventGrouping.md create mode 100644 thousandeyes-sdk-event-detection/docs/DnsNameEventDetail.md create mode 100644 thousandeyes-sdk-event-detection/docs/DnsNameEventGrouping.md create mode 100644 thousandeyes-sdk-event-detection/docs/DnsServerEventDetail.md create mode 100644 thousandeyes-sdk-event-detection/docs/DnsServerEventGrouping.md create mode 100644 thousandeyes-sdk-event-detection/docs/DomainEventDetail.md create mode 100644 thousandeyes-sdk-event-detection/docs/DomainEventGrouping.md rename thousandeyes-sdk-event-detection/docs/{CloudEnterpriseAgentType.md => EventAffectedAgentType.md} (83%) create mode 100644 thousandeyes-sdk-event-detection/docs/EventAgentType.md create mode 100644 thousandeyes-sdk-event-detection/docs/GatewayEventDetail.md create mode 100644 thousandeyes-sdk-event-detection/docs/GatewayEventGrouping.md create mode 100644 thousandeyes-sdk-event-detection/docs/NameServerEventDetail.md create mode 100644 thousandeyes-sdk-event-detection/docs/NameServerEventGrouping.md create mode 100644 thousandeyes-sdk-event-detection/docs/VpnEventDetail.md create mode 100644 thousandeyes-sdk-event-detection/docs/VpnEventGrouping.md create mode 100644 thousandeyes-sdk-event-detection/docs/WirelessEventDetail.md create mode 100644 thousandeyes-sdk-event-detection/docs/WirelessEventGrouping.md create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_branch_event_detail.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_branch_event_grouping.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_event_detail.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_event_grouping.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/application_event_detail.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/application_event_grouping.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_name_event_detail.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_name_event_grouping.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_server_event_detail.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_server_event_grouping.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/domain_event_detail.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/domain_event_grouping.py rename thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/{cloud_enterprise_agent_type.py => event_affected_agent_type.py} (86%) create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_agent_type.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/gateway_event_detail.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/gateway_event_grouping.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/name_server_event_detail.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/name_server_event_grouping.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/vpn_event_detail.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/vpn_event_grouping.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/wireless_event_detail.py create mode 100644 thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/wireless_event_grouping.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/docs/TestChromiumTrack.md create mode 100644 thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/test_chromium_track.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/docs/ConnectedDevices.md create mode 100644 thousandeyes-sdk-streaming/docs/InputConfig.md create mode 100644 thousandeyes-sdk-streaming/docs/InputConfigMetric.md create mode 100644 thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/connected_devices.py create mode 100644 thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/input_config.py create mode 100644 thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/input_config_metric.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/docs/ConsoleLogs.md create mode 100644 thousandeyes-sdk-test-results/docs/ConsoleLogsResult.md create mode 100644 thousandeyes-sdk-test-results/docs/ConsoleLogsTestResults.md create mode 100644 thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs.py create mode 100644 thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs_result.py create mode 100644 thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs_test_results.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/docs/TestChromiumTrack.md create mode 100644 thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/test_chromium_track.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/.openapi-generator/FILES b/thousandeyes-sdk-administrative/.openapi-generator/FILES index d763288d9..b42cabca6 100644 --- a/thousandeyes-sdk-administrative/.openapi-generator/FILES +++ b/thousandeyes-sdk-administrative/.openapi-generator/FILES @@ -126,9 +126,17 @@ src/thousandeyes_sdk/administrative/models/validation_error.py src/thousandeyes_sdk/administrative/models/validation_error_item.py src/thousandeyes_sdk/administrative/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_account_groups_api.py +test/test_account_groups_api_integration.py test/test_permissions_api.py +test/test_permissions_api_integration.py test/test_roles_api.py +test/test_roles_api_integration.py test/test_user_events_api.py +test/test_user_events_api_integration.py test/test_users_api.py +test/test_users_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-administrative/README.md b/thousandeyes-sdk-administrative/README.md index 5507d080f..2e7703c77 100644 --- a/thousandeyes-sdk-administrative/README.md +++ b/thousandeyes-sdk-administrative/README.md @@ -12,7 +12,7 @@ This API provides the following operations to manage your organization: This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -85,8 +85,8 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.administrative.AccountGroupsApi(api_client) - account_group_request = thousandeyes_sdk.administrative.AccountGroupRequest() # AccountGroupRequest | - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional) + account_group_request = # AccountGroupRequest | + expand = # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional) try: # Create account group diff --git a/thousandeyes-sdk-administrative/docs/AccountGroupsApi.md b/thousandeyes-sdk-administrative/docs/AccountGroupsApi.md index 962327764..196aa8a21 100644 --- a/thousandeyes-sdk-administrative/docs/AccountGroupsApi.md +++ b/thousandeyes-sdk-administrative/docs/AccountGroupsApi.md @@ -50,8 +50,8 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.administrative.AccountGroupsApi(api_client) - account_group_request = thousandeyes_sdk.administrative.AccountGroupRequest() # AccountGroupRequest | - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional) + account_group_request = # AccountGroupRequest | + expand = # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional) try: # Create account group @@ -219,7 +219,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.administrative.AccountGroupsApi(api_client) id = '1234' # str | Identifier for the account group. - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional) + expand = # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional) try: # Retrieve account group @@ -387,8 +387,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.administrative.AccountGroupsApi(api_client) id = '1234' # str | Identifier for the account group. - account_group_request = thousandeyes_sdk.administrative.AccountGroupRequest() # AccountGroupRequest | - expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional) + account_group_request = # AccountGroupRequest | + expand = # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional) try: # Update account group diff --git a/thousandeyes-sdk-administrative/docs/RolesApi.md b/thousandeyes-sdk-administrative/docs/RolesApi.md index 9a09bae94..90ce1fc33 100644 --- a/thousandeyes-sdk-administrative/docs/RolesApi.md +++ b/thousandeyes-sdk-administrative/docs/RolesApi.md @@ -49,7 +49,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.administrative.RolesApi(api_client) - role_request_body = thousandeyes_sdk.administrative.RoleRequestBody() # RoleRequestBody | + role_request_body = # RoleRequestBody | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -390,7 +390,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.administrative.RolesApi(api_client) id = '23' # str | The ID of the desired role. - role_request_body = thousandeyes_sdk.administrative.RoleRequestBody() # RoleRequestBody | + role_request_body = # RoleRequestBody | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-administrative/docs/UsersApi.md b/thousandeyes-sdk-administrative/docs/UsersApi.md index 7b8ea38a9..7060b3a58 100644 --- a/thousandeyes-sdk-administrative/docs/UsersApi.md +++ b/thousandeyes-sdk-administrative/docs/UsersApi.md @@ -50,7 +50,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.administrative.UsersApi(api_client) - user_request = thousandeyes_sdk.administrative.UserRequest() # UserRequest | + user_request = # UserRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -471,7 +471,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.administrative.UsersApi(api_client) id = '1234' # str | Identifier for the user. - user_request = thousandeyes_sdk.administrative.UserRequest() # UserRequest | + user_request = # UserRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-administrative/test/conftest.py b/thousandeyes-sdk-administrative/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..34cbcff51 --- /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 000000000..bfb0cf8e9 --- /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 000000000..f30b9f776 --- /dev/null +++ b/thousandeyes-sdk-administrative/test/test_account_groups_api_integration.py @@ -0,0 +1,1820 @@ +# 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) + 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, + + _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) + 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, + + _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) + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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) + error_body_json = """ + { + "instance" : "instance", + "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, + + _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) + error_body_json = """ + { + "instance" : "instance", + "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, + + _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) + error_body_json = """ + { + "instance" : "instance", + "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, + + _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) + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..cb461ad65 --- /dev/null +++ b/thousandeyes-sdk-administrative/test/test_permissions_api_integration.py @@ -0,0 +1,233 @@ +# 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 000000000..f79e5a8dd --- /dev/null +++ b/thousandeyes-sdk-administrative/test/test_roles_api_integration.py @@ -0,0 +1,1224 @@ +# 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 000000000..908d363fa --- /dev/null +++ b/thousandeyes-sdk-administrative/test/test_user_events_api_integration.py @@ -0,0 +1,373 @@ +# 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 000000000..c1a0b9d27 --- /dev/null +++ b/thousandeyes-sdk-administrative/test/test_users_api_integration.py @@ -0,0 +1,1695 @@ +# 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-administrative/test/test_utils.py b/thousandeyes-sdk-administrative/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-agents/.openapi-generator/FILES index 9bf3aa4f2..fd34b61d7 100644 --- a/thousandeyes-sdk-agents/.openapi-generator/FILES +++ b/thousandeyes-sdk-agents/.openapi-generator/FILES @@ -140,10 +140,19 @@ src/thousandeyes_sdk/agents/models/validation_error.py src/thousandeyes_sdk/agents/models/validation_error_item.py src/thousandeyes_sdk/agents/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_agent_proxies_api.py +test/test_agent_proxies_api_integration.py test/test_cloud_and_enterprise_agent_notification_rules_api.py +test/test_cloud_and_enterprise_agent_notification_rules_api_integration.py test/test_cloud_and_enterprise_agents_api.py +test/test_cloud_and_enterprise_agents_api_integration.py test/test_enterprise_agent_cluster_api.py +test/test_enterprise_agent_cluster_api_integration.py test/test_local_problems_api.py +test/test_local_problems_api_integration.py test/test_tests_assignment_on_agents_api.py +test/test_tests_assignment_on_agents_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-agents/README.md b/thousandeyes-sdk-agents/README.md index 6b20ca10f..1f8153c56 100644 --- a/thousandeyes-sdk-agents/README.md +++ b/thousandeyes-sdk-agents/README.md @@ -5,7 +5,7 @@ Manage Cloud and Enterprise Agents available to your account in ThousandEyes. This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator diff --git a/thousandeyes-sdk-agents/docs/CloudAndEnterpriseAgentsApi.md b/thousandeyes-sdk-agents/docs/CloudAndEnterpriseAgentsApi.md index 49cdb23aa..3a16da864 100644 --- a/thousandeyes-sdk-agents/docs/CloudAndEnterpriseAgentsApi.md +++ b/thousandeyes-sdk-agents/docs/CloudAndEnterpriseAgentsApi.md @@ -134,7 +134,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.agents.CloudAndEnterpriseAgentsApi(api_client) agent_id = '281474976710706' # str | Unique ID for the agent. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional) + expand = # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional) try: # Retrieve Cloud and Enterprise Agent @@ -224,8 +224,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.agents.CloudAndEnterpriseAgentsApi(api_client) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.agents.AgentListExpand()] # List[AgentListExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional) - agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] # List[CloudEnterpriseAgentType] | Specifies the type of agent to request. (optional) + expand = # List[AgentListExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional) + agent_types = # List[CloudEnterpriseAgentType] | Specifies the type of agent to request. (optional) labels = ['[\"myCustomLabeledAgent\"]'] # List[str] | Specifies the labels of the agents to request. (optional) tag_keys = ['tag_keys_example'] # List[str] | Specifies which tag keys to request from the agents. (optional) @@ -319,9 +319,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.agents.CloudAndEnterpriseAgentsApi(api_client) agent_id = '281474976710706' # str | Unique ID for the agent. - agent_request = thousandeyes_sdk.agents.AgentRequest() # AgentRequest | + agent_request = # AgentRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional) + expand = # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional) try: # Update Enterprise Agent diff --git a/thousandeyes-sdk-agents/docs/EnterpriseAgentClusterApi.md b/thousandeyes-sdk-agents/docs/EnterpriseAgentClusterApi.md index c7e5c60b2..1d1c04db6 100644 --- a/thousandeyes-sdk-agents/docs/EnterpriseAgentClusterApi.md +++ b/thousandeyes-sdk-agents/docs/EnterpriseAgentClusterApi.md @@ -48,9 +48,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.agents.EnterpriseAgentClusterApi(api_client) agent_id = '281474976710706' # str | Unique ID for the Enterprise Agent cluster to add new agents to. - agent_cluster_assign_request = thousandeyes_sdk.agents.AgentClusterAssignRequest() # AgentClusterAssignRequest | + agent_cluster_assign_request = # AgentClusterAssignRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional) + expand = # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional) try: # Add member to Enterprise Agent cluster @@ -142,9 +142,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.agents.EnterpriseAgentClusterApi(api_client) agent_id = '281474976710706' # str | Unique ID for the Enterprise Agent cluster to remove agents from. - agent_cluster_unassign_request = thousandeyes_sdk.agents.AgentClusterUnassignRequest() # AgentClusterUnassignRequest | + agent_cluster_unassign_request = # AgentClusterUnassignRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional) + expand = # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional) try: # Remove member from Enterprise Agent cluster diff --git a/thousandeyes-sdk-agents/docs/TestsAssignmentOnAgentsApi.md b/thousandeyes-sdk-agents/docs/TestsAssignmentOnAgentsApi.md index 9822e88f8..5a54094fd 100644 --- a/thousandeyes-sdk-agents/docs/TestsAssignmentOnAgentsApi.md +++ b/thousandeyes-sdk-agents/docs/TestsAssignmentOnAgentsApi.md @@ -48,7 +48,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.agents.TestsAssignmentOnAgentsApi(api_client) agent_id = '281474976710706' # str | Unique ID for the Enterprise Agent cluster to add new agents to. - agent_tests_assign_request = thousandeyes_sdk.agents.AgentTestsAssignRequest() # AgentTestsAssignRequest | + agent_tests_assign_request = # AgentTestsAssignRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -139,7 +139,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.agents.TestsAssignmentOnAgentsApi(api_client) agent_id = '281474976710706' # str | Unique ID for the Enterprise Agent cluster to add new agents to. - agent_tests_assign_request = thousandeyes_sdk.agents.AgentTestsAssignRequest() # AgentTestsAssignRequest | + agent_tests_assign_request = # AgentTestsAssignRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -230,7 +230,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.agents.TestsAssignmentOnAgentsApi(api_client) agent_id = '281474976710706' # str | Unique ID for the Enterprise Agent cluster to add new agents to. - agent_tests_assign_request = thousandeyes_sdk.agents.AgentTestsAssignRequest() # AgentTestsAssignRequest | + agent_tests_assign_request = # AgentTestsAssignRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-agents/test/conftest.py b/thousandeyes-sdk-agents/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..7813e9662 --- /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 000000000..2007d92e7 --- /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 000000000..c49fe42e8 --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_agent_proxies_api_integration.py @@ -0,0 +1,238 @@ +# 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 000000000..f3e5a4a03 --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agent_notification_rules_api_integration.py @@ -0,0 +1,517 @@ +# 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 000000000..92c940db9 --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_cloud_and_enterprise_agents_api_integration.py @@ -0,0 +1,1250 @@ +# 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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..b734cdc25 --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_enterprise_agent_cluster_api_integration.py @@ -0,0 +1,809 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..bd908a0b0 --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_local_problems_api_integration.py @@ -0,0 +1,344 @@ +# 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 000000000..d68982487 --- /dev/null +++ b/thousandeyes-sdk-agents/test/test_tests_assignment_on_agents_api_integration.py @@ -0,0 +1,1280 @@ +# 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-agents/test/test_utils.py b/thousandeyes-sdk-agents/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-alerts/.openapi-generator/FILES index eeb9f4a7e..ec14360c3 100644 --- a/thousandeyes-sdk-alerts/.openapi-generator/FILES +++ b/thousandeyes-sdk-alerts/.openapi-generator/FILES @@ -134,7 +134,13 @@ src/thousandeyes_sdk/alerts/models/validation_error_item.py src/thousandeyes_sdk/alerts/models/webhook_integration_type.py src/thousandeyes_sdk/alerts/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_alert_rules_api.py +test/test_alert_rules_api_integration.py test/test_alert_suppression_windows_api.py +test/test_alert_suppression_windows_api_integration.py test/test_alerts_api.py +test/test_alerts_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-alerts/README.md b/thousandeyes-sdk-alerts/README.md index fc5818071..638529c32 100644 --- a/thousandeyes-sdk-alerts/README.md +++ b/thousandeyes-sdk-alerts/README.md @@ -14,7 +14,7 @@ For more information about the alerts, see [Alerts](https://docs.thousandeyes.co This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -87,7 +87,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.alerts.AlertRulesApi(api_client) - rule_detail_update = thousandeyes_sdk.alerts.RuleDetailUpdate() # RuleDetailUpdate | + rule_detail_update = # RuleDetailUpdate | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-alerts/docs/AlertRulesApi.md b/thousandeyes-sdk-alerts/docs/AlertRulesApi.md index 69b6ec0cf..01bcd6017 100644 --- a/thousandeyes-sdk-alerts/docs/AlertRulesApi.md +++ b/thousandeyes-sdk-alerts/docs/AlertRulesApi.md @@ -49,7 +49,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.alerts.AlertRulesApi(api_client) - rule_detail_update = thousandeyes_sdk.alerts.RuleDetailUpdate() # RuleDetailUpdate | + rule_detail_update = # RuleDetailUpdate | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -388,7 +388,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.alerts.AlertRulesApi(api_client) rule_id = '127094' # str | Unique alert rule ID. - rule_detail_update = thousandeyes_sdk.alerts.RuleDetailUpdate() # RuleDetailUpdate | + rule_detail_update = # RuleDetailUpdate | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-alerts/docs/AlertSuppressionWindowsApi.md b/thousandeyes-sdk-alerts/docs/AlertSuppressionWindowsApi.md index e99134df3..900200324 100644 --- a/thousandeyes-sdk-alerts/docs/AlertSuppressionWindowsApi.md +++ b/thousandeyes-sdk-alerts/docs/AlertSuppressionWindowsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.alerts.AlertSuppressionWindowsApi(api_client) - alert_suppression_window_request = thousandeyes_sdk.alerts.AlertSuppressionWindowRequest() # AlertSuppressionWindowRequest | + alert_suppression_window_request = # AlertSuppressionWindowRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional) + expand = # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional) try: # Create alert suppression window @@ -224,7 +224,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.alerts.AlertSuppressionWindowsApi(api_client) window_id = '2411' # str | Unique window ID. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional) + expand = # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional) try: # Retrieve alert suppression window @@ -395,9 +395,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.alerts.AlertSuppressionWindowsApi(api_client) window_id = '2411' # str | Unique window ID. - alert_suppression_window_request = thousandeyes_sdk.alerts.AlertSuppressionWindowRequest() # AlertSuppressionWindowRequest | + alert_suppression_window_request = # AlertSuppressionWindowRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional) + expand = # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional) try: # Update alert suppression window diff --git a/thousandeyes-sdk-alerts/docs/AlertsApi.md b/thousandeyes-sdk-alerts/docs/AlertsApi.md index 846f80dbe..99df3923d 100644 --- a/thousandeyes-sdk-alerts/docs/AlertsApi.md +++ b/thousandeyes-sdk-alerts/docs/AlertsApi.md @@ -136,7 +136,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) max = 5 # int | (Optional) Maximum number of objects to return. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - state = thousandeyes_sdk.alerts.State() # State | Optional parameter to match a specific alert state. If not specified, it defaults to `trigger`. (optional) + state = # State | Optional parameter to match a specific alert state. If not specified, it defaults to `trigger`. (optional) try: # List alerts diff --git a/thousandeyes-sdk-alerts/test/conftest.py b/thousandeyes-sdk-alerts/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..24b37d08c --- /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 000000000..b1d811c7a --- /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 000000000..5e96180d5 --- /dev/null +++ b/thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py @@ -0,0 +1,2130 @@ +# 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 000000000..382665c5d --- /dev/null +++ b/thousandeyes-sdk-alerts/test/test_alert_suppression_windows_api_integration.py @@ -0,0 +1,1625 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..7d0bc39d2 --- /dev/null +++ b/thousandeyes-sdk-alerts/test/test_alerts_api_integration.py @@ -0,0 +1,680 @@ +# 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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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-alerts/test/test_utils.py b/thousandeyes-sdk-alerts/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-bgp-monitors/.openapi-generator/FILES index 51ff2ec6a..a75b55a74 100644 --- a/thousandeyes-sdk-bgp-monitors/.openapi-generator/FILES +++ b/thousandeyes-sdk-bgp-monitors/.openapi-generator/FILES @@ -24,5 +24,9 @@ src/thousandeyes_sdk/bgp_monitors/models/self_links.py src/thousandeyes_sdk/bgp_monitors/models/unauthorized_error.py src/thousandeyes_sdk/bgp_monitors/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_bgp_monitors_api.py +test/test_bgp_monitors_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-bgp-monitors/README.md b/thousandeyes-sdk-bgp-monitors/README.md index 17438bcf5..01b478937 100644 --- a/thousandeyes-sdk-bgp-monitors/README.md +++ b/thousandeyes-sdk-bgp-monitors/README.md @@ -10,7 +10,7 @@ For more information about monitors, see [Inside-Out BGP Visibility](https://doc This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator diff --git a/thousandeyes-sdk-bgp-monitors/test/conftest.py b/thousandeyes-sdk-bgp-monitors/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /dev/null +++ b/thousandeyes-sdk-bgp-monitors/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-bgp-monitors/test/integration_test_utils.py b/thousandeyes-sdk-bgp-monitors/test/integration_test_utils.py new file mode 100644 index 000000000..d3f74d52e --- /dev/null +++ b/thousandeyes-sdk-bgp-monitors/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + BGP Monitors API + + **Note:** Private monitor data is not available for ThousandEyes for Government instance. Retrieve information about BGP monitors available to your ThousandEyes account. ThousandEyes ingests BGP routing data from dozens of global BGP collectors and automatically integrates that visibility as a configurable layer under service, network, and path visualization layers. When you specify a service URL in a test, layered BGP tests automatically track reachability and path changes for any relevant prefix. When you use an IP address as the target for a test, the ThousandEyes platform monitors the relevant internet-routed prefix. You can also create specific BGP monitoring for a prefix, and can alert on hijacks and leaks. For more information about monitors, see [Inside-Out BGP Visibility](https://docs.thousandeyes.com/product-documentation/internet-and-wan-monitoring/tests/bgp-tests/inside-out-bgp-visibility). + + 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-bgp-monitors/test/mock_manifest.py b/thousandeyes-sdk-bgp-monitors/test/mock_manifest.py new file mode 100644 index 000000000..e65165d84 --- /dev/null +++ b/thousandeyes-sdk-bgp-monitors/test/mock_manifest.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + BGP Monitors API + + **Note:** Private monitor data is not available for ThousandEyes for Government instance. Retrieve information about BGP monitors available to your ThousandEyes account. ThousandEyes ingests BGP routing data from dozens of global BGP collectors and automatically integrates that visibility as a configurable layer under service, network, and path visualization layers. When you specify a service URL in a test, layered BGP tests automatically track reachability and path changes for any relevant prefix. When you use an IP address as the target for a test, the ThousandEyes platform monitors the relevant internet-routed prefix. You can also create specific BGP monitoring for a prefix, and can alert on hijacks and leaks. For more information about monitors, see [Inside-Out BGP Visibility](https://docs.thousandeyes.com/product-documentation/internet-and-wan-monitoring/tests/bgp-tests/inside-out-bgp-visibility). + + 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_bgp_monitors": OperationExpectation( + operation_id="get_bgp_monitors", + method="GET", + path="/monitors", + 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" + } + }, + "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", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-bgp-monitors/test/test_bgp_monitors_api_integration.py b/thousandeyes-sdk-bgp-monitors/test/test_bgp_monitors_api_integration.py new file mode 100644 index 000000000..fd563ee09 --- /dev/null +++ b/thousandeyes-sdk-bgp-monitors/test/test_bgp_monitors_api_integration.py @@ -0,0 +1,203 @@ +# coding: utf-8 + +""" + BGP Monitors API + + **Note:** Private monitor data is not available for ThousandEyes for Government instance. Retrieve information about BGP monitors available to your ThousandEyes account. ThousandEyes ingests BGP routing data from dozens of global BGP collectors and automatically integrates that visibility as a configurable layer under service, network, and path visualization layers. When you specify a service URL in a test, layered BGP tests automatically track reachability and path changes for any relevant prefix. When you use an IP address as the target for a test, the ThousandEyes platform monitors the relevant internet-routed prefix. You can also create specific BGP monitoring for a prefix, and can alert on hijacks and leaks. For more information about monitors, see [Inside-Out BGP Visibility](https://docs.thousandeyes.com/product-documentation/internet-and-wan-monitoring/tests/bgp-tests/inside-out-bgp-visibility). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.bgp_monitors.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.bgp_monitors.api.bgp_monitors_api import BGPMonitorsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestBGPMonitorsApiIntegration(IntegrationTestBase): + """BGPMonitorsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = BGPMonitorsApi(self.api_client) + + + def test_get_bgp_monitors_happy_path(self) -> None: + """Integration test for get_bgp_monitors 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" + } + }, + "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_monitors( + + aid=aid, + + _headers=self.te_headers("get_bgp_monitors"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_bgp_monitors_error_401(self) -> None: + """Integration test for get_bgp_monitors 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_monitors( + + aid=aid, + + _headers=self.te_headers("get_bgp_monitors", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_monitors_error_403(self) -> None: + """Integration test for get_bgp_monitors 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_monitors( + + aid=aid, + + _headers=self.te_headers("get_bgp_monitors", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_monitors_error_404(self) -> None: + """Integration test for get_bgp_monitors 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_monitors( + + aid=aid, + + _headers=self.te_headers("get_bgp_monitors", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_monitors_error_429(self) -> None: + """Integration test for get_bgp_monitors 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_monitors( + + aid=aid, + + _headers=self.te_headers("get_bgp_monitors", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_bgp_monitors_error_500(self) -> None: + """Integration test for get_bgp_monitors 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_monitors( + + aid=aid, + + _headers=self.te_headers("get_bgp_monitors", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-bgp-monitors/test/test_utils.py b/thousandeyes-sdk-bgp-monitors/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-connectors/.openapi-generator/FILES index 214399522..ebd7d11f1 100644 --- a/thousandeyes-sdk-connectors/.openapi-generator/FILES +++ b/thousandeyes-sdk-connectors/.openapi-generator/FILES @@ -28,6 +28,12 @@ docs/OperationConnectorsApi.md docs/OperationStatus.md docs/OperationType.md docs/OtherTokenAuthentication.md +docs/PanoramaConnector.md +docs/PanoramaConnectorAuth.md +docs/PanoramaConnectors.md +docs/PanoramaConnectorsApi.md +docs/PanoramaKeyGenAuthentication.md +docs/PanoramaTokenAuthentication.md docs/SelfLinks.md docs/UnauthorizedError.md docs/ValidationError.md @@ -43,6 +49,7 @@ src/thousandeyes_sdk/connectors/api/credential_vault_operations_api.py src/thousandeyes_sdk/connectors/api/cyber_ark_conjur_connectors_api.py src/thousandeyes_sdk/connectors/api/generic_connectors_api.py src/thousandeyes_sdk/connectors/api/operation_connectors_api.py +src/thousandeyes_sdk/connectors/api/panorama_connectors_api.py src/thousandeyes_sdk/connectors/api/webhook_operations_api.py src/thousandeyes_sdk/connectors/models/__init__.py src/thousandeyes_sdk/connectors/models/assignments.py @@ -68,6 +75,11 @@ src/thousandeyes_sdk/connectors/models/operation_category.py src/thousandeyes_sdk/connectors/models/operation_status.py src/thousandeyes_sdk/connectors/models/operation_type.py src/thousandeyes_sdk/connectors/models/other_token_authentication.py +src/thousandeyes_sdk/connectors/models/panorama_connector.py +src/thousandeyes_sdk/connectors/models/panorama_connector_auth.py +src/thousandeyes_sdk/connectors/models/panorama_connectors.py +src/thousandeyes_sdk/connectors/models/panorama_key_gen_authentication.py +src/thousandeyes_sdk/connectors/models/panorama_token_authentication.py src/thousandeyes_sdk/connectors/models/self_links.py src/thousandeyes_sdk/connectors/models/unauthorized_error.py src/thousandeyes_sdk/connectors/models/validation_error.py @@ -76,9 +88,19 @@ src/thousandeyes_sdk/connectors/models/webhook_operation.py src/thousandeyes_sdk/connectors/models/webhook_operations.py src/thousandeyes_sdk/connectors/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_credential_vault_operations_api.py +test/test_credential_vault_operations_api_integration.py test/test_cyber_ark_conjur_connectors_api.py +test/test_cyber_ark_conjur_connectors_api_integration.py test/test_generic_connectors_api.py +test/test_generic_connectors_api_integration.py test/test_operation_connectors_api.py +test/test_operation_connectors_api_integration.py +test/test_panorama_connectors_api.py +test/test_panorama_connectors_api_integration.py test/test_utils.py test/test_webhook_operations_api.py +test/test_webhook_operations_api_integration.py diff --git a/thousandeyes-sdk-connectors/README.md b/thousandeyes-sdk-connectors/README.md index cdb5c54fa..8d9929cb8 100644 --- a/thousandeyes-sdk-connectors/README.md +++ b/thousandeyes-sdk-connectors/README.md @@ -6,7 +6,7 @@ Manage connectors and operations. This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -79,7 +79,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.connectors.CredentialVaultOperationsApi(api_client) - credential_vault_operation = thousandeyes_sdk.connectors.CredentialVaultOperation() # CredentialVaultOperation | + credential_vault_operation = # CredentialVaultOperation | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -119,6 +119,13 @@ Class | Method | HTTP request | Description *GenericConnectorsApi* | [**update_generic_connector**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/GenericConnectorsApi.md#update_generic_connector) | **PUT** /connectors/generic/{id} | Update connector *OperationConnectorsApi* | [**get_operation_connectors**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/OperationConnectorsApi.md#get_operation_connectors) | **GET** /operations/{type}/{id}/connectors | Retrieve connectors assigned to an operation *OperationConnectorsApi* | [**set_operation_connectors**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/OperationConnectorsApi.md#set_operation_connectors) | **PUT** /operations/{type}/{id}/connectors | Assign connectors to an operation +*PanoramaConnectorsApi* | [**create_panorama_connector**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#create_panorama_connector) | **POST** /connectors/panorama | Create Panorama connector +*PanoramaConnectorsApi* | [**delete_panorama_connector**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#delete_panorama_connector) | **DELETE** /connectors/panorama/{id} | Delete Panorama connector +*PanoramaConnectorsApi* | [**get_panorama_connector**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#get_panorama_connector) | **GET** /connectors/panorama/{id} | Retrieve Panorama connector +*PanoramaConnectorsApi* | [**get_panorama_connector_operations**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#get_panorama_connector_operations) | **GET** /connectors/panorama/{id}/operations | List operation IDs for Panorama connector +*PanoramaConnectorsApi* | [**get_panorama_connectors**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#get_panorama_connectors) | **GET** /connectors/panorama | List Panorama connectors +*PanoramaConnectorsApi* | [**set_panorama_connector_operations**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#set_panorama_connector_operations) | **PUT** /connectors/panorama/{id}/operations | Assign operations to Panorama connector +*PanoramaConnectorsApi* | [**update_panorama_connector**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#update_panorama_connector) | **PUT** /connectors/panorama/{id} | Update Panorama connector *WebhookOperationsApi* | [**create_webhook_operation**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/WebhookOperationsApi.md#create_webhook_operation) | **POST** /operations/webhooks | Create webhook operation *WebhookOperationsApi* | [**delete_webhook_operation**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/WebhookOperationsApi.md#delete_webhook_operation) | **DELETE** /operations/webhooks/{id} | Delete webhook operation *WebhookOperationsApi* | [**get_webhook_operation**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/WebhookOperationsApi.md#get_webhook_operation) | **GET** /operations/webhooks/{id} | Retrieve webhook operation @@ -151,6 +158,11 @@ Class | Method | HTTP request | Description - [OperationStatus](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/OperationStatus.md) - [OperationType](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/OperationType.md) - [OtherTokenAuthentication](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/OtherTokenAuthentication.md) + - [PanoramaConnector](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnector.md) + - [PanoramaConnectorAuth](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorAuth.md) + - [PanoramaConnectors](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectors.md) + - [PanoramaKeyGenAuthentication](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaKeyGenAuthentication.md) + - [PanoramaTokenAuthentication](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaTokenAuthentication.md) - [SelfLinks](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/SelfLinks.md) - [UnauthorizedError](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/UnauthorizedError.md) - [ValidationError](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/ValidationError.md) diff --git a/thousandeyes-sdk-connectors/docs/CredentialVaultOperationsApi.md b/thousandeyes-sdk-connectors/docs/CredentialVaultOperationsApi.md index 23d3c176d..e1340717d 100644 --- a/thousandeyes-sdk-connectors/docs/CredentialVaultOperationsApi.md +++ b/thousandeyes-sdk-connectors/docs/CredentialVaultOperationsApi.md @@ -48,7 +48,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.connectors.CredentialVaultOperationsApi(api_client) - credential_vault_operation = thousandeyes_sdk.connectors.CredentialVaultOperation() # CredentialVaultOperation | + credential_vault_operation = # CredentialVaultOperation | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -386,7 +386,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.connectors.CredentialVaultOperationsApi(api_client) id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The operation ID. - credential_vault_operation = thousandeyes_sdk.connectors.CredentialVaultOperation() # CredentialVaultOperation | + credential_vault_operation = # CredentialVaultOperation | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-connectors/docs/CyberArkConjurConnectorsApi.md b/thousandeyes-sdk-connectors/docs/CyberArkConjurConnectorsApi.md index 73947579a..8b1b168a5 100644 --- a/thousandeyes-sdk-connectors/docs/CyberArkConjurConnectorsApi.md +++ b/thousandeyes-sdk-connectors/docs/CyberArkConjurConnectorsApi.md @@ -50,7 +50,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.connectors.CyberArkConjurConnectorsApi(api_client) - conjur_connector = thousandeyes_sdk.connectors.ConjurConnector() # ConjurConnector | + conjur_connector = # ConjurConnector | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -562,7 +562,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.connectors.CyberArkConjurConnectorsApi(api_client) id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID. - conjur_connector = thousandeyes_sdk.connectors.ConjurConnector() # ConjurConnector | + conjur_connector = # ConjurConnector | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-connectors/docs/GenericConnectorsApi.md b/thousandeyes-sdk-connectors/docs/GenericConnectorsApi.md index b94234f95..e66269c3c 100644 --- a/thousandeyes-sdk-connectors/docs/GenericConnectorsApi.md +++ b/thousandeyes-sdk-connectors/docs/GenericConnectorsApi.md @@ -50,7 +50,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.connectors.GenericConnectorsApi(api_client) - generic_connector = thousandeyes_sdk.connectors.GenericConnector() # GenericConnector | + generic_connector = # GenericConnector | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -558,7 +558,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.connectors.GenericConnectorsApi(api_client) id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID. - generic_connector = thousandeyes_sdk.connectors.GenericConnector() # GenericConnector | + generic_connector = # GenericConnector | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-connectors/docs/PanoramaConnector.md b/thousandeyes-sdk-connectors/docs/PanoramaConnector.md new file mode 100644 index 000000000..71f781944 --- /dev/null +++ b/thousandeyes-sdk-connectors/docs/PanoramaConnector.md @@ -0,0 +1,36 @@ +# PanoramaConnector + +Palo Alto Networks Panorama connector configuration. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | Unique ID of the Panorama connector. | [optional] [readonly] +**type** | **str** | Connector type. | +**name** | **str** | Name of the Panorama connector. | +**target** | **str** | URL of the Panorama instance. | +**last_modified_date** | **int** | Time when the connector was last modified, in milliseconds since the Unix epoch. | [optional] [readonly] +**authentication** | [**PanoramaConnectorAuth**](PanoramaConnectorAuth.md) | | +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector + +# TODO update the JSON string below +json = "{}" +# create an instance of PanoramaConnector from a JSON string +panorama_connector_instance = PanoramaConnector.from_json(json) +# print the JSON string representation of the object +print(PanoramaConnector.to_json()) + +# convert the object into a dict +panorama_connector_dict = panorama_connector_instance.to_dict() +# create an instance of PanoramaConnector from a dict +panorama_connector_from_dict = PanoramaConnector.from_dict(panorama_connector_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-connectors/docs/PanoramaConnectorAuth.md b/thousandeyes-sdk-connectors/docs/PanoramaConnectorAuth.md new file mode 100644 index 000000000..bcc92801a --- /dev/null +++ b/thousandeyes-sdk-connectors/docs/PanoramaConnectorAuth.md @@ -0,0 +1,34 @@ +# PanoramaConnectorAuth + +Authentication configuration for the Panorama connector. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**token** | **str** | Panorama API key used for authentication. | +**type** | **str** | Authentication type. | +**username** | **str** | Username used to generate the Panorama API key. | +**password** | **str** | Password used to generate the Panorama API key. | +**key_ttl** | **int** | Time to live for the generated Panorama API key, in minutes. | + +## Example + +```python +from thousandeyes_sdk.connectors.models.panorama_connector_auth import PanoramaConnectorAuth + +# TODO update the JSON string below +json = "{}" +# create an instance of PanoramaConnectorAuth from a JSON string +panorama_connector_auth_instance = PanoramaConnectorAuth.from_json(json) +# print the JSON string representation of the object +print(PanoramaConnectorAuth.to_json()) + +# convert the object into a dict +panorama_connector_auth_dict = panorama_connector_auth_instance.to_dict() +# create an instance of PanoramaConnectorAuth from a dict +panorama_connector_auth_from_dict = PanoramaConnectorAuth.from_dict(panorama_connector_auth_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-connectors/docs/PanoramaConnectors.md b/thousandeyes-sdk-connectors/docs/PanoramaConnectors.md new file mode 100644 index 000000000..2105e440e --- /dev/null +++ b/thousandeyes-sdk-connectors/docs/PanoramaConnectors.md @@ -0,0 +1,31 @@ +# PanoramaConnectors + +Collection of Panorama connectors. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**items** | [**List[PanoramaConnector]**](PanoramaConnector.md) | | [optional] +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.connectors.models.panorama_connectors import PanoramaConnectors + +# TODO update the JSON string below +json = "{}" +# create an instance of PanoramaConnectors from a JSON string +panorama_connectors_instance = PanoramaConnectors.from_json(json) +# print the JSON string representation of the object +print(PanoramaConnectors.to_json()) + +# convert the object into a dict +panorama_connectors_dict = panorama_connectors_instance.to_dict() +# create an instance of PanoramaConnectors from a dict +panorama_connectors_from_dict = PanoramaConnectors.from_dict(panorama_connectors_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md b/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md new file mode 100644 index 000000000..1c5ee0ed5 --- /dev/null +++ b/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md @@ -0,0 +1,609 @@ +# thousandeyes_sdk.connectors.PanoramaConnectorsApi + +All URIs are relative to *https://api.thousandeyes.com/v7* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_panorama_connector**](PanoramaConnectorsApi.md#create_panorama_connector) | **POST** /connectors/panorama | Create Panorama connector +[**delete_panorama_connector**](PanoramaConnectorsApi.md#delete_panorama_connector) | **DELETE** /connectors/panorama/{id} | Delete Panorama connector +[**get_panorama_connector**](PanoramaConnectorsApi.md#get_panorama_connector) | **GET** /connectors/panorama/{id} | Retrieve Panorama connector +[**get_panorama_connector_operations**](PanoramaConnectorsApi.md#get_panorama_connector_operations) | **GET** /connectors/panorama/{id}/operations | List operation IDs for Panorama connector +[**get_panorama_connectors**](PanoramaConnectorsApi.md#get_panorama_connectors) | **GET** /connectors/panorama | List Panorama connectors +[**set_panorama_connector_operations**](PanoramaConnectorsApi.md#set_panorama_connector_operations) | **PUT** /connectors/panorama/{id}/operations | Assign operations to Panorama connector +[**update_panorama_connector**](PanoramaConnectorsApi.md#update_panorama_connector) | **PUT** /connectors/panorama/{id} | Update Panorama connector + + +# **create_panorama_connector** +> PanoramaConnector create_panorama_connector(panorama_connector, aid=aid) + +Create Panorama connector + +Creates a new Panorama connector. + +### Example + +* Bearer Authentication (BearerAuth): + +```python +import thousandeyes_sdk.connectors +from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector +from thousandeyes_sdk.connectors.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.thousandeyes.com/v7 +# See configuration.py for a list of all supported configuration parameters. +configuration = thousandeyes_sdk.core.Configuration( + host = "https://api.thousandeyes.com/v7" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = thousandeyes_sdk.core.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with thousandeyes_sdk.core.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client) + panorama_connector = {"type":"panorama","name":"Branch Panorama","target":"https://panorama.example.com","authentication":{"username":"panorama-user","password":"","keyTtl":40,"type":"pan-key-gen"}} # PanoramaConnector | Panorama connector configuration. + aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) + + try: + # Create Panorama connector + api_response = api_instance.create_panorama_connector(panorama_connector, aid=aid) + print("The response of PanoramaConnectorsApi->create_panorama_connector:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PanoramaConnectorsApi->create_panorama_connector: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **panorama_connector** | [**PanoramaConnector**](PanoramaConnector.md)| Panorama connector configuration. | + **aid** | **str**| A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. | [optional] + +### Return type + +[**PanoramaConnector**](PanoramaConnector.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/hal+json, application/json, application/problem+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | The created Panorama connector. | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Insufficient permissions to query endpoint | - | +**404** | Not found | - | +**500** | Internal server error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_panorama_connector** +> delete_panorama_connector(id, aid=aid) + +Delete Panorama connector + +Deletes the Panorama connector specified by ID. + +### Example + +* Bearer Authentication (BearerAuth): + +```python +import thousandeyes_sdk.connectors +from thousandeyes_sdk.connectors.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.thousandeyes.com/v7 +# See configuration.py for a list of all supported configuration parameters. +configuration = thousandeyes_sdk.core.Configuration( + host = "https://api.thousandeyes.com/v7" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = thousandeyes_sdk.core.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with thousandeyes_sdk.core.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client) + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID. + aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) + + try: + # Delete Panorama connector + api_instance.delete_panorama_connector(id, aid=aid) + except Exception as e: + print("Exception when calling PanoramaConnectorsApi->delete_panorama_connector: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **str**| The connector ID. | + **aid** | **str**| A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/problem+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**204** | No Content. | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Insufficient permissions to query endpoint | - | +**404** | Not found | - | +**500** | Internal server error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_panorama_connector** +> PanoramaConnector get_panorama_connector(id, aid=aid) + +Retrieve Panorama connector + +Retrieves details of a Panorama connector by its ID. + +### Example + +* Bearer Authentication (BearerAuth): + +```python +import thousandeyes_sdk.connectors +from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector +from thousandeyes_sdk.connectors.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.thousandeyes.com/v7 +# See configuration.py for a list of all supported configuration parameters. +configuration = thousandeyes_sdk.core.Configuration( + host = "https://api.thousandeyes.com/v7" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = thousandeyes_sdk.core.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with thousandeyes_sdk.core.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client) + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID. + aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) + + try: + # Retrieve Panorama connector + api_response = api_instance.get_panorama_connector(id, aid=aid) + print("The response of PanoramaConnectorsApi->get_panorama_connector:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PanoramaConnectorsApi->get_panorama_connector: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **str**| The connector ID. | + **aid** | **str**| A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. | [optional] + +### Return type + +[**PanoramaConnector**](PanoramaConnector.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/hal+json, application/json, application/problem+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Panorama connector details. | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Insufficient permissions to query endpoint | - | +**404** | Not found | - | +**500** | Internal server error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_panorama_connector_operations** +> Assignments get_panorama_connector_operations(id, aid=aid) + +List operation IDs for Panorama connector + +Returns a list of operation IDs assigned to a Panorama connector. + +### Example + +* Bearer Authentication (BearerAuth): + +```python +import thousandeyes_sdk.connectors +from thousandeyes_sdk.connectors.models.assignments import Assignments +from thousandeyes_sdk.connectors.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.thousandeyes.com/v7 +# See configuration.py for a list of all supported configuration parameters. +configuration = thousandeyes_sdk.core.Configuration( + host = "https://api.thousandeyes.com/v7" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = thousandeyes_sdk.core.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with thousandeyes_sdk.core.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client) + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID. + aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) + + try: + # List operation IDs for Panorama connector + api_response = api_instance.get_panorama_connector_operations(id, aid=aid) + print("The response of PanoramaConnectorsApi->get_panorama_connector_operations:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PanoramaConnectorsApi->get_panorama_connector_operations: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **str**| The connector ID. | + **aid** | **str**| A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. | [optional] + +### Return type + +[**Assignments**](Assignments.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/hal+json, application/json, application/problem+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Operation IDs assigned to the Panorama connector. | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Insufficient permissions to query endpoint | - | +**404** | Not found | - | +**500** | Internal server error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_panorama_connectors** +> PanoramaConnectors get_panorama_connectors(aid=aid) + +List Panorama connectors + +Returns a list of Panorama connectors in the specified account group. If no account group is specified, the user’s default account group is used. + +### Example + +* Bearer Authentication (BearerAuth): + +```python +import thousandeyes_sdk.connectors +from thousandeyes_sdk.connectors.models.panorama_connectors import PanoramaConnectors +from thousandeyes_sdk.connectors.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.thousandeyes.com/v7 +# See configuration.py for a list of all supported configuration parameters. +configuration = thousandeyes_sdk.core.Configuration( + host = "https://api.thousandeyes.com/v7" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = thousandeyes_sdk.core.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with thousandeyes_sdk.core.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client) + aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) + + try: + # List Panorama connectors + api_response = api_instance.get_panorama_connectors(aid=aid) + print("The response of PanoramaConnectorsApi->get_panorama_connectors:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PanoramaConnectorsApi->get_panorama_connectors: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **aid** | **str**| A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. | [optional] + +### Return type + +[**PanoramaConnectors**](PanoramaConnectors.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/hal+json, application/json, application/problem+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A list of Panorama connectors. | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Insufficient permissions to query endpoint | - | +**404** | Not found | - | +**500** | Internal server error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **set_panorama_connector_operations** +> Assignments set_panorama_connector_operations(id, request_body, aid=aid) + +Assign operations to Panorama connector + +Assigns operations to a Panorama connector. This replaces any existing assignments. Passing an empty array removes all operation assignments from the connector. + +### Example + +* Bearer Authentication (BearerAuth): + +```python +import thousandeyes_sdk.connectors +from thousandeyes_sdk.connectors.models.assignments import Assignments +from thousandeyes_sdk.connectors.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.thousandeyes.com/v7 +# See configuration.py for a list of all supported configuration parameters. +configuration = thousandeyes_sdk.core.Configuration( + host = "https://api.thousandeyes.com/v7" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = thousandeyes_sdk.core.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with thousandeyes_sdk.core.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client) + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID. + request_body = ["ca39314d-eb4f-496f-9435-b5d20b1bfbff","a32cfbab-32f6-41d8-9027-7127cba965dd"] # List[str] | List of operation IDs to assign to the connector. + aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) + + try: + # Assign operations to Panorama connector + api_response = api_instance.set_panorama_connector_operations(id, request_body, aid=aid) + print("The response of PanoramaConnectorsApi->set_panorama_connector_operations:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PanoramaConnectorsApi->set_panorama_connector_operations: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **str**| The connector ID. | + **request_body** | [**List[str]**](str.md)| List of operation IDs to assign to the connector. | + **aid** | **str**| A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. | [optional] + +### Return type + +[**Assignments**](Assignments.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/hal+json, application/json, application/problem+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Operations assigned successfully. | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Insufficient permissions to query endpoint | - | +**404** | Not found | - | +**500** | Internal server error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_panorama_connector** +> PanoramaConnector update_panorama_connector(id, panorama_connector, aid=aid) + +Update Panorama connector + +Replaces the Panorama connector specified by ID. The request must include the complete connector configuration, including authentication credentials; existing credentials are not retained when authentication is omitted. + +### Example + +* Bearer Authentication (BearerAuth): + +```python +import thousandeyes_sdk.connectors +from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector +from thousandeyes_sdk.connectors.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.thousandeyes.com/v7 +# See configuration.py for a list of all supported configuration parameters. +configuration = thousandeyes_sdk.core.Configuration( + host = "https://api.thousandeyes.com/v7" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = thousandeyes_sdk.core.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with thousandeyes_sdk.core.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client) + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID. + panorama_connector = {"type":"panorama","name":"Branch Panorama","target":"https://panorama.example.com","authentication":{"username":"panorama-user","password":"","keyTtl":40,"type":"pan-key-gen"}} # PanoramaConnector | + aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) + + try: + # Update Panorama connector + api_response = api_instance.update_panorama_connector(id, panorama_connector, aid=aid) + print("The response of PanoramaConnectorsApi->update_panorama_connector:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PanoramaConnectorsApi->update_panorama_connector: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **str**| The connector ID. | + **panorama_connector** | [**PanoramaConnector**](PanoramaConnector.md)| | + **aid** | **str**| A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. | [optional] + +### Return type + +[**PanoramaConnector**](PanoramaConnector.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/hal+json, application/json, application/problem+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The updated Panorama connector. | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Insufficient permissions to query endpoint | - | +**404** | Not found | - | +**500** | Internal server error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/thousandeyes-sdk-connectors/docs/PanoramaKeyGenAuthentication.md b/thousandeyes-sdk-connectors/docs/PanoramaKeyGenAuthentication.md new file mode 100644 index 000000000..ac5a8b798 --- /dev/null +++ b/thousandeyes-sdk-connectors/docs/PanoramaKeyGenAuthentication.md @@ -0,0 +1,33 @@ +# PanoramaKeyGenAuthentication + +Authentication using credentials to generate a Panorama API key. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **str** | Username used to generate the Panorama API key. | +**password** | **str** | Password used to generate the Panorama API key. | +**key_ttl** | **int** | Time to live for the generated Panorama API key, in minutes. | +**type** | **str** | | + +## Example + +```python +from thousandeyes_sdk.connectors.models.panorama_key_gen_authentication import PanoramaKeyGenAuthentication + +# TODO update the JSON string below +json = "{}" +# create an instance of PanoramaKeyGenAuthentication from a JSON string +panorama_key_gen_authentication_instance = PanoramaKeyGenAuthentication.from_json(json) +# print the JSON string representation of the object +print(PanoramaKeyGenAuthentication.to_json()) + +# convert the object into a dict +panorama_key_gen_authentication_dict = panorama_key_gen_authentication_instance.to_dict() +# create an instance of PanoramaKeyGenAuthentication from a dict +panorama_key_gen_authentication_from_dict = PanoramaKeyGenAuthentication.from_dict(panorama_key_gen_authentication_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-connectors/docs/PanoramaTokenAuthentication.md b/thousandeyes-sdk-connectors/docs/PanoramaTokenAuthentication.md new file mode 100644 index 000000000..0f79279db --- /dev/null +++ b/thousandeyes-sdk-connectors/docs/PanoramaTokenAuthentication.md @@ -0,0 +1,31 @@ +# PanoramaTokenAuthentication + +Authentication using an existing Panorama API key. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**token** | **str** | Panorama API key used for authentication. | +**type** | **str** | Authentication type. | + +## Example + +```python +from thousandeyes_sdk.connectors.models.panorama_token_authentication import PanoramaTokenAuthentication + +# TODO update the JSON string below +json = "{}" +# create an instance of PanoramaTokenAuthentication from a JSON string +panorama_token_authentication_instance = PanoramaTokenAuthentication.from_json(json) +# print the JSON string representation of the object +print(PanoramaTokenAuthentication.to_json()) + +# convert the object into a dict +panorama_token_authentication_dict = panorama_token_authentication_instance.to_dict() +# create an instance of PanoramaTokenAuthentication from a dict +panorama_token_authentication_from_dict = PanoramaTokenAuthentication.from_dict(panorama_token_authentication_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-connectors/docs/WebhookOperationsApi.md b/thousandeyes-sdk-connectors/docs/WebhookOperationsApi.md index c5c151e2f..033f7ec2b 100644 --- a/thousandeyes-sdk-connectors/docs/WebhookOperationsApi.md +++ b/thousandeyes-sdk-connectors/docs/WebhookOperationsApi.md @@ -48,7 +48,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.connectors.WebhookOperationsApi(api_client) - webhook_operation = thousandeyes_sdk.connectors.WebhookOperation() # WebhookOperation | + webhook_operation = # WebhookOperation | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -384,7 +384,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.connectors.WebhookOperationsApi(api_client) id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The operation ID. - webhook_operation = thousandeyes_sdk.connectors.WebhookOperation() # WebhookOperation | + webhook_operation = # WebhookOperation | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/__init__.py b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/__init__.py index aaecf7e9c..355cf9c02 100644 --- a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/__init__.py +++ b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/__init__.py @@ -18,6 +18,7 @@ from thousandeyes_sdk.connectors.api.cyber_ark_conjur_connectors_api import CyberArkConjurConnectorsApi from thousandeyes_sdk.connectors.api.generic_connectors_api import GenericConnectorsApi from thousandeyes_sdk.connectors.api.operation_connectors_api import OperationConnectorsApi +from thousandeyes_sdk.connectors.api.panorama_connectors_api import PanoramaConnectorsApi from thousandeyes_sdk.connectors.api.webhook_operations_api import WebhookOperationsApi @@ -45,6 +46,11 @@ from thousandeyes_sdk.connectors.models.operation_status import OperationStatus from thousandeyes_sdk.connectors.models.operation_type import OperationType from thousandeyes_sdk.connectors.models.other_token_authentication import OtherTokenAuthentication +from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector +from thousandeyes_sdk.connectors.models.panorama_connector_auth import PanoramaConnectorAuth +from thousandeyes_sdk.connectors.models.panorama_connectors import PanoramaConnectors +from thousandeyes_sdk.connectors.models.panorama_key_gen_authentication import PanoramaKeyGenAuthentication +from thousandeyes_sdk.connectors.models.panorama_token_authentication import PanoramaTokenAuthentication from thousandeyes_sdk.connectors.models.self_links import SelfLinks from thousandeyes_sdk.connectors.models.unauthorized_error import UnauthorizedError from thousandeyes_sdk.connectors.models.validation_error import ValidationError diff --git a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/api/__init__.py b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/api/__init__.py index 56f864ae1..4d57db733 100644 --- a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/api/__init__.py +++ b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/api/__init__.py @@ -5,5 +5,6 @@ from thousandeyes_sdk.connectors.api.cyber_ark_conjur_connectors_api import CyberArkConjurConnectorsApi from thousandeyes_sdk.connectors.api.generic_connectors_api import GenericConnectorsApi from thousandeyes_sdk.connectors.api.operation_connectors_api import OperationConnectorsApi +from thousandeyes_sdk.connectors.api.panorama_connectors_api import PanoramaConnectorsApi from thousandeyes_sdk.connectors.api.webhook_operations_api import WebhookOperationsApi diff --git a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/api/panorama_connectors_api.py b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/api/panorama_connectors_api.py new file mode 100644 index 000000000..9371e12e2 --- /dev/null +++ b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/api/panorama_connectors_api.py @@ -0,0 +1,2157 @@ +# 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 warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated +from importlib.metadata import version + +import thousandeyes_sdk.connectors.models + +from pydantic import Field, StrictStr +from typing import List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.connectors.models.assignments import Assignments +from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector +from thousandeyes_sdk.connectors.models.panorama_connectors import PanoramaConnectors + +from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized +from thousandeyes_sdk.core.api_response import ApiResponse + +from thousandeyes_sdk.core.rest import RESTResponseType + + +class PanoramaConnectorsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-connectors")) + self.api_client = api_client + + + @validate_call + def create_panorama_connector( + self, + panorama_connector: Annotated[PanoramaConnector, Field(description="Panorama connector configuration.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PanoramaConnector: + """Create Panorama connector + + Creates a new Panorama connector. + + :param panorama_connector: Panorama connector configuration. (required) + :type panorama_connector: PanoramaConnector + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_panorama_connector_serialize( + panorama_connector=panorama_connector, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PanoramaConnector", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ).data + + + @validate_call + def create_panorama_connector_with_http_info( + self, + panorama_connector: Annotated[PanoramaConnector, Field(description="Panorama connector configuration.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PanoramaConnector]: + """Create Panorama connector + + Creates a new Panorama connector. + + :param panorama_connector: Panorama connector configuration. (required) + :type panorama_connector: PanoramaConnector + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_panorama_connector_serialize( + panorama_connector=panorama_connector, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PanoramaConnector", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ) + + + @validate_call + def create_panorama_connector_without_preload_content( + self, + panorama_connector: Annotated[PanoramaConnector, Field(description="Panorama connector configuration.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create Panorama connector + + Creates a new Panorama connector. + + :param panorama_connector: Panorama connector configuration. (required) + :type panorama_connector: PanoramaConnector + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_panorama_connector_serialize( + panorama_connector=panorama_connector, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "PanoramaConnector", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_panorama_connector_serialize( + self, + panorama_connector, + aid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if aid is not None: + + _query_params.append(('aid', aid)) + + # process the header parameters + # process the form parameters + # process the body parameter + if panorama_connector is not None: + _body_params = panorama_connector + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/hal+json', + 'application/json', + 'application/problem+json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/connectors/panorama', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def delete_panorama_connector( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Panorama connector + + Deletes the Panorama connector specified by ID. + + :param id: The connector ID. (required) + :type id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_panorama_connector_serialize( + id=id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ).data + + + @validate_call + def delete_panorama_connector_with_http_info( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Panorama connector + + Deletes the Panorama connector specified by ID. + + :param id: The connector ID. (required) + :type id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_panorama_connector_serialize( + id=id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ) + + + @validate_call + def delete_panorama_connector_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Panorama connector + + Deletes the Panorama connector specified by ID. + + :param id: The connector ID. (required) + :type id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_panorama_connector_serialize( + id=id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '204': None, + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_panorama_connector_serialize( + self, + id, + aid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if aid is not None: + + _query_params.append(('aid', aid)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json', + 'application/problem+json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/connectors/panorama/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_panorama_connector( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PanoramaConnector: + """Retrieve Panorama connector + + Retrieves details of a Panorama connector by its ID. + + :param id: The connector ID. (required) + :type id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_panorama_connector_serialize( + id=id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PanoramaConnector", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ).data + + + @validate_call + def get_panorama_connector_with_http_info( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PanoramaConnector]: + """Retrieve Panorama connector + + Retrieves details of a Panorama connector by its ID. + + :param id: The connector ID. (required) + :type id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_panorama_connector_serialize( + id=id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PanoramaConnector", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ) + + + @validate_call + def get_panorama_connector_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Retrieve Panorama connector + + Retrieves details of a Panorama connector by its ID. + + :param id: The connector ID. (required) + :type id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_panorama_connector_serialize( + id=id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PanoramaConnector", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_panorama_connector_serialize( + self, + id, + aid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if aid is not None: + + _query_params.append(('aid', aid)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/hal+json', + 'application/json', + 'application/problem+json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/connectors/panorama/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_panorama_connector_operations( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Assignments: + """List operation IDs for Panorama connector + + Returns a list of operation IDs assigned to a Panorama connector. + + :param id: The connector ID. (required) + :type id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_panorama_connector_operations_serialize( + id=id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignments", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ).data + + + @validate_call + def get_panorama_connector_operations_with_http_info( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Assignments]: + """List operation IDs for Panorama connector + + Returns a list of operation IDs assigned to a Panorama connector. + + :param id: The connector ID. (required) + :type id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_panorama_connector_operations_serialize( + id=id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignments", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ) + + + @validate_call + def get_panorama_connector_operations_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List operation IDs for Panorama connector + + Returns a list of operation IDs assigned to a Panorama connector. + + :param id: The connector ID. (required) + :type id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_panorama_connector_operations_serialize( + id=id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignments", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_panorama_connector_operations_serialize( + self, + id, + aid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if aid is not None: + + _query_params.append(('aid', aid)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/hal+json', + 'application/json', + 'application/problem+json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/connectors/panorama/{id}/operations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_panorama_connectors( + self, + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PanoramaConnectors: + """List Panorama connectors + + Returns a list of Panorama connectors in the specified account group. If no account group is specified, the user’s default account group is used. + + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_panorama_connectors_serialize( + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PanoramaConnectors", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ).data + + + @validate_call + def get_panorama_connectors_with_http_info( + self, + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PanoramaConnectors]: + """List Panorama connectors + + Returns a list of Panorama connectors in the specified account group. If no account group is specified, the user’s default account group is used. + + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_panorama_connectors_serialize( + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PanoramaConnectors", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ) + + + @validate_call + def get_panorama_connectors_without_preload_content( + self, + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List Panorama connectors + + Returns a list of Panorama connectors in the specified account group. If no account group is specified, the user’s default account group is used. + + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_panorama_connectors_serialize( + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PanoramaConnectors", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_panorama_connectors_serialize( + self, + aid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if aid is not None: + + _query_params.append(('aid', aid)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/hal+json', + 'application/json', + 'application/problem+json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/connectors/panorama', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def set_panorama_connector_operations( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + request_body: Annotated[List[StrictStr], Field(description="List of operation IDs to assign to the connector.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Assignments: + """Assign operations to Panorama connector + + Assigns operations to a Panorama connector. This replaces any existing assignments. Passing an empty array removes all operation assignments from the connector. + + :param id: The connector ID. (required) + :type id: str + :param request_body: List of operation IDs to assign to the connector. (required) + :type request_body: List[str] + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_panorama_connector_operations_serialize( + id=id, + request_body=request_body, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignments", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ).data + + + @validate_call + def set_panorama_connector_operations_with_http_info( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + request_body: Annotated[List[StrictStr], Field(description="List of operation IDs to assign to the connector.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Assignments]: + """Assign operations to Panorama connector + + Assigns operations to a Panorama connector. This replaces any existing assignments. Passing an empty array removes all operation assignments from the connector. + + :param id: The connector ID. (required) + :type id: str + :param request_body: List of operation IDs to assign to the connector. (required) + :type request_body: List[str] + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_panorama_connector_operations_serialize( + id=id, + request_body=request_body, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignments", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ) + + + @validate_call + def set_panorama_connector_operations_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + request_body: Annotated[List[StrictStr], Field(description="List of operation IDs to assign to the connector.")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Assign operations to Panorama connector + + Assigns operations to a Panorama connector. This replaces any existing assignments. Passing an empty array removes all operation assignments from the connector. + + :param id: The connector ID. (required) + :type id: str + :param request_body: List of operation IDs to assign to the connector. (required) + :type request_body: List[str] + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._set_panorama_connector_operations_serialize( + id=id, + request_body=request_body, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Assignments", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _set_panorama_connector_operations_serialize( + self, + id, + request_body, + aid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'request_body': '', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if aid is not None: + + _query_params.append(('aid', aid)) + + # process the header parameters + # process the form parameters + # process the body parameter + if request_body is not None: + _body_params = request_body + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/hal+json', + 'application/json', + 'application/problem+json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/connectors/panorama/{id}/operations', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def update_panorama_connector( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + panorama_connector: PanoramaConnector, + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PanoramaConnector: + """Update Panorama connector + + Replaces the Panorama connector specified by ID. The request must include the complete connector configuration, including authentication credentials; existing credentials are not retained when authentication is omitted. + + :param id: The connector ID. (required) + :type id: str + :param panorama_connector: (required) + :type panorama_connector: PanoramaConnector + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_panorama_connector_serialize( + id=id, + panorama_connector=panorama_connector, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PanoramaConnector", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ).data + + + @validate_call + def update_panorama_connector_with_http_info( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + panorama_connector: PanoramaConnector, + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PanoramaConnector]: + """Update Panorama connector + + Replaces the Panorama connector specified by ID. The request must include the complete connector configuration, including authentication credentials; existing credentials are not retained when authentication is omitted. + + :param id: The connector ID. (required) + :type id: str + :param panorama_connector: (required) + :type panorama_connector: PanoramaConnector + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_panorama_connector_serialize( + id=id, + panorama_connector=panorama_connector, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PanoramaConnector", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.connectors.models, + ) + + + @validate_call + def update_panorama_connector_without_preload_content( + self, + id: Annotated[StrictStr, Field(description="The connector ID.")], + panorama_connector: PanoramaConnector, + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update Panorama connector + + Replaces the Panorama connector specified by ID. The request must include the complete connector configuration, including authentication credentials; existing credentials are not retained when authentication is omitted. + + :param id: The connector ID. (required) + :type id: str + :param panorama_connector: (required) + :type panorama_connector: PanoramaConnector + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._update_panorama_connector_serialize( + id=id, + panorama_connector=panorama_connector, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PanoramaConnector", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _update_panorama_connector_serialize( + self, + id, + panorama_connector, + aid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if id is not None: + _path_params['id'] = id + # process the query parameters + if aid is not None: + + _query_params.append(('aid', aid)) + + # process the header parameters + # process the form parameters + # process the body parameter + if panorama_connector is not None: + _body_params = panorama_connector + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/hal+json', + 'application/json', + 'application/problem+json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/json' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='PUT', + resource_path='/connectors/panorama/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/__init__.py b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/__init__.py index 1120f9656..f609d5614 100644 --- a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/__init__.py +++ b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/__init__.py @@ -36,6 +36,11 @@ from thousandeyes_sdk.connectors.models.operation_status import OperationStatus from thousandeyes_sdk.connectors.models.operation_type import OperationType from thousandeyes_sdk.connectors.models.other_token_authentication import OtherTokenAuthentication +from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector +from thousandeyes_sdk.connectors.models.panorama_connector_auth import PanoramaConnectorAuth +from thousandeyes_sdk.connectors.models.panorama_connectors import PanoramaConnectors +from thousandeyes_sdk.connectors.models.panorama_key_gen_authentication import PanoramaKeyGenAuthentication +from thousandeyes_sdk.connectors.models.panorama_token_authentication import PanoramaTokenAuthentication from thousandeyes_sdk.connectors.models.self_links import SelfLinks from thousandeyes_sdk.connectors.models.unauthorized_error import UnauthorizedError from thousandeyes_sdk.connectors.models.validation_error import ValidationError diff --git a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connector.py b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connector.py new file mode 100644 index 000000000..9bebfd398 --- /dev/null +++ b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connector.py @@ -0,0 +1,118 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from thousandeyes_sdk.connectors.models.panorama_connector_auth import PanoramaConnectorAuth +from thousandeyes_sdk.connectors.models.self_links import SelfLinks +from typing import Optional, Set +from typing_extensions import Self + +class PanoramaConnector(BaseModel): + """ + Palo Alto Networks Panorama connector configuration. + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="Unique ID of the Panorama connector.") + type: StrictStr = Field(description="Connector type.") + name: StrictStr = Field(description="Name of the Panorama connector.") + target: StrictStr = Field(description="URL of the Panorama instance.") + last_modified_date: Optional[StrictInt] = Field(default=None, description="Time when the connector was last modified, in milliseconds since the Unix epoch.", alias="lastModifiedDate") + authentication: PanoramaConnectorAuth + links: Optional[SelfLinks] = Field(default=None, alias="_links") + __properties: ClassVar[List[str]] = ["id", "type", "name", "target", "lastModifiedDate", "authentication", "_links"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['panorama', 'unknown']): + raise ValueError("must be one of enum values ('panorama', 'unknown')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PanoramaConnector from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "last_modified_date", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of authentication + if self.authentication: + _dict['authentication'] = self.authentication.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PanoramaConnector from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "type": obj.get("type"), + "name": obj.get("name"), + "target": obj.get("target"), + "lastModifiedDate": obj.get("lastModifiedDate"), + "authentication": PanoramaConnectorAuth.from_dict(obj["authentication"]) if obj.get("authentication") is not None else None, + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connector_auth.py b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connector_auth.py new file mode 100644 index 000000000..b596d1910 --- /dev/null +++ b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connector_auth.py @@ -0,0 +1,143 @@ +# 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 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from thousandeyes_sdk.connectors.models.panorama_key_gen_authentication import PanoramaKeyGenAuthentication +from thousandeyes_sdk.connectors.models.panorama_token_authentication import PanoramaTokenAuthentication +from pydantic import StrictStr, Field, model_serializer +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +PANORAMACONNECTORAUTH_ONE_OF_SCHEMAS = ["PanoramaKeyGenAuthentication", "PanoramaTokenAuthentication"] + +class PanoramaConnectorAuth(BaseModel): + """ + Authentication configuration for the Panorama connector. + """ + # data type: PanoramaTokenAuthentication + oneof_schema_1_validator: Optional[PanoramaTokenAuthentication] = None + # data type: PanoramaKeyGenAuthentication + oneof_schema_2_validator: Optional[PanoramaKeyGenAuthentication] = None + actual_instance: Optional[Union[PanoramaKeyGenAuthentication, PanoramaTokenAuthentication]] = None + one_of_schemas: Set[str] = { "PanoramaKeyGenAuthentication", "PanoramaTokenAuthentication" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = PanoramaConnectorAuth.model_construct() + error_messages = [] + match = 0 + # validate data type: PanoramaTokenAuthentication + if not isinstance(v, PanoramaTokenAuthentication): + error_messages.append(f"Error! Input type `{type(v)}` is not `PanoramaTokenAuthentication`") + else: + match += 1 + # validate data type: PanoramaKeyGenAuthentication + if not isinstance(v, PanoramaKeyGenAuthentication): + error_messages.append(f"Error! Input type `{type(v)}` is not `PanoramaKeyGenAuthentication`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in PanoramaConnectorAuth with oneOf schemas: PanoramaKeyGenAuthentication, PanoramaTokenAuthentication. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in PanoramaConnectorAuth with oneOf schemas: PanoramaKeyGenAuthentication, PanoramaTokenAuthentication. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into PanoramaTokenAuthentication + try: + instance.actual_instance = PanoramaTokenAuthentication.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into PanoramaKeyGenAuthentication + try: + instance.actual_instance = PanoramaKeyGenAuthentication.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into PanoramaConnectorAuth with oneOf schemas: PanoramaKeyGenAuthentication, PanoramaTokenAuthentication. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into PanoramaConnectorAuth with oneOf schemas: PanoramaKeyGenAuthentication, PanoramaTokenAuthentication. Details: " + ", ".join(error_messages)) + else: + return instance + + @model_serializer(when_used="json") + def serialize_model(self): + return json.loads(self.to_json()) + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], PanoramaKeyGenAuthentication, PanoramaTokenAuthentication]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connectors.py b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connectors.py new file mode 100644 index 000000000..107860e24 --- /dev/null +++ b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_connectors.py @@ -0,0 +1,101 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector +from thousandeyes_sdk.connectors.models.self_links import SelfLinks +from typing import Optional, Set +from typing_extensions import Self + +class PanoramaConnectors(BaseModel): + """ + Collection of Panorama connectors. + """ # noqa: E501 + items: Optional[List[PanoramaConnector]] = None + links: Optional[SelfLinks] = Field(default=None, alias="_links") + __properties: ClassVar[List[str]] = ["items", "_links"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PanoramaConnectors from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in items (list) + _items = [] + if self.items: + for _item in self.items: + if _item: + _items.append(_item.to_dict()) + _dict['items'] = _items + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PanoramaConnectors from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "items": [PanoramaConnector.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None, + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_key_gen_authentication.py b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_key_gen_authentication.py new file mode 100644 index 000000000..a74e32712 --- /dev/null +++ b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_key_gen_authentication.py @@ -0,0 +1,101 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, SecretStr, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class PanoramaKeyGenAuthentication(BaseModel): + """ + Authentication using credentials to generate a Panorama API key. + """ # noqa: E501 + username: StrictStr = Field(description="Username used to generate the Panorama API key.") + password: SecretStr = Field(description="Password used to generate the Panorama API key.") + key_ttl: Annotated[int, Field(strict=True, ge=30)] = Field(description="Time to live for the generated Panorama API key, in minutes.", alias="keyTtl") + type: StrictStr + __properties: ClassVar[List[str]] = ["username", "password", "keyTtl", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['pan-key-gen', 'unknown']): + raise ValueError("must be one of enum values ('pan-key-gen', 'unknown')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PanoramaKeyGenAuthentication from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PanoramaKeyGenAuthentication from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "username": obj.get("username"), + "password": obj.get("password"), + "keyTtl": obj.get("keyTtl"), + "type": obj.get("type") + }) + return _obj + + diff --git a/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_token_authentication.py b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_token_authentication.py new file mode 100644 index 000000000..c2c319cfc --- /dev/null +++ b/thousandeyes-sdk-connectors/src/thousandeyes_sdk/connectors/models/panorama_token_authentication.py @@ -0,0 +1,96 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class PanoramaTokenAuthentication(BaseModel): + """ + Authentication using an existing Panorama API key. + """ # noqa: E501 + token: StrictStr = Field(description="Panorama API key used for authentication.") + type: StrictStr = Field(description="Authentication type.") + __properties: ClassVar[List[str]] = ["token", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['other-token', 'unknown']): + raise ValueError("must be one of enum values ('other-token', 'unknown')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PanoramaTokenAuthentication from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PanoramaTokenAuthentication from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "token": obj.get("token"), + "type": obj.get("type") + }) + return _obj + + diff --git a/thousandeyes-sdk-connectors/test/conftest.py b/thousandeyes-sdk-connectors/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..c05e4aa33 --- /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 000000000..ec7ff9966 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/mock_manifest.py @@ -0,0 +1,3761 @@ +# 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_panorama_connector": OperationExpectation( + operation_id="create_panorama_connector", + method="POST", + path="/connectors/panorama", + 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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """), + + 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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """), + 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_panorama_connector": OperationExpectation( + operation_id="delete_panorama_connector", + method="DELETE", + path="/connectors/panorama/{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_panorama_connector": OperationExpectation( + operation_id="get_panorama_connector", + method="GET", + path="/connectors/panorama/{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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """), + + 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_panorama_connector_operations": OperationExpectation( + operation_id="get_panorama_connector_operations", + method="GET", + path="/connectors/panorama/{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_panorama_connectors": OperationExpectation( + operation_id="get_panorama_connectors", + method="GET", + path="/connectors/panorama", + 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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + }, { + "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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } ] + } + + """), + + 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_panorama_connector": OperationExpectation( + operation_id="update_panorama_connector", + method="PUT", + path="/connectors/panorama/{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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """), + + 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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """), + 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 000000000..c487bb722 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py @@ -0,0 +1,1401 @@ +# 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.py b/thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api.py index 04625f7a7..927fcdcbd 100644 --- a/thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api.py +++ b/thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api.py @@ -230,7 +230,7 @@ def test_get_conjur_connectors_models_validation(self) -> None: def test_set_conjur_connector_operations_models_validation(self) -> None: """Test case for set_conjur_connector_operations request and response models""" request_body_json = """ - ["ca39314d-eb4f-496f-9435-b5d20b1bfbff","a32cfbab-32f6-41d8-9027-7127cba965dd"] + none """ request_loaded_json = json.loads(request_body_json) 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 000000000..fd05aef0d --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api_integration.py @@ -0,0 +1,1548 @@ +# 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.py b/thousandeyes-sdk-connectors/test/test_generic_connectors_api.py index b65969250..df453bad5 100644 --- a/thousandeyes-sdk-connectors/test/test_generic_connectors_api.py +++ b/thousandeyes-sdk-connectors/test/test_generic_connectors_api.py @@ -260,7 +260,7 @@ def test_list_generic_connector_operations_models_validation(self) -> None: def test_set_generic_connector_operations_models_validation(self) -> None: """Test case for set_generic_connector_operations request and response models""" request_body_json = """ - ["ca39314d-eb4f-496f-9435-b5d20b1bfbff","a32cfbab-32f6-41d8-9027-7127cba965dd"] + none """ request_loaded_json = json.loads(request_body_json) 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 000000000..776719483 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_generic_connectors_api_integration.py @@ -0,0 +1,1632 @@ +# 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.py b/thousandeyes-sdk-connectors/test/test_operation_connectors_api.py index 9b516f05a..e50b45823 100644 --- a/thousandeyes-sdk-connectors/test/test_operation_connectors_api.py +++ b/thousandeyes-sdk-connectors/test/test_operation_connectors_api.py @@ -55,7 +55,7 @@ def test_get_operation_connectors_models_validation(self) -> None: def test_set_operation_connectors_models_validation(self) -> None: """Test case for set_operation_connectors request and response models""" request_body_json = """ - ["ca39314d-eb4f-496f-9435-b5d20b1bfbff"] + none """ request_loaded_json = json.loads(request_body_json) 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 000000000..3a3e2f1a4 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_operation_connectors_api_integration.py @@ -0,0 +1,234 @@ +# 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_panorama_connectors_api.py b/thousandeyes-sdk-connectors/test/test_panorama_connectors_api.py new file mode 100644 index 000000000..c1b77b705 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_panorama_connectors_api.py @@ -0,0 +1,314 @@ +# 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 .test_utils import assert_constructed_model_matches_example_json +from thousandeyes_sdk.connectors.api.panorama_connectors_api import PanoramaConnectorsApi + + +class TestPanoramaConnectorsApi(unittest.TestCase): + """PanoramaConnectorsApi unit test stubs""" + + def setUp(self) -> None: + self.api = PanoramaConnectorsApi() + + def tearDown(self) -> None: + pass + + def test_create_panorama_connector_models_validation(self) -> None: + """Test case for create_panorama_connector request and response models""" + 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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + """ + + request_loaded_json = json.loads(request_body_json) + request_from_json = thousandeyes_sdk.connectors.models.PanoramaConnector.from_json(request_body_json) + assert_constructed_model_matches_example_json(request_from_json, request_loaded_json) + + 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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + }""" + + response_loaded_json = json.loads(response_body_json) + response_from_json = thousandeyes_sdk.connectors.models.PanoramaConnector.from_json(response_body_json) + assert_constructed_model_matches_example_json(response_from_json, response_loaded_json) + + def test_delete_panorama_connector_models_validation(self) -> None: + """Test case for delete_panorama_connector request and response models""" + + + def test_get_panorama_connector_models_validation(self) -> None: + """Test case for get_panorama_connector request and response models""" + + 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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + }""" + + response_loaded_json = json.loads(response_body_json) + response_from_json = thousandeyes_sdk.connectors.models.PanoramaConnector.from_json(response_body_json) + assert_constructed_model_matches_example_json(response_from_json, response_loaded_json) + + def test_get_panorama_connector_operations_models_validation(self) -> None: + """Test case for get_panorama_connector_operations request and response models""" + + 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" ] + }""" + + response_loaded_json = json.loads(response_body_json) + response_from_json = thousandeyes_sdk.connectors.models.Assignments.from_json(response_body_json) + assert_constructed_model_matches_example_json(response_from_json, response_loaded_json) + + def test_get_panorama_connectors_models_validation(self) -> None: + """Test case for get_panorama_connectors request and response models""" + + 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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + }, { + "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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } ] + }""" + + response_loaded_json = json.loads(response_body_json) + response_from_json = thousandeyes_sdk.connectors.models.PanoramaConnectors.from_json(response_body_json) + assert_constructed_model_matches_example_json(response_from_json, response_loaded_json) + + def test_set_panorama_connector_operations_models_validation(self) -> None: + """Test case for set_panorama_connector_operations request and response models""" + request_body_json = """ + none + """ + + request_loaded_json = json.loads(request_body_json) + request_from_json = json.loads(request_body_json) + self.assertEqual(request_from_json, request_loaded_json) + + 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" ] + }""" + + response_loaded_json = json.loads(response_body_json) + response_from_json = thousandeyes_sdk.connectors.models.Assignments.from_json(response_body_json) + assert_constructed_model_matches_example_json(response_from_json, response_loaded_json) + + def test_update_panorama_connector_models_validation(self) -> None: + """Test case for update_panorama_connector request and response models""" + 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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + """ + + request_loaded_json = json.loads(request_body_json) + request_from_json = thousandeyes_sdk.connectors.models.PanoramaConnector.from_json(request_body_json) + assert_constructed_model_matches_example_json(request_from_json, request_loaded_json) + + 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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + }""" + + response_loaded_json = json.loads(response_body_json) + response_from_json = thousandeyes_sdk.connectors.models.PanoramaConnector.from_json(response_body_json) + assert_constructed_model_matches_example_json(response_from_json, response_loaded_json) + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-connectors/test/test_panorama_connectors_api_integration.py b/thousandeyes-sdk-connectors/test/test_panorama_connectors_api_integration.py new file mode 100644 index 000000000..3355ece20 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_panorama_connectors_api_integration.py @@ -0,0 +1,1496 @@ +# 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.panorama_connectors_api import PanoramaConnectorsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestPanoramaConnectorsApiIntegration(IntegrationTestBase): + """PanoramaConnectorsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = PanoramaConnectorsApi(self.api_client) + + + def test_create_panorama_connector_happy_path(self) -> None: + """Integration test for create_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_panorama_connector( + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("create_panorama_connector"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_panorama_connector_error_400(self) -> None: + """Integration test for create_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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_panorama_connector( + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("create_panorama_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_panorama_connector_error_401(self) -> None: + """Integration test for create_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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_panorama_connector( + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("create_panorama_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_panorama_connector_error_403(self) -> None: + """Integration test for create_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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_panorama_connector( + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("create_panorama_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_panorama_connector_error_404(self) -> None: + """Integration test for create_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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_panorama_connector( + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("create_panorama_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_panorama_connector_error_500(self) -> None: + """Integration test for create_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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_panorama_connector( + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("create_panorama_connector", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_panorama_connector_happy_path(self) -> None: + """Integration test for delete_panorama_connector success path""" + id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' + aid = '1234' + response = self.api.delete_panorama_connector_with_http_info( + + id=id, + + aid=aid, + + _headers=self.te_headers("delete_panorama_connector"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_panorama_connector_error_400(self) -> None: + """Integration test for delete_panorama_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_panorama_connector( + + id=id, + + aid=aid, + + _headers=self.te_headers("delete_panorama_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_panorama_connector_error_401(self) -> None: + """Integration test for delete_panorama_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_panorama_connector( + + id=id, + + aid=aid, + + _headers=self.te_headers("delete_panorama_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_panorama_connector_error_403(self) -> None: + """Integration test for delete_panorama_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_panorama_connector( + + id=id, + + aid=aid, + + _headers=self.te_headers("delete_panorama_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_panorama_connector_error_404(self) -> None: + """Integration test for delete_panorama_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_panorama_connector( + + id=id, + + aid=aid, + + _headers=self.te_headers("delete_panorama_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_panorama_connector_error_500(self) -> None: + """Integration test for delete_panorama_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_panorama_connector( + + id=id, + + aid=aid, + + _headers=self.te_headers("delete_panorama_connector", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_panorama_connector_happy_path(self) -> None: + """Integration test for get_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_panorama_connector( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_panorama_connector_error_400(self) -> None: + """Integration test for get_panorama_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_panorama_connector( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connector_error_401(self) -> None: + """Integration test for get_panorama_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_panorama_connector( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connector_error_403(self) -> None: + """Integration test for get_panorama_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_panorama_connector( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connector_error_404(self) -> None: + """Integration test for get_panorama_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_panorama_connector( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connector_error_500(self) -> None: + """Integration test for get_panorama_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_panorama_connector( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_panorama_connector_operations_happy_path(self) -> None: + """Integration test for get_panorama_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_panorama_connector_operations( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector_operations"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_panorama_connector_operations_error_400(self) -> None: + """Integration test for get_panorama_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_panorama_connector_operations( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector_operations", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connector_operations_error_401(self) -> None: + """Integration test for get_panorama_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_panorama_connector_operations( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector_operations", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connector_operations_error_403(self) -> None: + """Integration test for get_panorama_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_panorama_connector_operations( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector_operations", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connector_operations_error_404(self) -> None: + """Integration test for get_panorama_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_panorama_connector_operations( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector_operations", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connector_operations_error_500(self) -> None: + """Integration test for get_panorama_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_panorama_connector_operations( + + id=id, + + aid=aid, + + _headers=self.te_headers("get_panorama_connector_operations", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_panorama_connectors_happy_path(self) -> None: + """Integration test for get_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + }, { + "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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_panorama_connectors( + + aid=aid, + + _headers=self.te_headers("get_panorama_connectors"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_panorama_connectors_error_400(self) -> None: + """Integration test for get_panorama_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_panorama_connectors( + + aid=aid, + + _headers=self.te_headers("get_panorama_connectors", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connectors_error_401(self) -> None: + """Integration test for get_panorama_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_panorama_connectors( + + aid=aid, + + _headers=self.te_headers("get_panorama_connectors", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connectors_error_403(self) -> None: + """Integration test for get_panorama_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_panorama_connectors( + + aid=aid, + + _headers=self.te_headers("get_panorama_connectors", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connectors_error_404(self) -> None: + """Integration test for get_panorama_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_panorama_connectors( + + aid=aid, + + _headers=self.te_headers("get_panorama_connectors", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_panorama_connectors_error_500(self) -> None: + """Integration test for get_panorama_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_panorama_connectors( + + aid=aid, + + _headers=self.te_headers("get_panorama_connectors", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_panorama_connector_happy_path(self) -> None: + """Integration test for update_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_panorama_connector( + + id=id, + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("update_panorama_connector"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_panorama_connector_error_400(self) -> None: + """Integration test for update_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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_panorama_connector( + + id=id, + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("update_panorama_connector", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_panorama_connector_error_401(self) -> None: + """Integration test for update_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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_panorama_connector( + + id=id, + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("update_panorama_connector", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_panorama_connector_error_403(self) -> None: + """Integration test for update_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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_panorama_connector( + + id=id, + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("update_panorama_connector", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_panorama_connector_error_404(self) -> None: + """Integration test for update_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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_panorama_connector( + + id=id, + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("update_panorama_connector", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_panorama_connector_error_500(self) -> None: + """Integration test for update_panorama_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" : "Branch Panorama", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "panorama", + "target" : "https://panorama.example.com", + "authentication" : { + "type" : "other-token", + "token" : "token" + } + } + + """ + panorama_connector = thousandeyes_sdk.connectors.models.PanoramaConnector.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_panorama_connector( + + id=id, + + panorama_connector=panorama_connector, + + aid=aid, + + _headers=self.te_headers("update_panorama_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_utils.py b/thousandeyes-sdk-connectors/test/test_utils.py index 930528d9b..37913f626 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-connectors/test/test_webhook_operations_api_integration.py b/thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py new file mode 100644 index 000000000..4233aae4d --- /dev/null +++ b/thousandeyes-sdk-connectors/test/test_webhook_operations_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.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/.openapi-generator/FILES b/thousandeyes-sdk-credentials/.openapi-generator/FILES index 90a5cd8c1..4569e0302 100644 --- a/thousandeyes-sdk-credentials/.openapi-generator/FILES +++ b/thousandeyes-sdk-credentials/.openapi-generator/FILES @@ -30,5 +30,9 @@ src/thousandeyes_sdk/credentials/models/validation_error.py src/thousandeyes_sdk/credentials/models/validation_error_item.py src/thousandeyes_sdk/credentials/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_credentials_api.py +test/test_credentials_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-credentials/README.md b/thousandeyes-sdk-credentials/README.md index c91635051..67b9e05fa 100644 --- a/thousandeyes-sdk-credentials/README.md +++ b/thousandeyes-sdk-credentials/README.md @@ -13,7 +13,7 @@ For more information about credentials, see [Working With Secure Credentials](ht This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -86,7 +86,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.credentials.CredentialsApi(api_client) - credential_request = thousandeyes_sdk.credentials.CredentialRequest() # CredentialRequest | + credential_request = # CredentialRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-credentials/docs/CredentialsApi.md b/thousandeyes-sdk-credentials/docs/CredentialsApi.md index 70b8eecb0..0435a9aad 100644 --- a/thousandeyes-sdk-credentials/docs/CredentialsApi.md +++ b/thousandeyes-sdk-credentials/docs/CredentialsApi.md @@ -49,7 +49,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.credentials.CredentialsApi(api_client) - credential_request = thousandeyes_sdk.credentials.CredentialRequest() # CredentialRequest | + credential_request = # CredentialRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -388,7 +388,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.credentials.CredentialsApi(api_client) id = '3247' # str | The ID of the desired credential. - credential_request = thousandeyes_sdk.credentials.CredentialRequest() # CredentialRequest | + credential_request = # CredentialRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-credentials/test/conftest.py b/thousandeyes-sdk-credentials/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..68f51d3ea --- /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 000000000..60292339b --- /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 000000000..2642639cf --- /dev/null +++ b/thousandeyes-sdk-credentials/test/test_credentials_api_integration.py @@ -0,0 +1,1140 @@ +# 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-credentials/test/test_utils.py b/thousandeyes-sdk-credentials/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-dashboards/.openapi-generator/FILES index 1eb8c3117..40eb33604 100644 --- a/thousandeyes-sdk-dashboards/.openapi-generator/FILES +++ b/thousandeyes-sdk-dashboards/.openapi-generator/FILES @@ -32,6 +32,9 @@ docs/ApiGraphletPoint.md docs/ApiGroupedBarchartWidget.md docs/ApiHeatmapWidget.md docs/ApiListWidget.md +docs/ApiListWidgetRow.md +docs/ApiListWidgetRowLinks.md +docs/ApiListWidgetRowValue.md docs/ApiMultiMetricColumn.md docs/ApiMultiMetricColumnData.md docs/ApiMultiMetricTableWidget.md @@ -52,6 +55,7 @@ docs/ApiTestTableData.md docs/ApiTestTableGraphletsData.md docs/ApiTestTableWidget.md docs/ApiTimeseriesWidget.md +docs/ApiTimeseriesWidgetProperties.md docs/ApiWidget.md docs/ApiWidgetData.md docs/ApiWidgetDataPoint.md @@ -103,6 +107,7 @@ docs/MultiMetricsTableDatasource.md docs/NumbersCardDatasource.md docs/PaginationLinks.md docs/PieChartDatasource.md +docs/RefreshRate.md docs/ScalableWidget.md docs/SelfLinks.md docs/StackedAreaChartDatasource.md @@ -159,6 +164,9 @@ src/thousandeyes_sdk/dashboards/models/api_graphlet_point.py src/thousandeyes_sdk/dashboards/models/api_grouped_barchart_widget.py src/thousandeyes_sdk/dashboards/models/api_heatmap_widget.py src/thousandeyes_sdk/dashboards/models/api_list_widget.py +src/thousandeyes_sdk/dashboards/models/api_list_widget_row.py +src/thousandeyes_sdk/dashboards/models/api_list_widget_row_links.py +src/thousandeyes_sdk/dashboards/models/api_list_widget_row_value.py src/thousandeyes_sdk/dashboards/models/api_multi_metric_column.py src/thousandeyes_sdk/dashboards/models/api_multi_metric_column_data.py src/thousandeyes_sdk/dashboards/models/api_multi_metric_table_widget.py @@ -179,6 +187,7 @@ src/thousandeyes_sdk/dashboards/models/api_test_table_data.py src/thousandeyes_sdk/dashboards/models/api_test_table_graphlets_data.py src/thousandeyes_sdk/dashboards/models/api_test_table_widget.py src/thousandeyes_sdk/dashboards/models/api_timeseries_widget.py +src/thousandeyes_sdk/dashboards/models/api_timeseries_widget_properties.py src/thousandeyes_sdk/dashboards/models/api_widget.py src/thousandeyes_sdk/dashboards/models/api_widget_data.py src/thousandeyes_sdk/dashboards/models/api_widget_data_point.py @@ -227,6 +236,7 @@ src/thousandeyes_sdk/dashboards/models/multi_metrics_table_datasource.py src/thousandeyes_sdk/dashboards/models/numbers_card_datasource.py src/thousandeyes_sdk/dashboards/models/pagination_links.py src/thousandeyes_sdk/dashboards/models/pie_chart_datasource.py +src/thousandeyes_sdk/dashboards/models/refresh_rate.py src/thousandeyes_sdk/dashboards/models/scalable_widget.py src/thousandeyes_sdk/dashboards/models/self_links.py src/thousandeyes_sdk/dashboards/models/stacked_area_chart_datasource.py @@ -246,7 +256,13 @@ src/thousandeyes_sdk/dashboards/models/widget_measure_type.py src/thousandeyes_sdk/dashboards/models/widget_position.py src/thousandeyes_sdk/dashboards/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_dashboard_snapshots_api.py +test/test_dashboard_snapshots_api_integration.py test/test_dashboards_api.py +test/test_dashboards_api_integration.py test/test_dashboards_filters_api.py +test/test_dashboards_filters_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-dashboards/README.md b/thousandeyes-sdk-dashboards/README.md index 13099c892..2edaaa38b 100644 --- a/thousandeyes-sdk-dashboards/README.md +++ b/thousandeyes-sdk-dashboards/README.md @@ -3,7 +3,7 @@ Manage ThousandEyes Dashboards. This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -76,7 +76,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.dashboards.DashboardSnapshotsApi(api_client) - generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.GenerateDashboardSnapshotRequest() # GenerateDashboardSnapshotRequest | Request body schema to create a dashboard snapshot. + generate_dashboard_snapshot_request = # GenerateDashboardSnapshotRequest | Request body schema to create a dashboard snapshot. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -149,6 +149,9 @@ Class | Method | HTTP request | Description - [ApiGroupedBarchartWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiGroupedBarchartWidget.md) - [ApiHeatmapWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiHeatmapWidget.md) - [ApiListWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiListWidget.md) + - [ApiListWidgetRow](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiListWidgetRow.md) + - [ApiListWidgetRowLinks](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiListWidgetRowLinks.md) + - [ApiListWidgetRowValue](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiListWidgetRowValue.md) - [ApiMultiMetricColumn](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiMultiMetricColumn.md) - [ApiMultiMetricColumnData](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiMultiMetricColumnData.md) - [ApiMultiMetricTableWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiMultiMetricTableWidget.md) @@ -169,6 +172,7 @@ Class | Method | HTTP request | Description - [ApiTestTableGraphletsData](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiTestTableGraphletsData.md) - [ApiTestTableWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiTestTableWidget.md) - [ApiTimeseriesWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidget.md) + - [ApiTimeseriesWidgetProperties](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidgetProperties.md) - [ApiWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiWidget.md) - [ApiWidgetData](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiWidgetData.md) - [ApiWidgetDataPoint](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiWidgetDataPoint.md) @@ -217,6 +221,7 @@ Class | Method | HTTP request | Description - [NumbersCardDatasource](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/NumbersCardDatasource.md) - [PaginationLinks](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/PaginationLinks.md) - [PieChartDatasource](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/PieChartDatasource.md) + - [RefreshRate](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/RefreshRate.md) - [ScalableWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ScalableWidget.md) - [SelfLinks](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/SelfLinks.md) - [StackedAreaChartDatasource](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/StackedAreaChartDatasource.md) diff --git a/thousandeyes-sdk-dashboards/docs/ApiDashboard.md b/thousandeyes-sdk-dashboards/docs/ApiDashboard.md index b5f99580c..0cb055f50 100644 --- a/thousandeyes-sdk-dashboards/docs/ApiDashboard.md +++ b/thousandeyes-sdk-dashboards/docs/ApiDashboard.md @@ -30,6 +30,7 @@ Name | Type | Description | Notes **is_global_override** | **bool** | When set to `true`, the defaultTimespan is used and overrides the widget's timespan. If set to `false`, the the widget's timespan is used. | [optional] **is_migrated_report** | **bool** | True if this dashboard was previously a report. | [optional] [readonly] **layout** | [**DashboardLayout**](DashboardLayout.md) | | [optional] +**refresh_rate** | [**RefreshRate**](RefreshRate.md) | | [optional] **links** | [**DashboardLinks**](DashboardLinks.md) | | [optional] ## Example diff --git a/thousandeyes-sdk-dashboards/docs/ApiListWidgetRow.md b/thousandeyes-sdk-dashboards/docs/ApiListWidgetRow.md new file mode 100644 index 000000000..2fbd32df2 --- /dev/null +++ b/thousandeyes-sdk-dashboards/docs/ApiListWidgetRow.md @@ -0,0 +1,30 @@ +# ApiListWidgetRow + +A row in a **List** widget. Property names are dimension display labels mapped to their values for that row. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**links** | [**ApiListWidgetRowLinks**](ApiListWidgetRowLinks.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.dashboards.models.api_list_widget_row import ApiListWidgetRow + +# TODO update the JSON string below +json = "{}" +# create an instance of ApiListWidgetRow from a JSON string +api_list_widget_row_instance = ApiListWidgetRow.from_json(json) +# print the JSON string representation of the object +print(ApiListWidgetRow.to_json()) + +# convert the object into a dict +api_list_widget_row_dict = api_list_widget_row_instance.to_dict() +# create an instance of ApiListWidgetRow from a dict +api_list_widget_row_from_dict = ApiListWidgetRow.from_dict(api_list_widget_row_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-dashboards/docs/ApiListWidgetRowLinks.md b/thousandeyes-sdk-dashboards/docs/ApiListWidgetRowLinks.md new file mode 100644 index 000000000..b338ec309 --- /dev/null +++ b/thousandeyes-sdk-dashboards/docs/ApiListWidgetRowLinks.md @@ -0,0 +1,30 @@ +# ApiListWidgetRowLinks + +Links for a **List** widget row. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**Link**](Link.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.dashboards.models.api_list_widget_row_links import ApiListWidgetRowLinks + +# TODO update the JSON string below +json = "{}" +# create an instance of ApiListWidgetRowLinks from a JSON string +api_list_widget_row_links_instance = ApiListWidgetRowLinks.from_json(json) +# print the JSON string representation of the object +print(ApiListWidgetRowLinks.to_json()) + +# convert the object into a dict +api_list_widget_row_links_dict = api_list_widget_row_links_instance.to_dict() +# create an instance of ApiListWidgetRowLinks from a dict +api_list_widget_row_links_from_dict = ApiListWidgetRowLinks.from_dict(api_list_widget_row_links_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-dashboards/docs/ApiListWidgetRowValue.md b/thousandeyes-sdk-dashboards/docs/ApiListWidgetRowValue.md new file mode 100644 index 000000000..b5e71d244 --- /dev/null +++ b/thousandeyes-sdk-dashboards/docs/ApiListWidgetRowValue.md @@ -0,0 +1,29 @@ +# ApiListWidgetRowValue + +Dimension display label mapped to its value for this row. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from thousandeyes_sdk.dashboards.models.api_list_widget_row_value import ApiListWidgetRowValue + +# TODO update the JSON string below +json = "{}" +# create an instance of ApiListWidgetRowValue from a JSON string +api_list_widget_row_value_instance = ApiListWidgetRowValue.from_json(json) +# print the JSON string representation of the object +print(ApiListWidgetRowValue.to_json()) + +# convert the object into a dict +api_list_widget_row_value_dict = api_list_widget_row_value_instance.to_dict() +# create an instance of ApiListWidgetRowValue from a dict +api_list_widget_row_value_from_dict = ApiListWidgetRowValue.from_dict(api_list_widget_row_value_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidget.md b/thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidget.md index f2f55cbbd..9ec05d72f 100644 --- a/thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidget.md +++ b/thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidget.md @@ -24,9 +24,10 @@ Name | Type | Description | Notes **max_scale** | **float** | Maximum scale configured in the widget. | [optional] **unit** | [**ApiWidgetFixedYScalePrefix**](ApiWidgetFixedYScalePrefix.md) | | [optional] **type** | **str** | Time Series: Line widget type. | -**show_timeseries_overall_baseline** | **bool** | Displays the overall baseline if set to `true`. | [optional] +**show_timeseries_overall_baseline** | **bool** | Displays the overall baseline when set to `true`. | [optional] [default to False] **group_by** | [**ApiAggregateProperty**](ApiAggregateProperty.md) | | [optional] -**is_timeseries_one_chart_per_line** | **bool** | Displays a separate chart for each line if set to `true`. | [optional] +**is_timeseries_one_chart_per_line** | **bool** | Displays a separate chart for each line when set to `true`. | [optional] [default to False] +**show_zoom_slider** | **bool** | Displays the zoom slider on the time axis when set to `true`. | [optional] [default to False] **data_source** | [**TimeseriesDatasource**](TimeseriesDatasource.md) | | [optional] ## Example diff --git a/thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidgetProperties.md b/thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidgetProperties.md new file mode 100644 index 000000000..ab158393d --- /dev/null +++ b/thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidgetProperties.md @@ -0,0 +1,34 @@ +# ApiTimeseriesWidgetProperties + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | Time Series: Line widget type. | +**show_timeseries_overall_baseline** | **bool** | Displays the overall baseline when set to `true`. | [optional] [default to False] +**group_by** | [**ApiAggregateProperty**](ApiAggregateProperty.md) | | [optional] +**is_timeseries_one_chart_per_line** | **bool** | Displays a separate chart for each line when set to `true`. | [optional] [default to False] +**show_zoom_slider** | **bool** | Displays the zoom slider on the time axis when set to `true`. | [optional] [default to False] +**data_source** | [**TimeseriesDatasource**](TimeseriesDatasource.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.dashboards.models.api_timeseries_widget_properties import ApiTimeseriesWidgetProperties + +# TODO update the JSON string below +json = "{}" +# create an instance of ApiTimeseriesWidgetProperties from a JSON string +api_timeseries_widget_properties_instance = ApiTimeseriesWidgetProperties.from_json(json) +# print the JSON string representation of the object +print(ApiTimeseriesWidgetProperties.to_json()) + +# convert the object into a dict +api_timeseries_widget_properties_dict = api_timeseries_widget_properties_instance.to_dict() +# create an instance of ApiTimeseriesWidgetProperties from a dict +api_timeseries_widget_properties_from_dict = ApiTimeseriesWidgetProperties.from_dict(api_timeseries_widget_properties_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-dashboards/docs/ApiWidget.md b/thousandeyes-sdk-dashboards/docs/ApiWidget.md index 62534ddbc..ea7d95dfa 100644 --- a/thousandeyes-sdk-dashboards/docs/ApiWidget.md +++ b/thousandeyes-sdk-dashboards/docs/ApiWidget.md @@ -50,8 +50,9 @@ Name | Type | Description | Notes **show_submetrics** | **bool** | Controls how metrics with submetric components are displayed. If `true` (default), the widget displays one chart per group. If `false`, the widget displays all submetrics in a single chart. For metrics without submetric components, this field is ignored and returned as `null`. | [optional] [default to True] **filter** | [**ApiWidgetFilterApiTestTableFilterKey**](ApiWidgetFilterApiTestTableFilterKey.md) | | [optional] **exclude** | [**ApiWidgetFilterApiTestTableFilterKey**](ApiWidgetFilterApiTestTableFilterKey.md) | | [optional] -**show_timeseries_overall_baseline** | **bool** | Displays the overall baseline if set to `true`. | [optional] -**is_timeseries_one_chart_per_line** | **bool** | Displays a separate chart for each line if set to `true`. | [optional] +**show_timeseries_overall_baseline** | **bool** | Displays the overall baseline when set to `true`. | [optional] [default to False] +**is_timeseries_one_chart_per_line** | **bool** | Displays a separate chart for each line when set to `true`. | [optional] [default to False] +**show_zoom_slider** | **bool** | Displays the zoom slider on the time axis when set to `true`. | [optional] [default to False] ## Example diff --git a/thousandeyes-sdk-dashboards/docs/ApiWidgetsDataV2.md b/thousandeyes-sdk-dashboards/docs/ApiWidgetsDataV2.md index 8a9476bed..9c7833177 100644 --- a/thousandeyes-sdk-dashboards/docs/ApiWidgetsDataV2.md +++ b/thousandeyes-sdk-dashboards/docs/ApiWidgetsDataV2.md @@ -17,6 +17,8 @@ Name | Type | Description | Notes **alerts** | [**List[ApiAlertListAlert]**](ApiAlertListAlert.md) | | [optional] **summary** | [**ApiAgentStatusSummary**](ApiAgentStatusSummary.md) | | [optional] **agents** | [**List[ApiAgentStatusAgent]**](ApiAgentStatusAgent.md) | | [optional] +**rows** | [**List[ApiListWidgetRow]**](ApiListWidgetRow.md) | Detailed information about each row in the **List** widget. | [optional] +**legend** | **Dict[str, int]** | Map of legend labels to their counts for the **List** widget. | [optional] **status** | **str** | Message for not fully configured card or no data. | [optional] ## Example diff --git a/thousandeyes-sdk-dashboards/docs/Dashboard.md b/thousandeyes-sdk-dashboards/docs/Dashboard.md index 3f05d802c..8d3723a95 100644 --- a/thousandeyes-sdk-dashboards/docs/Dashboard.md +++ b/thousandeyes-sdk-dashboards/docs/Dashboard.md @@ -23,6 +23,7 @@ Name | Type | Description | Notes **is_global_override** | **bool** | When set to `true`, the defaultTimespan is used and overrides the widget's timespan. If set to `false`, the the widget's timespan is used. | [optional] **is_migrated_report** | **bool** | True if this dashboard was previously a report. | [optional] [readonly] **layout** | [**DashboardLayout**](DashboardLayout.md) | | [optional] +**refresh_rate** | [**RefreshRate**](RefreshRate.md) | | [optional] **links** | [**DashboardLinks**](DashboardLinks.md) | | [optional] ## Example diff --git a/thousandeyes-sdk-dashboards/docs/DashboardSnapshotsApi.md b/thousandeyes-sdk-dashboards/docs/DashboardSnapshotsApi.md index dd32ce745..00ec1f3d4 100644 --- a/thousandeyes-sdk-dashboards/docs/DashboardSnapshotsApi.md +++ b/thousandeyes-sdk-dashboards/docs/DashboardSnapshotsApi.md @@ -50,7 +50,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.dashboards.DashboardSnapshotsApi(api_client) - generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.GenerateDashboardSnapshotRequest() # GenerateDashboardSnapshotRequest | Request body schema to create a dashboard snapshot. + generate_dashboard_snapshot_request = # GenerateDashboardSnapshotRequest | Request body schema to create a dashboard snapshot. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -482,7 +482,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.dashboards.DashboardSnapshotsApi(api_client) snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' # str | A Identifier for a dashboard snapshot which can be obtained from the `/dashboards-snapshots` endpoint. - update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.UpdateSnapshotExpirationDateApiRequest() # UpdateSnapshotExpirationDateApiRequest | Request body schema to update a snapshot expiration. + update_snapshot_expiration_date_api_request = # UpdateSnapshotExpirationDateApiRequest | Request body schema to update a snapshot expiration. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-dashboards/docs/DashboardsApi.md b/thousandeyes-sdk-dashboards/docs/DashboardsApi.md index 5b1feeaf0..8e9187ef4 100644 --- a/thousandeyes-sdk-dashboards/docs/DashboardsApi.md +++ b/thousandeyes-sdk-dashboards/docs/DashboardsApi.md @@ -51,7 +51,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.dashboards.DashboardsApi(api_client) - dashboard = thousandeyes_sdk.dashboards.Dashboard() # Dashboard | Request body schema to create a dashboard. + dashboard = # Dashboard | Request body schema to create a dashboard. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -316,7 +316,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: max = 10 # float | Optionally specify the maximum number of objects to retrieve. This only applies to the **Alert List** and **Test Table** Widgets. * The default for the **Alert List** widget is set by its limitBy configuration. * The default value for the **Test Table** widget is 10. (optional) cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' # str | An optional pagination cursor. This parameter should not not be used directly. Instead, use the `_links` returned by the API. This feature is only available in the **Test Table** widget. (optional) sort = 'alertStatus' # str | Optional sorting parameter with attributes listed comma-separated. This only applies to the **Alert List** and **Test Table** Widgets. * For the **Alert List** widget, you can sort by `alertStatus` or `startTime`. The default is `alertStatus`. * For the **Test Table** widget, you can sort by `alertStatus`, `testName`, or `testType`. The sequence might vary from the web application. The default sort attribute is `alertStatus`. (optional) - order = thousandeyes_sdk.dashboards.DashboardOrder() # DashboardOrder | Optional sorting order parameter that accepts either `asc` (ascending) or `desc` (descending) values. This only applies to the **Alert List** and **Test Table** Widgets. (optional) + order = # DashboardOrder | Optional sorting order parameter that accepts either `asc` (ascending) or `desc` (descending) values. This only applies to the **Alert List** and **Test Table** Widgets. (optional) try: # Retrieve dashboard widget data @@ -686,7 +686,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.dashboards.DashboardsApi(api_client) dashboard_id = '646f4d2ce3c99b0536c3821e' # str | A Identifier for a dashboard which can be obtained from the `/dashboards` endpoint. - dashboard = thousandeyes_sdk.dashboards.Dashboard() # Dashboard | Request body schema to update a dashboard. + dashboard = # Dashboard | Request body schema to update a dashboard. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-dashboards/docs/DashboardsFiltersApi.md b/thousandeyes-sdk-dashboards/docs/DashboardsFiltersApi.md index 976245ad6..bd7b26202 100644 --- a/thousandeyes-sdk-dashboards/docs/DashboardsFiltersApi.md +++ b/thousandeyes-sdk-dashboards/docs/DashboardsFiltersApi.md @@ -49,7 +49,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.dashboards.DashboardsFiltersApi(api_client) - api_context_filter_request = thousandeyes_sdk.dashboards.ApiContextFilterRequest() # ApiContextFilterRequest | Dashboard filter object to be created and saved + api_context_filter_request = # ApiContextFilterRequest | Dashboard filter object to be created and saved aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -392,7 +392,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.dashboards.DashboardsFiltersApi(api_client) id = '65bc18e8f2073a4a469cd958' # str | Unique dashboard filter ID. - api_context_filter_request = thousandeyes_sdk.dashboards.ApiContextFilterRequest() # ApiContextFilterRequest | Updated dashboard filter context object + api_context_filter_request = # ApiContextFilterRequest | Updated dashboard filter context object aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-dashboards/docs/RefreshRate.md b/thousandeyes-sdk-dashboards/docs/RefreshRate.md new file mode 100644 index 000000000..f4940a1ac --- /dev/null +++ b/thousandeyes-sdk-dashboards/docs/RefreshRate.md @@ -0,0 +1,12 @@ +# RefreshRate + +Auto-refresh interval for a dashboard. Use `off` to disable auto-refresh. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/__init__.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/__init__.py index c995986b9..816871205 100644 --- a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/__init__.py +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/__init__.py @@ -51,6 +51,9 @@ from thousandeyes_sdk.dashboards.models.api_grouped_barchart_widget import ApiGroupedBarchartWidget from thousandeyes_sdk.dashboards.models.api_heatmap_widget import ApiHeatmapWidget from thousandeyes_sdk.dashboards.models.api_list_widget import ApiListWidget +from thousandeyes_sdk.dashboards.models.api_list_widget_row import ApiListWidgetRow +from thousandeyes_sdk.dashboards.models.api_list_widget_row_links import ApiListWidgetRowLinks +from thousandeyes_sdk.dashboards.models.api_list_widget_row_value import ApiListWidgetRowValue from thousandeyes_sdk.dashboards.models.api_multi_metric_column import ApiMultiMetricColumn from thousandeyes_sdk.dashboards.models.api_multi_metric_column_data import ApiMultiMetricColumnData from thousandeyes_sdk.dashboards.models.api_multi_metric_table_widget import ApiMultiMetricTableWidget @@ -71,6 +74,7 @@ from thousandeyes_sdk.dashboards.models.api_test_table_graphlets_data import ApiTestTableGraphletsData from thousandeyes_sdk.dashboards.models.api_test_table_widget import ApiTestTableWidget from thousandeyes_sdk.dashboards.models.api_timeseries_widget import ApiTimeseriesWidget +from thousandeyes_sdk.dashboards.models.api_timeseries_widget_properties import ApiTimeseriesWidgetProperties from thousandeyes_sdk.dashboards.models.api_widget import ApiWidget from thousandeyes_sdk.dashboards.models.api_widget_data import ApiWidgetData from thousandeyes_sdk.dashboards.models.api_widget_data_point import ApiWidgetDataPoint @@ -119,6 +123,7 @@ from thousandeyes_sdk.dashboards.models.numbers_card_datasource import NumbersCardDatasource from thousandeyes_sdk.dashboards.models.pagination_links import PaginationLinks from thousandeyes_sdk.dashboards.models.pie_chart_datasource import PieChartDatasource +from thousandeyes_sdk.dashboards.models.refresh_rate import RefreshRate from thousandeyes_sdk.dashboards.models.scalable_widget import ScalableWidget from thousandeyes_sdk.dashboards.models.self_links import SelfLinks from thousandeyes_sdk.dashboards.models.stacked_area_chart_datasource import StackedAreaChartDatasource diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/__init__.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/__init__.py index a827e2976..b2cf18d81 100644 --- a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/__init__.py +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/__init__.py @@ -44,6 +44,9 @@ from thousandeyes_sdk.dashboards.models.api_grouped_barchart_widget import ApiGroupedBarchartWidget from thousandeyes_sdk.dashboards.models.api_heatmap_widget import ApiHeatmapWidget from thousandeyes_sdk.dashboards.models.api_list_widget import ApiListWidget +from thousandeyes_sdk.dashboards.models.api_list_widget_row import ApiListWidgetRow +from thousandeyes_sdk.dashboards.models.api_list_widget_row_links import ApiListWidgetRowLinks +from thousandeyes_sdk.dashboards.models.api_list_widget_row_value import ApiListWidgetRowValue from thousandeyes_sdk.dashboards.models.api_multi_metric_column import ApiMultiMetricColumn from thousandeyes_sdk.dashboards.models.api_multi_metric_column_data import ApiMultiMetricColumnData from thousandeyes_sdk.dashboards.models.api_multi_metric_table_widget import ApiMultiMetricTableWidget @@ -64,6 +67,7 @@ from thousandeyes_sdk.dashboards.models.api_test_table_graphlets_data import ApiTestTableGraphletsData from thousandeyes_sdk.dashboards.models.api_test_table_widget import ApiTestTableWidget from thousandeyes_sdk.dashboards.models.api_timeseries_widget import ApiTimeseriesWidget +from thousandeyes_sdk.dashboards.models.api_timeseries_widget_properties import ApiTimeseriesWidgetProperties from thousandeyes_sdk.dashboards.models.api_widget import ApiWidget from thousandeyes_sdk.dashboards.models.api_widget_data import ApiWidgetData from thousandeyes_sdk.dashboards.models.api_widget_data_point import ApiWidgetDataPoint @@ -112,6 +116,7 @@ from thousandeyes_sdk.dashboards.models.numbers_card_datasource import NumbersCardDatasource from thousandeyes_sdk.dashboards.models.pagination_links import PaginationLinks from thousandeyes_sdk.dashboards.models.pie_chart_datasource import PieChartDatasource +from thousandeyes_sdk.dashboards.models.refresh_rate import RefreshRate from thousandeyes_sdk.dashboards.models.scalable_widget import ScalableWidget from thousandeyes_sdk.dashboards.models.self_links import SelfLinks from thousandeyes_sdk.dashboards.models.stacked_area_chart_datasource import StackedAreaChartDatasource diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_dashboard.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_dashboard.py index 098b4fc2d..570514317 100644 --- a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_dashboard.py +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_dashboard.py @@ -23,6 +23,7 @@ from thousandeyes_sdk.dashboards.models.dashboard_layout import DashboardLayout from thousandeyes_sdk.dashboards.models.dashboard_links import DashboardLinks from thousandeyes_sdk.dashboards.models.default_timespan import DefaultTimespan +from thousandeyes_sdk.dashboards.models.refresh_rate import RefreshRate from typing import Optional, Set from typing_extensions import Self @@ -54,8 +55,9 @@ class ApiDashboard(BaseModel): is_global_override: Optional[StrictBool] = Field(default=None, description="When set to `true`, the defaultTimespan is used and overrides the widget's timespan. If set to `false`, the the widget's timespan is used.", alias="isGlobalOverride") is_migrated_report: Optional[StrictBool] = Field(default=None, description="True if this dashboard was previously a report.", alias="isMigratedReport") layout: Optional[DashboardLayout] = None + refresh_rate: Optional[RefreshRate] = Field(default=None, alias="refreshRate") links: Optional[DashboardLinks] = Field(default=None, alias="_links") - __properties: ClassVar[List[str]] = ["globalFilterId", "accountId", "createdBy", "modifiedBy", "modifiedDate", "globalOverride", "migratedReport", "apiLink", "dashboardId", "title", "isBuiltIn", "aid", "dashboardCreatedBy", "dashboardModifiedBy", "dashboardModifiedDate", "isPrivate", "isDefaultForUser", "isDefaultForAccount", "widgets", "description", "defaultTimespan", "isGlobalOverride", "isMigratedReport", "layout", "_links"] + __properties: ClassVar[List[str]] = ["globalFilterId", "accountId", "createdBy", "modifiedBy", "modifiedDate", "globalOverride", "migratedReport", "apiLink", "dashboardId", "title", "isBuiltIn", "aid", "dashboardCreatedBy", "dashboardModifiedBy", "dashboardModifiedDate", "isPrivate", "isDefaultForUser", "isDefaultForAccount", "widgets", "description", "defaultTimespan", "isGlobalOverride", "isMigratedReport", "layout", "refreshRate", "_links"] model_config = ConfigDict( populate_by_name=True, @@ -177,6 +179,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "isGlobalOverride": obj.get("isGlobalOverride"), "isMigratedReport": obj.get("isMigratedReport"), "layout": DashboardLayout.from_dict(obj["layout"]) if obj.get("layout") is not None else None, + "refreshRate": obj.get("refreshRate"), "_links": DashboardLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None }) return _obj diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row.py new file mode 100644 index 000000000..a75ae4f23 --- /dev/null +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Dashboards API + + Manage ThousandEyes Dashboards. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from thousandeyes_sdk.dashboards.models.api_list_widget_row_links import ApiListWidgetRowLinks +from typing import Optional, Set +from typing_extensions import Self + +class ApiListWidgetRow(BaseModel): + """ + A row in a **List** widget. Property names are dimension display labels mapped to their values for that row. + """ # noqa: E501 + links: Optional[ApiListWidgetRowLinks] = Field(default=None, alias="_links") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["_links"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApiListWidgetRow from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApiListWidgetRow from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "_links": ApiListWidgetRowLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row_links.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row_links.py new file mode 100644 index 000000000..9cf38684d --- /dev/null +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row_links.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Dashboards API + + Manage ThousandEyes Dashboards. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from thousandeyes_sdk.dashboards.models.link import Link +from typing import Optional, Set +from typing_extensions import Self + +class ApiListWidgetRowLinks(BaseModel): + """ + Links for a **List** widget row. + """ # noqa: E501 + data: Optional[Link] = None + __properties: ClassVar[List[str]] = ["data"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApiListWidgetRowLinks from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApiListWidgetRowLinks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "data": Link.from_dict(obj["data"]) if obj.get("data") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row_value.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row_value.py new file mode 100644 index 000000000..d4c8e0830 --- /dev/null +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_list_widget_row_value.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + Dashboards API + + Manage ThousandEyes Dashboards. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional, Union +from pydantic import StrictStr, Field, model_serializer +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +APILISTWIDGETROWVALUE_ONE_OF_SCHEMAS = ["bool", "float", "str"] + +class ApiListWidgetRowValue(BaseModel): + """ + Dimension display label mapped to its value for this row. + """ + # data type: str + oneof_schema_1_validator: Optional[StrictStr] = None + # data type: float + oneof_schema_2_validator: Optional[Union[StrictFloat, StrictInt]] = None + # data type: bool + oneof_schema_3_validator: Optional[StrictBool] = None + actual_instance: Optional[Union[bool, float, str]] = None + one_of_schemas: Set[str] = { "bool", "float", "str" } + + model_config = ConfigDict( + validate_assignment=True, + protected_namespaces=(), + ) + + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = ApiListWidgetRowValue.model_construct() + error_messages = [] + match = 0 + # validate data type: str + try: + instance.oneof_schema_1_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: float + try: + instance.oneof_schema_2_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: bool + try: + instance.oneof_schema_3_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in ApiListWidgetRowValue with oneOf schemas: bool, float, str. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in ApiListWidgetRowValue with oneOf schemas: bool, float, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into str + try: + # validation + instance.oneof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_1_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into float + try: + # validation + instance.oneof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_2_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into bool + try: + # validation + instance.oneof_schema_3_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_3_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into ApiListWidgetRowValue with oneOf schemas: bool, float, str. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into ApiListWidgetRowValue with oneOf schemas: bool, float, str. Details: " + ", ".join(error_messages)) + else: + return instance + + @model_serializer(when_used="json") + def serialize_model(self): + return json.loads(self.to_json()) + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], bool, float, str]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_timeseries_widget.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_timeseries_widget.py index e6de73f39..7e8c8520e 100644 --- a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_timeseries_widget.py +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_timeseries_widget.py @@ -54,11 +54,12 @@ class ApiTimeseriesWidget(BaseModel): max_scale: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Maximum scale configured in the widget.", alias="maxScale") unit: Optional[ApiWidgetFixedYScalePrefix] = None type: Annotated[str, Field(strict=True)] = Field(description="Time Series: Line widget type.") - show_timeseries_overall_baseline: Optional[StrictBool] = Field(default=None, description="Displays the overall baseline if set to `true`.", alias="showTimeseriesOverallBaseline") + show_timeseries_overall_baseline: Optional[StrictBool] = Field(default=False, description="Displays the overall baseline when set to `true`.", alias="showTimeseriesOverallBaseline") group_by: Optional[ApiAggregateProperty] = Field(default=None, alias="groupBy") - is_timeseries_one_chart_per_line: Optional[StrictBool] = Field(default=None, description="Displays a separate chart for each line if set to `true`.", alias="isTimeseriesOneChartPerLine") + is_timeseries_one_chart_per_line: Optional[StrictBool] = Field(default=False, description="Displays a separate chart for each line when set to `true`.", alias="isTimeseriesOneChartPerLine") + show_zoom_slider: Optional[StrictBool] = Field(default=False, description="Displays the zoom slider on the time axis when set to `true`.", alias="showZoomSlider") data_source: Optional[TimeseriesDatasource] = Field(default=None, alias="dataSource") - __properties: ClassVar[List[str]] = ["id", "title", "visualMode", "embedUrl", "isEmbedded", "metricGroup", "direction", "metric", "filters", "measure", "fixedTimespan", "apiLink", "shouldExcludeAlertSuppressionWindows", "_links", "minScale", "maxScale", "unit", "type", "showTimeseriesOverallBaseline", "groupBy", "isTimeseriesOneChartPerLine", "dataSource"] + __properties: ClassVar[List[str]] = ["id", "title", "visualMode", "embedUrl", "isEmbedded", "metricGroup", "direction", "metric", "filters", "measure", "fixedTimespan", "apiLink", "shouldExcludeAlertSuppressionWindows", "_links", "minScale", "maxScale", "unit", "type", "showTimeseriesOverallBaseline", "groupBy", "isTimeseriesOneChartPerLine", "showZoomSlider", "dataSource"] @field_validator('type') def type_validate_regular_expression(cls, value): @@ -152,9 +153,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "maxScale": obj.get("maxScale"), "unit": obj.get("unit"), "type": obj.get("type"), - "showTimeseriesOverallBaseline": obj.get("showTimeseriesOverallBaseline"), + "showTimeseriesOverallBaseline": obj.get("showTimeseriesOverallBaseline") if obj.get("showTimeseriesOverallBaseline") is not None else False, "groupBy": obj.get("groupBy"), - "isTimeseriesOneChartPerLine": obj.get("isTimeseriesOneChartPerLine"), + "isTimeseriesOneChartPerLine": obj.get("isTimeseriesOneChartPerLine") if obj.get("isTimeseriesOneChartPerLine") is not None else False, + "showZoomSlider": obj.get("showZoomSlider") if obj.get("showZoomSlider") is not None else False, "dataSource": obj.get("dataSource") }) return _obj diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_timeseries_widget_properties.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_timeseries_widget_properties.py new file mode 100644 index 000000000..730cd62eb --- /dev/null +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_timeseries_widget_properties.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Dashboards API + + Manage ThousandEyes Dashboards. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.dashboards.models.api_aggregate_property import ApiAggregateProperty +from thousandeyes_sdk.dashboards.models.timeseries_datasource import TimeseriesDatasource +from typing import Optional, Set +from typing_extensions import Self + +class ApiTimeseriesWidgetProperties(BaseModel): + """ + ApiTimeseriesWidgetProperties + """ # noqa: E501 + type: Annotated[str, Field(strict=True)] = Field(description="Time Series: Line widget type.") + show_timeseries_overall_baseline: Optional[StrictBool] = Field(default=False, description="Displays the overall baseline when set to `true`.", alias="showTimeseriesOverallBaseline") + group_by: Optional[ApiAggregateProperty] = Field(default=None, alias="groupBy") + is_timeseries_one_chart_per_line: Optional[StrictBool] = Field(default=False, description="Displays a separate chart for each line when set to `true`.", alias="isTimeseriesOneChartPerLine") + show_zoom_slider: Optional[StrictBool] = Field(default=False, description="Displays the zoom slider on the time axis when set to `true`.", alias="showZoomSlider") + data_source: Optional[TimeseriesDatasource] = Field(default=None, alias="dataSource") + __properties: ClassVar[List[str]] = ["type", "showTimeseriesOverallBaseline", "groupBy", "isTimeseriesOneChartPerLine", "showZoomSlider", "dataSource"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^Time Series: Line$", value): + raise ValueError(r"must validate the regular expression /^Time Series: Line$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApiTimeseriesWidgetProperties from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApiTimeseriesWidgetProperties from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "showTimeseriesOverallBaseline": obj.get("showTimeseriesOverallBaseline") if obj.get("showTimeseriesOverallBaseline") is not None else False, + "groupBy": obj.get("groupBy"), + "isTimeseriesOneChartPerLine": obj.get("isTimeseriesOneChartPerLine") if obj.get("isTimeseriesOneChartPerLine") is not None else False, + "showZoomSlider": obj.get("showZoomSlider") if obj.get("showZoomSlider") is not None else False, + "dataSource": obj.get("dataSource") + }) + return _obj + + diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_widgets_data_v2.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_widgets_data_v2.py index bc2a2ea18..4392011f5 100644 --- a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_widgets_data_v2.py +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/api_widgets_data_v2.py @@ -22,6 +22,7 @@ from thousandeyes_sdk.dashboards.models.api_agent_status_summary import ApiAgentStatusSummary from thousandeyes_sdk.dashboards.models.api_alert_list_alert import ApiAlertListAlert from thousandeyes_sdk.dashboards.models.api_dashboard_asw import ApiDashboardAsw +from thousandeyes_sdk.dashboards.models.api_list_widget_row import ApiListWidgetRow from thousandeyes_sdk.dashboards.models.api_multi_metric_column_data import ApiMultiMetricColumnData from thousandeyes_sdk.dashboards.models.api_numbers_card_data import ApiNumbersCardData from thousandeyes_sdk.dashboards.models.api_test_table_data import ApiTestTableData @@ -44,8 +45,10 @@ class ApiWidgetsDataV2(BaseModel): alerts: Optional[List[ApiAlertListAlert]] = None summary: Optional[ApiAgentStatusSummary] = None agents: Optional[List[ApiAgentStatusAgent]] = None + rows: Optional[List[ApiListWidgetRow]] = Field(default=None, description="Detailed information about each row in the **List** widget.") + legend: Optional[Dict[str, StrictInt]] = Field(default=None, description="Map of legend labels to their counts for the **List** widget.") status: Optional[StrictStr] = Field(default=None, description="Message for not fully configured card or no data.") - __properties: ClassVar[List[str]] = ["cards", "columns", "points", "tests", "startRound", "alertSuppressionWindows", "totalAlerts", "activeAlerts", "alerts", "summary", "agents", "status"] + __properties: ClassVar[List[str]] = ["cards", "columns", "points", "tests", "startRound", "alertSuppressionWindows", "totalAlerts", "activeAlerts", "alerts", "summary", "agents", "rows", "legend", "status"] model_config = ConfigDict( populate_by_name=True, @@ -139,6 +142,13 @@ def to_dict(self) -> Dict[str, Any]: if _item: _items.append(_item.to_dict()) _dict['agents'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in rows (list) + _items = [] + if self.rows: + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) + _dict['rows'] = _items return _dict @classmethod @@ -162,6 +172,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "alerts": [ApiAlertListAlert.from_dict(_item) for _item in obj["alerts"]] if obj.get("alerts") is not None else None, "summary": ApiAgentStatusSummary.from_dict(obj["summary"]) if obj.get("summary") is not None else None, "agents": [ApiAgentStatusAgent.from_dict(_item) for _item in obj["agents"]] if obj.get("agents") is not None else None, + "rows": [ApiListWidgetRow.from_dict(_item) for _item in obj["rows"]] if obj.get("rows") is not None else None, + "legend": obj.get("legend"), "status": obj.get("status") }) return _obj diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/dashboard.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/dashboard.py index aa6adc603..b1182fce4 100644 --- a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/dashboard.py +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/dashboard.py @@ -23,6 +23,7 @@ from thousandeyes_sdk.dashboards.models.dashboard_layout import DashboardLayout from thousandeyes_sdk.dashboards.models.dashboard_links import DashboardLinks from thousandeyes_sdk.dashboards.models.default_timespan import DefaultTimespan +from thousandeyes_sdk.dashboards.models.refresh_rate import RefreshRate from typing import Optional, Set from typing_extensions import Self @@ -47,8 +48,9 @@ class Dashboard(BaseModel): is_global_override: Optional[StrictBool] = Field(default=None, description="When set to `true`, the defaultTimespan is used and overrides the widget's timespan. If set to `false`, the the widget's timespan is used.", alias="isGlobalOverride") is_migrated_report: Optional[StrictBool] = Field(default=None, description="True if this dashboard was previously a report.", alias="isMigratedReport") layout: Optional[DashboardLayout] = None + refresh_rate: Optional[RefreshRate] = Field(default=None, alias="refreshRate") links: Optional[DashboardLinks] = Field(default=None, alias="_links") - __properties: ClassVar[List[str]] = ["globalFilterId", "dashboardId", "title", "isBuiltIn", "aid", "createdBy", "modifiedBy", "modifiedDate", "isPrivate", "isDefaultForUser", "isDefaultForAccount", "widgets", "description", "defaultTimespan", "isGlobalOverride", "isMigratedReport", "layout", "_links"] + __properties: ClassVar[List[str]] = ["globalFilterId", "dashboardId", "title", "isBuiltIn", "aid", "createdBy", "modifiedBy", "modifiedDate", "isPrivate", "isDefaultForUser", "isDefaultForAccount", "widgets", "description", "defaultTimespan", "isGlobalOverride", "isMigratedReport", "layout", "refreshRate", "_links"] model_config = ConfigDict( populate_by_name=True, @@ -153,6 +155,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "isGlobalOverride": obj.get("isGlobalOverride"), "isMigratedReport": obj.get("isMigratedReport"), "layout": DashboardLayout.from_dict(obj["layout"]) if obj.get("layout") is not None else None, + "refreshRate": obj.get("refreshRate"), "_links": DashboardLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None }) return _obj diff --git a/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/refresh_rate.py b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/refresh_rate.py new file mode 100644 index 000000000..d978c1e95 --- /dev/null +++ b/thousandeyes-sdk-dashboards/src/thousandeyes_sdk/dashboards/models/refresh_rate.py @@ -0,0 +1,46 @@ +# coding: utf-8 + +""" + Dashboards API + + Manage ThousandEyes Dashboards. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class RefreshRate(str, Enum): + """ + Auto-refresh interval for a dashboard. Use `off` to disable auto-refresh. + """ + + """ + allowed enum values + """ + OFF = 'off' + ENUM_2M = '2m' + ENUM_5M = '5m' + ENUM_10M = '10m' + ENUM_15M = '15m' + ENUM_30M = '30m' + ENUM_60M = '60m' + UNKNOWN = 'unknown' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of RefreshRate from a JSON string""" + return cls(json.loads(json_str)) + + @classmethod + def _missing_(cls, value): + """Handle unknown values""" + return cls.UNKNOWN + diff --git a/thousandeyes-sdk-dashboards/test/conftest.py b/thousandeyes-sdk-dashboards/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..752c1c5d2 --- /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 000000000..117cf2208 --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/mock_manifest.py @@ -0,0 +1,5133 @@ +# 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", + "refreshRate" : "off", + "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" : { + "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" + } ], + "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" + } ], + "legend" : { + "ONGOING" : 5, + "CLEAR" : 3 + }, + "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" ] + } ], + "rows" : [ { + "_links" : { + "data" : { + "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" : { + "data" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } ], + "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" + } ], + "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" + } ], + "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" + } ], + "activeAlerts" : 483, + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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" : { + "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" + } ], + "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" + } ], + "legend" : { + "ONGOING" : 5, + "CLEAR" : 3 + }, + "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" ] + } ], + "rows" : [ { + "_links" : { + "data" : { + "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" : { + "data" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } ], + "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" + } ], + "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" + } ], + "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" + } ], + "activeAlerts" : 483, + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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.py b/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api.py index 80c4c16e6..760c7b322 100644 --- a/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api.py +++ b/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api.py @@ -299,6 +299,7 @@ def test_get_dashboard_snapshot_models_validation(self) -> None: "direction" : "FROM_TARGET" } ], "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "refreshRate" : "off", "modifiedBy" : 1, "dashboardModifiedBy" : "1", "migratedReport" : false, @@ -370,27 +371,6 @@ def test_get_dashboard_snapshot_widget_data_models_validation(self) -> None: } ] } ], "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, @@ -482,63 +462,6 @@ def test_get_dashboard_snapshot_widget_data_models_validation(self) -> None: "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" : { @@ -656,6 +579,10 @@ def test_get_dashboard_snapshot_widget_data_models_validation(self) -> None: } ], "status" : "No data" } ], + "legend" : { + "ONGOING" : 5, + "CLEAR" : 3 + }, "alertSuppressionWindows" : [ { "testIds" : [ "281474976710661" ], "repeatUnit" : "week", @@ -675,7 +602,33 @@ def test_get_dashboard_snapshot_widget_data_models_validation(self) -> None: "id" : "281474976710662", "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "activeAlerts" : 483, + "rows" : [ { + "_links" : { + "data" : { + "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" : { + "data" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } ], "startRound" : 1384309800, "points" : [ { "numberOfDataPoints" : 23304, @@ -731,6 +684,85 @@ def test_get_dashboard_snapshot_widget_data_models_validation(self) -> None: }, "status" : "online" } ], + "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" + } ], + "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" + } ], + "activeAlerts" : 483, "status" : "No data" }, "endDate" : "2022-07-18T22:00:54Z", @@ -1018,6 +1050,7 @@ def test_get_dashboard_snapshots_models_validation(self) -> None: "direction" : "FROM_TARGET" } ], "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "refreshRate" : "off", "modifiedBy" : 1, "dashboardModifiedBy" : "1", "migratedReport" : false, @@ -1282,6 +1315,7 @@ def test_get_dashboard_snapshots_models_validation(self) -> None: "direction" : "FROM_TARGET" } ], "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "refreshRate" : "off", "modifiedBy" : 1, "dashboardModifiedBy" : "1", "migratedReport" : false, 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 000000000..6ced6da76 --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py @@ -0,0 +1,2644 @@ +# 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", + "refreshRate" : "off", + "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" : { + "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" + } ], + "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" + } ], + "legend" : { + "ONGOING" : 5, + "CLEAR" : 3 + }, + "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" ] + } ], + "rows" : [ { + "_links" : { + "data" : { + "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" : { + "data" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } ], + "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" + } ], + "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" + } ], + "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" + } ], + "activeAlerts" : 483, + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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.py b/thousandeyes-sdk-dashboards/test/test_dashboards_api.py index c78d6db1d..0e13200ed 100644 --- a/thousandeyes-sdk-dashboards/test/test_dashboards_api.py +++ b/thousandeyes-sdk-dashboards/test/test_dashboards_api.py @@ -160,6 +160,7 @@ def test_create_dashboard_models_validation(self) -> None: "globalFilterId" : "65babd9bb90bf55b17c96c8d", "dashboardId" : "5e1f7a99143ae6004fdc3bb4", "createdBy" : "1", + "refreshRate" : "off", "modifiedDate" : "2023-05-16T10:14:28Z", "modifiedBy" : "1", "isGlobalOverride" : true, @@ -301,6 +302,7 @@ def test_create_dashboard_models_validation(self) -> None: "globalFilterId" : "65babd9bb90bf55b17c96c8d", "dashboardId" : "5e1f7a99143ae6004fdc3bb4", "createdBy" : "1", + "refreshRate" : "off", "modifiedDate" : "2023-05-16T10:14:28Z", "modifiedBy" : "1", "isGlobalOverride" : true, @@ -425,6 +427,7 @@ def test_get_dashboard_models_validation(self) -> None: "direction" : "FROM_TARGET" } ], "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "refreshRate" : "off", "modifiedBy" : 1, "dashboardModifiedBy" : "1", "migratedReport" : false, @@ -494,27 +497,6 @@ def test_get_dashboard_widget_data_models_validation(self) -> None: } ] } ], "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, @@ -606,63 +588,6 @@ def test_get_dashboard_widget_data_models_validation(self) -> None: "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" : { @@ -780,6 +705,10 @@ def test_get_dashboard_widget_data_models_validation(self) -> None: } ], "status" : "No data" } ], + "legend" : { + "ONGOING" : 5, + "CLEAR" : 3 + }, "alertSuppressionWindows" : [ { "testIds" : [ "281474976710661" ], "repeatUnit" : "week", @@ -799,7 +728,33 @@ def test_get_dashboard_widget_data_models_validation(self) -> None: "id" : "281474976710662", "startTimes" : [ "2023-05-16T10:14:28Z" ] } ], - "activeAlerts" : 483, + "rows" : [ { + "_links" : { + "data" : { + "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" : { + "data" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } ], "startRound" : 1384309800, "points" : [ { "numberOfDataPoints" : 23304, @@ -855,6 +810,85 @@ def test_get_dashboard_widget_data_models_validation(self) -> None: }, "status" : "online" } ], + "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" + } ], + "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" + } ], + "activeAlerts" : 483, "status" : "No data" }, "endDate" : "2022-07-18T22:00:54Z", @@ -1008,6 +1042,7 @@ def test_get_dashboards_models_validation(self) -> None: "direction" : "FROM_TARGET" } ], "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "refreshRate" : "off", "modifiedBy" : 1, "dashboardModifiedBy" : "1", "migratedReport" : false, @@ -1152,6 +1187,7 @@ def test_get_dashboards_models_validation(self) -> None: "direction" : "FROM_TARGET" } ], "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "refreshRate" : "off", "modifiedBy" : 1, "dashboardModifiedBy" : "1", "migratedReport" : false, @@ -1451,6 +1487,7 @@ def test_update_dashboard_models_validation(self) -> None: "globalFilterId" : "65babd9bb90bf55b17c96c8d", "dashboardId" : "5e1f7a99143ae6004fdc3bb4", "createdBy" : "1", + "refreshRate" : "off", "modifiedDate" : "2023-05-16T10:14:28Z", "modifiedBy" : "1", "isGlobalOverride" : true, @@ -1592,6 +1629,7 @@ def test_update_dashboard_models_validation(self) -> None: "globalFilterId" : "65babd9bb90bf55b17c96c8d", "dashboardId" : "5e1f7a99143ae6004fdc3bb4", "createdBy" : "1", + "refreshRate" : "off", "modifiedDate" : "2023-05-16T10:14:28Z", "modifiedBy" : "1", "isGlobalOverride" : true, 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 000000000..843815ef4 --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py @@ -0,0 +1,5151 @@ +# 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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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' + 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" : { + "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" + } ], + "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" + } ], + "legend" : { + "ONGOING" : 5, + "CLEAR" : 3 + }, + "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" ] + } ], + "rows" : [ { + "_links" : { + "data" : { + "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" : { + "data" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } ], + "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" + } ], + "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" + } ], + "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" + } ], + "activeAlerts" : 483, + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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"), + ) + 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: + """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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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", + "refreshRate" : "off", + "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 000000000..eb0562ad1 --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py @@ -0,0 +1,1714 @@ +# 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-dashboards/test/test_utils.py b/thousandeyes-sdk-dashboards/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-emulation/.openapi-generator/FILES index 90ceb9ecd..1eff36895 100644 --- a/thousandeyes-sdk-emulation/.openapi-generator/FILES +++ b/thousandeyes-sdk-emulation/.openapi-generator/FILES @@ -32,5 +32,9 @@ src/thousandeyes_sdk/emulation/models/user_agent.py src/thousandeyes_sdk/emulation/models/user_agents.py src/thousandeyes_sdk/emulation/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_emulation_api.py +test/test_emulation_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-emulation/README.md b/thousandeyes-sdk-emulation/README.md index 5ff2780f9..b97e13ea9 100644 --- a/thousandeyes-sdk-emulation/README.md +++ b/thousandeyes-sdk-emulation/README.md @@ -11,7 +11,7 @@ To access Emulation API operations, the following permissions are required: This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -84,7 +84,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.emulation.EmulationApi(api_client) - emulated_device = thousandeyes_sdk.emulation.EmulatedDevice() # EmulatedDevice | + emulated_device = # EmulatedDevice | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-emulation/docs/EmulationApi.md b/thousandeyes-sdk-emulation/docs/EmulationApi.md index c490779b7..66ddbaf09 100644 --- a/thousandeyes-sdk-emulation/docs/EmulationApi.md +++ b/thousandeyes-sdk-emulation/docs/EmulationApi.md @@ -47,7 +47,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.emulation.EmulationApi(api_client) - emulated_device = thousandeyes_sdk.emulation.EmulatedDevice() # EmulatedDevice | + emulated_device = # EmulatedDevice | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -133,7 +133,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.emulation.EmulationApi(api_client) - expand = [thousandeyes_sdk.emulation.ExpandEmulatedDeviceOptions()] # List[ExpandEmulatedDeviceOptions] | Optional query parameter that controls whether user-agent templates are included in the response. By default, user-agent templates are not included. To include them, add `?expand=user-agent` to the request. (optional) + expand = # List[ExpandEmulatedDeviceOptions] | Optional query parameter that controls whether user-agent templates are included in the response. By default, user-agent templates are not included. To include them, add `?expand=user-agent` to the request. (optional) try: # List emulated devices diff --git a/thousandeyes-sdk-emulation/test/conftest.py b/thousandeyes-sdk-emulation/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..4b2b04650 --- /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 000000000..395e0ebbe --- /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 000000000..4dee72030 --- /dev/null +++ b/thousandeyes-sdk-emulation/test/test_emulation_api_integration.py @@ -0,0 +1,572 @@ +# 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""" + 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( + + _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)""" + error_body_json = """ + { + "error_description" : "Invalid access token", + "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( + + _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)""" + error_body_json = """ + { + "instance" : "instance", + "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( + + _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)""" + error_body_json = """ + { + "instance" : "instance", + "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( + + _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)""" + error_body_json = """ + { + "instance" : "instance", + "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( + + _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)""" + error_body_json = """ + { + "instance" : "instance", + "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( + + _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-emulation/test/test_utils.py b/thousandeyes-sdk-emulation/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-agents/.openapi-generator/FILES index 5ca2c26f2..4fc8376d2 100644 --- a/thousandeyes-sdk-endpoint-agents/.openapi-generator/FILES +++ b/thousandeyes-sdk-endpoint-agents/.openapi-generator/FILES @@ -152,8 +152,15 @@ src/thousandeyes_sdk/endpoint_agents/models/vpn_type.py src/thousandeyes_sdk/endpoint_agents/models/wireless_profile.py src/thousandeyes_sdk/endpoint_agents/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_endpoint_agent_log_items_api.py +test/test_endpoint_agent_log_items_api_integration.py test/test_endpoint_agents_api.py +test/test_endpoint_agents_api_integration.py test/test_endpoint_agents_transfer_api.py +test/test_endpoint_agents_transfer_api_integration.py test/test_endpoint_proxies_api.py +test/test_endpoint_proxies_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-endpoint-agents/README.md b/thousandeyes-sdk-endpoint-agents/README.md index a0de7de68..74f0aa962 100644 --- a/thousandeyes-sdk-endpoint-agents/README.md +++ b/thousandeyes-sdk-endpoint-agents/README.md @@ -7,7 +7,7 @@ For more information about Endpoint Agents, see [Endpoint Agents](https://docs.t This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator diff --git a/thousandeyes-sdk-endpoint-agents/docs/AgentSearchFilters.md b/thousandeyes-sdk-endpoint-agents/docs/AgentSearchFilters.md index 83e56e902..83f2edf19 100644 --- a/thousandeyes-sdk-endpoint-agents/docs/AgentSearchFilters.md +++ b/thousandeyes-sdk-endpoint-agents/docs/AgentSearchFilters.md @@ -12,6 +12,8 @@ Name | Type | Description | Notes **user_principal_name** | **List[str]** | Returns only agents that have at least one user principal name, starting with one of the provided strings. This is a case-insensitive prefix match. User principle name is the user login name in an Internet-style format, typically used in Active Directory environments. | [optional] **platform** | [**List[Platform]**](Platform.md) | Filter on the platform on which the agent is running. | [optional] **os_version** | **List[str]** | Case-insensitive prefix filter on the OS version. | [optional] +**nic_model** | **List[str]** | Returns only agents whose NIC model is an exact, case-sensitive match for one of the provided values. | [optional] +**nic_driver_version** | **List[str]** | Returns only agents whose NIC driver version is an exact, case-sensitive match for one of the provided values. | [optional] **serial_number** | **List[str]** | Case-insensitive prefix filter on the serial number. | [optional] **location_country_iso** | **List[str]** | Filter using the ISO country code of the location. | [optional] **location_subdivision1_code** | **List[str]** | Filter using the code for the first level administrative division within the country. In US/Canada this is the State, in UK it's the country e.g. `ENG` | [optional] diff --git a/thousandeyes-sdk-endpoint-agents/docs/EndpointAgentsApi.md b/thousandeyes-sdk-endpoint-agents/docs/EndpointAgentsApi.md index 288c8d11d..e4c20a38f 100644 --- a/thousandeyes-sdk-endpoint-agents/docs/EndpointAgentsApi.md +++ b/thousandeyes-sdk-endpoint-agents/docs/EndpointAgentsApi.md @@ -53,7 +53,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.endpoint_agents.EndpointAgentsApi(api_client) agent_id = 'agent_id_example' # str | The identifier of the agent to operate on. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] # List[ExpandEndpointAgentOptions] | This optional parameter allows you to control the expansion of test resources associated with the agent. By default, no expansion occurs when this query parameter is omitted. To expand the \"clients\" resource, include the query parameter `?expand=clients`. For multiple expansions, you have two options: * Separate the values with commas. For example, `?expandAgent=clients,tasks`. * Specify the parameter multiple times. For example, `?expandAgent=clients&expandAgent=tasks`. This parameter offers flexibility for users to customize the expansion of specific resources related to the agent. (optional) + expand = # List[ExpandEndpointAgentOptions] | This optional parameter allows you to control the expansion of test resources associated with the agent. By default, no expansion occurs when this query parameter is omitted. To expand the \"clients\" resource, include the query parameter `?expand=clients`. For multiple expansions, you have two options: * Separate the values with commas. For example, `?expandAgent=clients,tasks`. * Specify the parameter multiple times. For example, `?expandAgent=clients&expandAgent=tasks`. This parameter offers flexibility for users to customize the expansion of specific resources related to the agent. (optional) try: # Delete endpoint agent @@ -305,12 +305,12 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_agents.EndpointAgentsApi(api_client) - agent_search_request = thousandeyes_sdk.endpoint_agents.AgentSearchRequest() # AgentSearchRequest | The filter options for advanced search filtering for agents. + agent_search_request = # AgentSearchRequest | The filter options for advanced search filtering for agents. max = 5 # int | (Optional) Maximum number of objects to return. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] # List[ExpandEndpointAgentOptions] | This optional parameter allows you to control the expansion of test resources associated with the agent. By default, no expansion occurs when this query parameter is omitted. To expand the \"clients\" resource, include the query parameter `?expand=clients`. For multiple expansions, you have two options: * Separate the values with commas. For example, `?expandAgent=clients,tasks`. * Specify the parameter multiple times. For example, `?expandAgent=clients&expandAgent=tasks`. This parameter offers flexibility for users to customize the expansion of specific resources related to the agent. (optional) - include_deleted = false # bool | When requesting entities, set to `true` if you want to see deleted entities. (optional) + expand = # List[ExpandEndpointAgentOptions] | This optional parameter allows you to control the expansion of test resources associated with the agent. By default, no expansion occurs when this query parameter is omitted. To expand the \"clients\" resource, include the query parameter `?expand=clients`. For multiple expansions, you have two options: * Separate the values with commas. For example, `?expandAgent=clients,tasks`. * Specify the parameter multiple times. For example, `?expandAgent=clients&expandAgent=tasks`. This parameter offers flexibility for users to customize the expansion of specific resources related to the agent. (optional) + include_deleted = False # bool | When requesting entities, set to `true` if you want to see deleted entities. (optional) try: # Filter endpoint agents @@ -400,8 +400,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.endpoint_agents.EndpointAgentsApi(api_client) agent_id = 'agent_id_example' # str | The identifier of the agent to operate on. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] # List[ExpandEndpointAgentOptions] | This optional parameter allows you to control the expansion of test resources associated with the agent. By default, no expansion occurs when this query parameter is omitted. To expand the \"clients\" resource, include the query parameter `?expand=clients`. For multiple expansions, you have two options: * Separate the values with commas. For example, `?expandAgent=clients,tasks`. * Specify the parameter multiple times. For example, `?expandAgent=clients&expandAgent=tasks`. This parameter offers flexibility for users to customize the expansion of specific resources related to the agent. (optional) - include_deleted = false # bool | When requesting entities, set to `true` if you want to see deleted entities. (optional) + expand = # List[ExpandEndpointAgentOptions] | This optional parameter allows you to control the expansion of test resources associated with the agent. By default, no expansion occurs when this query parameter is omitted. To expand the \"clients\" resource, include the query parameter `?expand=clients`. For multiple expansions, you have two options: * Separate the values with commas. For example, `?expandAgent=clients,tasks`. * Specify the parameter multiple times. For example, `?expandAgent=clients&expandAgent=tasks`. This parameter offers flexibility for users to customize the expansion of specific resources related to the agent. (optional) + include_deleted = False # bool | When requesting entities, set to `true` if you want to see deleted entities. (optional) try: # Retrieve endpoint agent @@ -490,8 +490,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: max = 5 # int | (Optional) Maximum number of objects to return. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] # List[ExpandEndpointAgentOptions] | This optional parameter allows you to control the expansion of test resources associated with the agent. By default, no expansion occurs when this query parameter is omitted. To expand the \"clients\" resource, include the query parameter `?expand=clients`. For multiple expansions, you have two options: * Separate the values with commas. For example, `?expandAgent=clients,tasks`. * Specify the parameter multiple times. For example, `?expandAgent=clients&expandAgent=tasks`. This parameter offers flexibility for users to customize the expansion of specific resources related to the agent. (optional) - include_deleted = false # bool | When requesting entities, set to `true` if you want to see deleted entities. (optional) + expand = # List[ExpandEndpointAgentOptions] | This optional parameter allows you to control the expansion of test resources associated with the agent. By default, no expansion occurs when this query parameter is omitted. To expand the \"clients\" resource, include the query parameter `?expand=clients`. For multiple expansions, you have two options: * Separate the values with commas. For example, `?expandAgent=clients,tasks`. * Specify the parameter multiple times. For example, `?expandAgent=clients&expandAgent=tasks`. This parameter offers flexibility for users to customize the expansion of specific resources related to the agent. (optional) + include_deleted = False # bool | When requesting entities, set to `true` if you want to see deleted entities. (optional) use_all_permitted_aids = False # bool | Set to `true` to load data from all accounts the user has access to. (optional) (default to False) agent_name = 'agent_name_example' # str | Returns only agents with the specified name. This is an exact match only. (optional) computer_name = 'computer_name_example' # str | Returns only agents with the specified computer name. This is an exact match only. (optional) @@ -665,8 +665,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.endpoint_agents.EndpointAgentsApi(api_client) agent_id = 'agent_id_example' # str | The identifier of the agent to operate on. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()] # List[ExpandEndpointAgentOptions] | This optional parameter allows you to control the expansion of test resources associated with the agent. By default, no expansion occurs when this query parameter is omitted. To expand the \"clients\" resource, include the query parameter `?expand=clients`. For multiple expansions, you have two options: * Separate the values with commas. For example, `?expandAgent=clients,tasks`. * Specify the parameter multiple times. For example, `?expandAgent=clients&expandAgent=tasks`. This parameter offers flexibility for users to customize the expansion of specific resources related to the agent. (optional) - endpoint_agent_update = thousandeyes_sdk.endpoint_agents.EndpointAgentUpdate() # EndpointAgentUpdate | Fields to modify on the agent (optional) + expand = # List[ExpandEndpointAgentOptions] | This optional parameter allows you to control the expansion of test resources associated with the agent. By default, no expansion occurs when this query parameter is omitted. To expand the \"clients\" resource, include the query parameter `?expand=clients`. For multiple expansions, you have two options: * Separate the values with commas. For example, `?expandAgent=clients,tasks`. * Specify the parameter multiple times. For example, `?expandAgent=clients&expandAgent=tasks`. This parameter offers flexibility for users to customize the expansion of specific resources related to the agent. (optional) + endpoint_agent_update = # EndpointAgentUpdate | Fields to modify on the agent (optional) try: # Update endpoint agent diff --git a/thousandeyes-sdk-endpoint-agents/docs/EndpointAgentsTransferApi.md b/thousandeyes-sdk-endpoint-agents/docs/EndpointAgentsTransferApi.md index 563ad6b8a..2fd3fdd88 100644 --- a/thousandeyes-sdk-endpoint-agents/docs/EndpointAgentsTransferApi.md +++ b/thousandeyes-sdk-endpoint-agents/docs/EndpointAgentsTransferApi.md @@ -46,7 +46,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_agents.EndpointAgentsTransferApi(api_client) agent_id = 'agent_id_example' # str | The identifier of the agent to operate on. - agent_transfer_request = thousandeyes_sdk.endpoint_agents.AgentTransferRequest() # AgentTransferRequest | The request to move an agent between accounts. + agent_transfer_request = # AgentTransferRequest | The request to move an agent between accounts. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -131,7 +131,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_agents.EndpointAgentsTransferApi(api_client) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - bulk_agent_transfer_request = thousandeyes_sdk.endpoint_agents.BulkAgentTransferRequest() # BulkAgentTransferRequest | A collection of `AgentTransfers`. (optional) + bulk_agent_transfer_request = # BulkAgentTransferRequest | A collection of `AgentTransfers`. (optional) try: # Bulk transfer agents diff --git a/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/models/agent_search_filters.py b/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/models/agent_search_filters.py index 1c9d74ac4..4bc8c4b0c 100644 --- a/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/models/agent_search_filters.py +++ b/thousandeyes-sdk-endpoint-agents/src/thousandeyes_sdk/endpoint_agents/models/agent_search_filters.py @@ -35,13 +35,15 @@ class AgentSearchFilters(BaseModel): user_principal_name: Optional[List[StrictStr]] = Field(default=None, description="Returns only agents that have at least one user principal name, starting with one of the provided strings. This is a case-insensitive prefix match. User principle name is the user login name in an Internet-style format, typically used in Active Directory environments. ", alias="userPrincipalName") platform: Optional[List[Platform]] = Field(default=None, description="Filter on the platform on which the agent is running. ") os_version: Optional[List[StrictStr]] = Field(default=None, description="Case-insensitive prefix filter on the OS version.", alias="osVersion") + nic_model: Optional[List[StrictStr]] = Field(default=None, description="Returns only agents whose NIC model is an exact, case-sensitive match for one of the provided values.", alias="nicModel") + nic_driver_version: Optional[List[StrictStr]] = Field(default=None, description="Returns only agents whose NIC driver version is an exact, case-sensitive match for one of the provided values.", alias="nicDriverVersion") serial_number: Optional[Annotated[List[StrictStr], Field(max_length=50)]] = Field(default=None, description="Case-insensitive prefix filter on the serial number.", alias="serialNumber") location_country_iso: Optional[List[StrictStr]] = Field(default=None, description="Filter using the ISO country code of the location. ", alias="locationCountryISO") location_subdivision1_code: Optional[List[StrictStr]] = Field(default=None, description="Filter using the code for the first level administrative division within the country. In US/Canada this is the State, in UK it's the country e.g. `ENG` ", alias="locationSubdivision1Code") location_city: Optional[List[StrictStr]] = Field(default=None, description="This is a prefix match on the city name field. The endpoint expects this to contain the name of the city in English. e.g. 'Paris' or '' ", alias="locationCity") license_type: Optional[List[AgentLicenseType]] = Field(default=None, description="Filter on the agent's license type ", alias="licenseType") any_connect_device_id: Optional[List[StrictStr]] = Field(default=None, description="IDs of devices that has the Cisco Secure Client deployed with the Internet Security module. Returns only agents that have at least one matching `anyConnectDeviceId`. ", alias="anyConnectDeviceId") - __properties: ClassVar[List[str]] = ["id", "agentName", "computerName", "username", "userPrincipalName", "platform", "osVersion", "serialNumber", "locationCountryISO", "locationSubdivision1Code", "locationCity", "licenseType", "anyConnectDeviceId"] + __properties: ClassVar[List[str]] = ["id", "agentName", "computerName", "username", "userPrincipalName", "platform", "osVersion", "nicModel", "nicDriverVersion", "serialNumber", "locationCountryISO", "locationSubdivision1Code", "locationCity", "licenseType", "anyConnectDeviceId"] model_config = ConfigDict( populate_by_name=True, @@ -102,6 +104,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "userPrincipalName": obj.get("userPrincipalName"), "platform": obj.get("platform"), "osVersion": obj.get("osVersion"), + "nicModel": obj.get("nicModel"), + "nicDriverVersion": obj.get("nicDriverVersion"), "serialNumber": obj.get("serialNumber"), "locationCountryISO": obj.get("locationCountryISO"), "locationSubdivision1Code": obj.get("locationSubdivision1Code"), diff --git a/thousandeyes-sdk-endpoint-agents/test/conftest.py b/thousandeyes-sdk-endpoint-agents/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..494f96421 --- /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 000000000..a40bfd249 --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/mock_manifest.py @@ -0,0 +1,2516 @@ +# 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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "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" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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 000000000..d48de4505 --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py @@ -0,0 +1,421 @@ +# 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.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api.py index bbbc2b6fc..c910421a2 100644 --- a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api.py +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api.py @@ -427,11 +427,13 @@ def test_filter_endpoint_agents_models_validation(self) -> None: "agentName" : [ "myagent-1234", "myagent-1234" ], "locationSubdivision1Code" : [ "ENG", "ENG" ], "platform" : [ "mac", "mac" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], "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" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], "userPrincipalName" : [ "picard@c.com" ], "locationCity" : [ "Paris", "Paris" ], "username" : [ "picard" ] 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 000000000..9dcbd02e4 --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py @@ -0,0 +1,2884 @@ +# 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' + response = self.api.delete_endpoint_agent_with_http_info( + + agent_id=agent_id, + + aid=aid, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "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" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + 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, + + 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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "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" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + 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, + + 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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "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" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + 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, + + 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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "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" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + 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, + + 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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "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" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + 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, + + 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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + 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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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 000000000..7203b7007 --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_transfer_api_integration.py @@ -0,0 +1,318 @@ +# 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 000000000..b1afd0b03 --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_proxies_api_integration.py @@ -0,0 +1,176 @@ +# 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-agents/test/test_utils.py b/thousandeyes-sdk-endpoint-agents/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-instant-tests/.openapi-generator/FILES index 16b3c390e..128c9d242 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/.openapi-generator/FILES +++ b/thousandeyes-sdk-endpoint-instant-tests/.openapi-generator/FILES @@ -74,7 +74,13 @@ src/thousandeyes_sdk/endpoint_instant_tests/models/validation_error.py src/thousandeyes_sdk/endpoint_instant_tests/models/validation_error_item.py src/thousandeyes_sdk/endpoint_instant_tests/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_agent_to_server_endpoint_instant_scheduled_tests_api.py +test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py test/test_http_server_endpoint_instant_scheduled_tests_api.py +test/test_http_server_endpoint_instant_scheduled_tests_api_integration.py test/test_run_endpoint_instant_scheduled_tests_api.py +test/test_run_endpoint_instant_scheduled_tests_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-endpoint-instant-tests/README.md b/thousandeyes-sdk-endpoint-instant-tests/README.md index 3319bba82..577d65fb8 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/README.md +++ b/thousandeyes-sdk-endpoint-instant-tests/README.md @@ -12,7 +12,7 @@ The URLs for these API test data endpoints are provided within the test definiti This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -85,7 +85,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_instant_tests.AgentToServerEndpointInstantScheduledTestsApi(api_client) - endpoint_agent_to_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.EndpointAgentToServerInstantTest() # EndpointAgentToServerInstantTest | + endpoint_agent_to_server_instant_test = # EndpointAgentToServerInstantTest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-endpoint-instant-tests/docs/AgentToServerEndpointInstantScheduledTestsApi.md b/thousandeyes-sdk-endpoint-instant-tests/docs/AgentToServerEndpointInstantScheduledTestsApi.md index 053789494..cecacb9b8 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/docs/AgentToServerEndpointInstantScheduledTestsApi.md +++ b/thousandeyes-sdk-endpoint-instant-tests/docs/AgentToServerEndpointInstantScheduledTestsApi.md @@ -45,7 +45,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_instant_tests.AgentToServerEndpointInstantScheduledTestsApi(api_client) - endpoint_agent_to_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.EndpointAgentToServerInstantTest() # EndpointAgentToServerInstantTest | + endpoint_agent_to_server_instant_test = # EndpointAgentToServerInstantTest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-endpoint-instant-tests/docs/HTTPServerEndpointInstantScheduledTestsApi.md b/thousandeyes-sdk-endpoint-instant-tests/docs/HTTPServerEndpointInstantScheduledTestsApi.md index bb3ce1aa1..a733568b3 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/docs/HTTPServerEndpointInstantScheduledTestsApi.md +++ b/thousandeyes-sdk-endpoint-instant-tests/docs/HTTPServerEndpointInstantScheduledTestsApi.md @@ -45,7 +45,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_instant_tests.HTTPServerEndpointInstantScheduledTestsApi(api_client) - endpoint_http_server_instant_test = thousandeyes_sdk.endpoint_instant_tests.EndpointHttpServerInstantTest() # EndpointHttpServerInstantTest | + endpoint_http_server_instant_test = # EndpointHttpServerInstantTest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: 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 000000000..2edba7b32 --- /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 000000000..fe6515fb4 --- /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 000000000..dffd14385 --- /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 000000000..9f16a4ce1 --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py @@ -0,0 +1,390 @@ +# 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 000000000..5a328fba4 --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/test_http_server_endpoint_instant_scheduled_tests_api_integration.py @@ -0,0 +1,478 @@ +# 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 000000000..afb8fb888 --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/test_run_endpoint_instant_scheduled_tests_api_integration.py @@ -0,0 +1,260 @@ +# 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-instant-tests/test/test_utils.py b/thousandeyes-sdk-endpoint-instant-tests/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-labels/.openapi-generator/FILES index f52a61d0f..91c48b731 100644 --- a/thousandeyes-sdk-endpoint-labels/.openapi-generator/FILES +++ b/thousandeyes-sdk-endpoint-labels/.openapi-generator/FILES @@ -42,5 +42,9 @@ src/thousandeyes_sdk/endpoint_labels/models/validation_error.py src/thousandeyes_sdk/endpoint_labels/models/validation_error_item.py src/thousandeyes_sdk/endpoint_labels/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_endpoint_agent_labels_api.py +test/test_endpoint_agent_labels_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-endpoint-labels/README.md b/thousandeyes-sdk-endpoint-labels/README.md index 7db048abe..69f5e1260 100644 --- a/thousandeyes-sdk-endpoint-labels/README.md +++ b/thousandeyes-sdk-endpoint-labels/README.md @@ -4,7 +4,7 @@ Manage labels applied to endpoint agents using this API. This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -78,7 +78,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_labels.EndpointAgentLabelsApi(api_client) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - label_request = thousandeyes_sdk.endpoint_labels.LabelRequest() # LabelRequest | Label settings (optional) + label_request = # LabelRequest | Label settings (optional) try: # Create label diff --git a/thousandeyes-sdk-endpoint-labels/docs/EndpointAgentLabelsApi.md b/thousandeyes-sdk-endpoint-labels/docs/EndpointAgentLabelsApi.md index 0b1da4da5..0711e1497 100644 --- a/thousandeyes-sdk-endpoint-labels/docs/EndpointAgentLabelsApi.md +++ b/thousandeyes-sdk-endpoint-labels/docs/EndpointAgentLabelsApi.md @@ -50,7 +50,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_labels.EndpointAgentLabelsApi(api_client) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - label_request = thousandeyes_sdk.endpoint_labels.LabelRequest() # LabelRequest | Label settings (optional) + label_request = # LabelRequest | Label settings (optional) try: # Create label @@ -216,7 +216,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_labels.EndpointAgentLabelsApi(api_client) id = 'id_example' # str | The unique identifier of the label to operate on. - expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] # List[ExpandLabelOptions] | This parameter is optional and determines whether to include additional details in the response. To specify multiple expansions, you can either separate the values with commas or specify the parameter multiple times. (optional) + expand = # List[ExpandLabelOptions] | This parameter is optional and determines whether to include additional details in the response. To specify multiple expansions, you can either separate the values with commas or specify the parameter multiple times. (optional) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -304,7 +304,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.endpoint_labels.EndpointAgentLabelsApi(api_client) max = 5 # int | (Optional) Maximum number of objects to return. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - expand = [thousandeyes_sdk.endpoint_labels.ExpandLabelOptions()] # List[ExpandLabelOptions] | This parameter is optional and determines whether to include additional details in the response. To specify multiple expansions, you can either separate the values with commas or specify the parameter multiple times. (optional) + expand = # List[ExpandLabelOptions] | This parameter is optional and determines whether to include additional details in the response. To specify multiple expansions, you can either separate the values with commas or specify the parameter multiple times. (optional) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -392,7 +392,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.endpoint_labels.EndpointAgentLabelsApi(api_client) id = 'id_example' # str | The unique identifier of the label to operate on. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - label = thousandeyes_sdk.endpoint_labels.Label() # Label | Fields to change on the agent (optional) + label = # Label | Fields to change on the agent (optional) try: # Update label diff --git a/thousandeyes-sdk-endpoint-labels/test/conftest.py b/thousandeyes-sdk-endpoint-labels/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..19d6418cb --- /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 000000000..0174c17a5 --- /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 000000000..ed40b1b10 --- /dev/null +++ b/thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py @@ -0,0 +1,1093 @@ +# 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' + 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, + + 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' + 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, + + 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' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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' + 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, + + 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' + 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, + + 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' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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-labels/test/test_utils.py b/thousandeyes-sdk-endpoint-labels/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-test-results/.openapi-generator/FILES index 7dc3f49dc..1f08e383b 100644 --- a/thousandeyes-sdk-endpoint-test-results/.openapi-generator/FILES +++ b/thousandeyes-sdk-endpoint-test-results/.openapi-generator/FILES @@ -338,9 +338,17 @@ src/thousandeyes_sdk/endpoint_test_results/models/vpn_traceroute.py src/thousandeyes_sdk/endpoint_test_results/models/vpn_type.py src/thousandeyes_sdk/endpoint_test_results/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_http_server_endpoint_scheduled_test_results_api.py +test/test_http_server_endpoint_scheduled_test_results_api_integration.py test/test_local_network_endpoint_test_results_api.py +test/test_local_network_endpoint_test_results_api_integration.py test/test_network_dynamic_endpoint_test_results_api.py +test/test_network_dynamic_endpoint_test_results_api_integration.py test/test_network_endpoint_scheduled_test_results_api.py +test/test_network_endpoint_scheduled_test_results_api_integration.py test/test_real_user_endpoint_test_results_api.py +test/test_real_user_endpoint_test_results_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-endpoint-test-results/README.md b/thousandeyes-sdk-endpoint-test-results/README.md index 9295d4282..cc9e3a03e 100644 --- a/thousandeyes-sdk-endpoint-test-results/README.md +++ b/thousandeyes-sdk-endpoint-test-results/README.md @@ -3,7 +3,7 @@ Retrieve results for scheduled and dynamic tests on endpoint agents. This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -82,7 +82,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] # List[ExpandEndpointHttpServerOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"header,\" append `?expand=header` to the query. (optional) + expand = # List[ExpandEndpointHttpServerOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"header,\" append `?expand=header` to the query. (optional) try: # Retrieve HTTP server scheduled test results diff --git a/thousandeyes-sdk-endpoint-test-results/docs/DynamicEndpointTestsDataSearchFilter.md b/thousandeyes-sdk-endpoint-test-results/docs/DynamicEndpointTestsDataSearchFilter.md index b0909c798..df3f7713d 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/DynamicEndpointTestsDataSearchFilter.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/DynamicEndpointTestsDataSearchFilter.md @@ -7,6 +7,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **agent_id** | **List[str]** | Filter using the `agent-id`. | [optional] **user_principal_name** | **List[str]** | Filters results based on an array of `userPrincipalName` values. | [optional] +**nic_model** | **List[str]** | Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive. | [optional] +**nic_driver_version** | **List[str]** | Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive. | [optional] **webex_conference_id** | **List[str]** | Filter using the `conference-id` of the Webex call. | [optional] **webex_correlation_id** | **List[str]** | Filter using the `correlation-id` of the Webex call. | [optional] **webex_local_sip_session_id** | **List[str]** | Filter using the `local-sip-session-id` of the Webex call. | [optional] diff --git a/thousandeyes-sdk-endpoint-test-results/docs/EndpointNetworkTopologyResultRequestFilter.md b/thousandeyes-sdk-endpoint-test-results/docs/EndpointNetworkTopologyResultRequestFilter.md index e0c16ddf1..1beaa8c8d 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/EndpointNetworkTopologyResultRequestFilter.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/EndpointNetworkTopologyResultRequestFilter.md @@ -15,6 +15,8 @@ Name | Type | Description | Notes **network_id** | **List[str]** | Network ID. | [optional] **ssid** | **List[str]** | WiFi SSID. | [optional] **bssid** | **List[str]** | WiFi BSSID. | [optional] +**nic_model** | **List[str]** | Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive. | [optional] +**nic_driver_version** | **List[str]** | Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive. | [optional] **type** | [**List[NetworkTopologyType]**](NetworkTopologyType.md) | Web site base domain visited during the session. | [optional] ## Example diff --git a/thousandeyes-sdk-endpoint-test-results/docs/EndpointResultRequestFilter.md b/thousandeyes-sdk-endpoint-test-results/docs/EndpointResultRequestFilter.md index 4dd2dd23e..51103a049 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/EndpointResultRequestFilter.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/EndpointResultRequestFilter.md @@ -15,6 +15,8 @@ Name | Type | Description | Notes **network_id** | **List[str]** | Network ID. | [optional] **ssid** | **List[str]** | WiFi SSID. | [optional] **bssid** | **List[str]** | WiFi BSSID. | [optional] +**nic_model** | **List[str]** | Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive. | [optional] +**nic_driver_version** | **List[str]** | Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive. | [optional] ## Example diff --git a/thousandeyes-sdk-endpoint-test-results/docs/EndpointTestsDataSearchFilter.md b/thousandeyes-sdk-endpoint-test-results/docs/EndpointTestsDataSearchFilter.md index 91385be13..3ef899f60 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/EndpointTestsDataSearchFilter.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/EndpointTestsDataSearchFilter.md @@ -7,6 +7,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **agent_id** | **List[str]** | Filter using the `agent-id`. | [optional] **user_principal_name** | **List[str]** | Filters results based on an array of `userPrincipalName` values. | [optional] +**nic_model** | **List[str]** | Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive. | [optional] +**nic_driver_version** | **List[str]** | Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive. | [optional] ## Example diff --git a/thousandeyes-sdk-endpoint-test-results/docs/HTTPServerEndpointScheduledTestResultsApi.md b/thousandeyes-sdk-endpoint-test-results/docs/HTTPServerEndpointScheduledTestResultsApi.md index 7bfe8d685..25cd6375b 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/HTTPServerEndpointScheduledTestResultsApi.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/HTTPServerEndpointScheduledTestResultsApi.md @@ -53,7 +53,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] # List[ExpandEndpointHttpServerOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"header,\" append `?expand=header` to the query. (optional) + expand = # List[ExpandEndpointHttpServerOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"header,\" append `?expand=header` to the query. (optional) try: # Retrieve HTTP server scheduled test results @@ -151,8 +151,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) use_all_permitted_aids = False # bool | Set to `true` to load data from all accounts the user has access to. (optional) (default to False) - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] # List[ExpandEndpointHttpServerOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"header,\" append `?expand=header` to the query. (optional) - http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.HttpEndpointTestsDataRoundsSearch() # HttpEndpointTestsDataRoundsSearch | Test data search filters. (optional) + expand = # List[ExpandEndpointHttpServerOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"header,\" append `?expand=header` to the query. (optional) + http_endpoint_tests_data_rounds_search = # HttpEndpointTestsDataRoundsSearch | Test data search filters. (optional) try: # Filter HTTP server scheduled test results @@ -252,8 +252,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointHttpServerOptions()] # List[ExpandEndpointHttpServerOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"header,\" append `?expand=header` to the query. (optional) - http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.HttpEndpointTestsDataRoundsSearch() # HttpEndpointTestsDataRoundsSearch | Test result search filters. (optional) + expand = # List[ExpandEndpointHttpServerOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"header,\" append `?expand=header` to the query. (optional) + http_endpoint_tests_data_rounds_search = # HttpEndpointTestsDataRoundsSearch | Test result search filters. (optional) try: # Filter HTTP server result for a scheduled test diff --git a/thousandeyes-sdk-endpoint-test-results/docs/HttpEndpointTestsDataSearchFilter.md b/thousandeyes-sdk-endpoint-test-results/docs/HttpEndpointTestsDataSearchFilter.md index ba861fc58..b43948630 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/HttpEndpointTestsDataSearchFilter.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/HttpEndpointTestsDataSearchFilter.md @@ -8,6 +8,8 @@ Name | Type | Description | Notes **test_id** | **List[str]** | Filter by test | [optional] **agent_id** | **List[str]** | Filter using the `agent-id`. | [optional] **user_principal_name** | **List[str]** | Filters results based on an array of `userPrincipalName` values. | [optional] +**nic_model** | **List[str]** | Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive. | [optional] +**nic_driver_version** | **List[str]** | Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive. | [optional] ## Example diff --git a/thousandeyes-sdk-endpoint-test-results/docs/LocalNetworkEndpointTestResultsApi.md b/thousandeyes-sdk-endpoint-test-results/docs/LocalNetworkEndpointTestResultsApi.md index e323333fb..ef8171dfb 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/LocalNetworkEndpointTestResultsApi.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/LocalNetworkEndpointTestResultsApi.md @@ -53,8 +53,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] # List[ExpandLocalNetworkTopologyOptions] | This parameter is optional and determines whether to expand resources related to local network topologies. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as `systemMetricDetails`, append `?expand=system-metric-detail` to the query. (optional) - endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.EndpointNetworkTopologyResultRequest() # EndpointNetworkTopologyResultRequest | (optional) + expand = # List[ExpandLocalNetworkTopologyOptions] | This parameter is optional and determines whether to expand resources related to local network topologies. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as `systemMetricDetails`, append `?expand=system-metric-detail` to the query. (optional) + endpoint_network_topology_result_request = # EndpointNetworkTopologyResultRequest | (optional) try: # List endpoint network topologies probes @@ -232,7 +232,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.endpoint_test_results.LocalNetworkEndpointTestResultsApi(api_client) network_topology_id = '00160:39c518560de9:1491651900:236e6f18' # str | The network topology ID. aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.endpoint_test_results.ExpandLocalNetworkTopologyOptions()] # List[ExpandLocalNetworkTopologyOptions] | This parameter is optional and determines whether to expand resources related to local network topologies. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as `systemMetricDetails`, append `?expand=system-metric-detail` to the query. (optional) + expand = # List[ExpandLocalNetworkTopologyOptions] | This parameter is optional and determines whether to expand resources related to local network topologies. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as `systemMetricDetails`, append `?expand=system-metric-detail` to the query. (optional) try: # Retrieve endpoint local network topology diff --git a/thousandeyes-sdk-endpoint-test-results/docs/MultiTestIdEndpointTestsDataSearchFilter.md b/thousandeyes-sdk-endpoint-test-results/docs/MultiTestIdEndpointTestsDataSearchFilter.md index 30c45d270..4dec46d7f 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/MultiTestIdEndpointTestsDataSearchFilter.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/MultiTestIdEndpointTestsDataSearchFilter.md @@ -7,6 +7,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **agent_id** | **List[str]** | Filter using the `agent-id`. | [optional] **test_id** | **List[str]** | | [optional] +**nic_model** | **List[str]** | Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive. | [optional] +**nic_driver_version** | **List[str]** | Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive. | [optional] ## Example diff --git a/thousandeyes-sdk-endpoint-test-results/docs/NetworkDynamicEndpointTestResultsApi.md b/thousandeyes-sdk-endpoint-test-results/docs/NetworkDynamicEndpointTestResultsApi.md index 5aeb2256c..be13b54af 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/NetworkDynamicEndpointTestResultsApi.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/NetworkDynamicEndpointTestResultsApi.md @@ -54,8 +54,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointDynamicNetworkOptions()] # List[ExpandEndpointDynamicNetworkOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"user-profile,\" append `?expand=user-profile` to the query. (optional) - dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.DynamicEndpointTestsDataRoundSearch() # DynamicEndpointTestsDataRoundSearch | Tests data search filters. (optional) + expand = # List[ExpandEndpointDynamicNetworkOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"user-profile,\" append `?expand=user-profile` to the query. (optional) + dynamic_endpoint_tests_data_round_search = # DynamicEndpointTestsDataRoundSearch | Tests data search filters. (optional) try: # Retrieve network dynamic test results diff --git a/thousandeyes-sdk-endpoint-test-results/docs/NetworkEndpointScheduledTestResultsApi.md b/thousandeyes-sdk-endpoint-test-results/docs/NetworkEndpointScheduledTestResultsApi.md index 9757346b3..391657453 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/NetworkEndpointScheduledTestResultsApi.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/NetworkEndpointScheduledTestResultsApi.md @@ -55,8 +55,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] # List[ExpandEndpointNetworkOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"user-profile,\" append `?expand=user-profile` to the query. (optional) - endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.EndpointTestsDataRoundsSearch() # EndpointTestsDataRoundsSearch | Tests data search filters. (optional) + expand = # List[ExpandEndpointNetworkOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"user-profile,\" append `?expand=user-profile` to the query. (optional) + endpoint_tests_data_rounds_search = # EndpointTestsDataRoundsSearch | Tests data search filters. (optional) try: # Retrieve network scheduled test results @@ -156,8 +156,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: max = 5 # int | (Optional) Maximum number of objects to return. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) use_all_permitted_aids = False # bool | Set to `true` to load data from all accounts the user has access to. (optional) (default to False) - expand = [thousandeyes_sdk.endpoint_test_results.ExpandEndpointNetworkOptions()] # List[ExpandEndpointNetworkOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"user-profile,\" append `?expand=user-profile` to the query. (optional) - multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.MultiTestIdEndpointTestsDataRoundsSearch() # MultiTestIdEndpointTestsDataRoundsSearch | Test data search filters. (optional) + expand = # List[ExpandEndpointNetworkOptions] | This parameter is optional and determines whether to expand resources related to test results. By default, no expansion occurs when this query parameter is omitted. To expand a specific resource, such as \"user-profile,\" append `?expand=user-profile` to the query. (optional) + multi_test_id_endpoint_tests_data_rounds_search = # MultiTestIdEndpointTestsDataRoundsSearch | Test data search filters. (optional) try: # Retrieve network scheduled test results from multiple tests diff --git a/thousandeyes-sdk-endpoint-test-results/docs/RealUserEndpointTestResultRequestFilter.md b/thousandeyes-sdk-endpoint-test-results/docs/RealUserEndpointTestResultRequestFilter.md index 818ba29ac..7819eb2d4 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/RealUserEndpointTestResultRequestFilter.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/RealUserEndpointTestResultRequestFilter.md @@ -15,6 +15,8 @@ Name | Type | Description | Notes **network_id** | **List[str]** | Network ID. | [optional] **ssid** | **List[str]** | WiFi SSID. | [optional] **bssid** | **List[str]** | WiFi BSSID. | [optional] +**nic_model** | **List[str]** | Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive. | [optional] +**nic_driver_version** | **List[str]** | Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive. | [optional] **destination_ip** | **List[str]** | Web site destination IP address. | [optional] **domain** | **List[str]** | Web site base domain visited during the session. | [optional] **trigger** | [**List[Trigger]**](Trigger.md) | Real user test trigger. | [optional] diff --git a/thousandeyes-sdk-endpoint-test-results/docs/RealUserEndpointTestResultsApi.md b/thousandeyes-sdk-endpoint-test-results/docs/RealUserEndpointTestResultsApi.md index 40c3c3eea..3f2d526dc 100644 --- a/thousandeyes-sdk-endpoint-test-results/docs/RealUserEndpointTestResultsApi.md +++ b/thousandeyes-sdk-endpoint-test-results/docs/RealUserEndpointTestResultsApi.md @@ -54,7 +54,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.RealUserEndpointTestResultsRequest() # RealUserEndpointTestResultsRequest | (optional) + real_user_endpoint_test_results_request = # RealUserEndpointTestResultsRequest | (optional) try: # List endpoint real user tests networks @@ -150,7 +150,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.RealUserEndpointTestResultsRequest() # RealUserEndpointTestResultsRequest | (optional) + real_user_endpoint_test_results_request = # RealUserEndpointTestResultsRequest | (optional) try: # List endpoint real user tests @@ -246,7 +246,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.RealUserEndpointTestResultRequestFilter() # RealUserEndpointTestResultRequestFilter | (optional) + real_user_endpoint_test_result_request_filter = # RealUserEndpointTestResultRequestFilter | (optional) try: # List endpoint real user tests visited pages diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/dynamic_endpoint_tests_data_search_filter.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/dynamic_endpoint_tests_data_search_filter.py index 78f1815d2..70f2daf0a 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/dynamic_endpoint_tests_data_search_filter.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/dynamic_endpoint_tests_data_search_filter.py @@ -27,10 +27,12 @@ class DynamicEndpointTestsDataSearchFilter(BaseModel): """ # noqa: E501 agent_id: Optional[List[StrictStr]] = Field(default=None, description="Filter using the `agent-id`.", alias="agentId") user_principal_name: Optional[List[StrictStr]] = Field(default=None, description="Filters results based on an array of `userPrincipalName` values.", alias="userPrincipalName") + nic_model: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive.", alias="nicModel") + nic_driver_version: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive.", alias="nicDriverVersion") webex_conference_id: Optional[List[StrictStr]] = Field(default=None, description="Filter using the `conference-id` of the Webex call.", alias="webexConferenceId") webex_correlation_id: Optional[List[StrictStr]] = Field(default=None, description="Filter using the `correlation-id` of the Webex call.", alias="webexCorrelationId") webex_local_sip_session_id: Optional[List[StrictStr]] = Field(default=None, description="Filter using the `local-sip-session-id` of the Webex call.", alias="webexLocalSipSessionId") - __properties: ClassVar[List[str]] = ["agentId", "userPrincipalName", "webexConferenceId", "webexCorrelationId", "webexLocalSipSessionId"] + __properties: ClassVar[List[str]] = ["agentId", "userPrincipalName", "nicModel", "nicDriverVersion", "webexConferenceId", "webexCorrelationId", "webexLocalSipSessionId"] model_config = ConfigDict( populate_by_name=True, @@ -86,6 +88,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "agentId": obj.get("agentId"), "userPrincipalName": obj.get("userPrincipalName"), + "nicModel": obj.get("nicModel"), + "nicDriverVersion": obj.get("nicDriverVersion"), "webexConferenceId": obj.get("webexConferenceId"), "webexCorrelationId": obj.get("webexCorrelationId"), "webexLocalSipSessionId": obj.get("webexLocalSipSessionId") diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_network_topology_result_request_filter.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_network_topology_result_request_filter.py index 331249430..075158fa2 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_network_topology_result_request_filter.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_network_topology_result_request_filter.py @@ -38,8 +38,10 @@ class EndpointNetworkTopologyResultRequestFilter(BaseModel): network_id: Optional[List[StrictStr]] = Field(default=None, description="Network ID.", alias="networkId") ssid: Optional[List[StrictStr]] = Field(default=None, description="WiFi SSID.") bssid: Optional[List[StrictStr]] = Field(default=None, description="WiFi BSSID.") + nic_model: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive.", alias="nicModel") + nic_driver_version: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive.", alias="nicDriverVersion") type: Optional[List[NetworkTopologyType]] = Field(default=None, description="Web site base domain visited during the session.") - __properties: ClassVar[List[str]] = ["location", "connection", "platform", "gateway", "proxyTarget", "vpnTarget", "agentId", "networkId", "ssid", "bssid", "type"] + __properties: ClassVar[List[str]] = ["location", "connection", "platform", "gateway", "proxyTarget", "vpnTarget", "agentId", "networkId", "ssid", "bssid", "nicModel", "nicDriverVersion", "type"] model_config = ConfigDict( populate_by_name=True, @@ -103,6 +105,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "networkId": obj.get("networkId"), "ssid": obj.get("ssid"), "bssid": obj.get("bssid"), + "nicModel": obj.get("nicModel"), + "nicDriverVersion": obj.get("nicDriverVersion"), "type": obj.get("type") }) return _obj diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_result_request_filter.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_result_request_filter.py index f146d6ba7..3e520ab08 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_result_request_filter.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_result_request_filter.py @@ -37,7 +37,9 @@ class EndpointResultRequestFilter(BaseModel): network_id: Optional[List[StrictStr]] = Field(default=None, description="Network ID.", alias="networkId") ssid: Optional[List[StrictStr]] = Field(default=None, description="WiFi SSID.") bssid: Optional[List[StrictStr]] = Field(default=None, description="WiFi BSSID.") - __properties: ClassVar[List[str]] = ["location", "connection", "platform", "gateway", "proxyTarget", "vpnTarget", "agentId", "networkId", "ssid", "bssid"] + nic_model: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive.", alias="nicModel") + nic_driver_version: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive.", alias="nicDriverVersion") + __properties: ClassVar[List[str]] = ["location", "connection", "platform", "gateway", "proxyTarget", "vpnTarget", "agentId", "networkId", "ssid", "bssid", "nicModel", "nicDriverVersion"] model_config = ConfigDict( populate_by_name=True, @@ -100,7 +102,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "agentId": obj.get("agentId"), "networkId": obj.get("networkId"), "ssid": obj.get("ssid"), - "bssid": obj.get("bssid") + "bssid": obj.get("bssid"), + "nicModel": obj.get("nicModel"), + "nicDriverVersion": obj.get("nicDriverVersion") }) return _obj diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_tests_data_search_filter.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_tests_data_search_filter.py index c890b67a1..5e8328a8f 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_tests_data_search_filter.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/endpoint_tests_data_search_filter.py @@ -27,7 +27,9 @@ class EndpointTestsDataSearchFilter(BaseModel): """ # noqa: E501 agent_id: Optional[List[StrictStr]] = Field(default=None, description="Filter using the `agent-id`.", alias="agentId") user_principal_name: Optional[List[StrictStr]] = Field(default=None, description="Filters results based on an array of `userPrincipalName` values.", alias="userPrincipalName") - __properties: ClassVar[List[str]] = ["agentId", "userPrincipalName"] + nic_model: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive.", alias="nicModel") + nic_driver_version: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive.", alias="nicDriverVersion") + __properties: ClassVar[List[str]] = ["agentId", "userPrincipalName", "nicModel", "nicDriverVersion"] model_config = ConfigDict( populate_by_name=True, @@ -82,7 +84,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "agentId": obj.get("agentId"), - "userPrincipalName": obj.get("userPrincipalName") + "userPrincipalName": obj.get("userPrincipalName"), + "nicModel": obj.get("nicModel"), + "nicDriverVersion": obj.get("nicDriverVersion") }) return _obj diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/http_endpoint_tests_data_search_filter.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/http_endpoint_tests_data_search_filter.py index 0983cf7ca..e6ef07787 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/http_endpoint_tests_data_search_filter.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/http_endpoint_tests_data_search_filter.py @@ -28,7 +28,9 @@ class HttpEndpointTestsDataSearchFilter(BaseModel): test_id: Optional[List[StrictStr]] = Field(default=None, description="Filter by test", alias="testId") agent_id: Optional[List[StrictStr]] = Field(default=None, description="Filter using the `agent-id`.", alias="agentId") user_principal_name: Optional[List[StrictStr]] = Field(default=None, description="Filters results based on an array of `userPrincipalName` values.", alias="userPrincipalName") - __properties: ClassVar[List[str]] = ["testId", "agentId", "userPrincipalName"] + nic_model: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive.", alias="nicModel") + nic_driver_version: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive.", alias="nicDriverVersion") + __properties: ClassVar[List[str]] = ["testId", "agentId", "userPrincipalName", "nicModel", "nicDriverVersion"] model_config = ConfigDict( populate_by_name=True, @@ -84,7 +86,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "testId": obj.get("testId"), "agentId": obj.get("agentId"), - "userPrincipalName": obj.get("userPrincipalName") + "userPrincipalName": obj.get("userPrincipalName"), + "nicModel": obj.get("nicModel"), + "nicDriverVersion": obj.get("nicDriverVersion") }) return _obj diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/multi_test_id_endpoint_tests_data_search_filter.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/multi_test_id_endpoint_tests_data_search_filter.py index e70191d26..bb7ee73c4 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/multi_test_id_endpoint_tests_data_search_filter.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/multi_test_id_endpoint_tests_data_search_filter.py @@ -27,7 +27,9 @@ class MultiTestIdEndpointTestsDataSearchFilter(BaseModel): """ # noqa: E501 agent_id: Optional[List[StrictStr]] = Field(default=None, description="Filter using the `agent-id`.", alias="agentId") test_id: Optional[List[StrictStr]] = Field(default=None, alias="testId") - __properties: ClassVar[List[str]] = ["agentId", "testId"] + nic_model: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive.", alias="nicModel") + nic_driver_version: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive.", alias="nicDriverVersion") + __properties: ClassVar[List[str]] = ["agentId", "testId", "nicModel", "nicDriverVersion"] model_config = ConfigDict( populate_by_name=True, @@ -82,7 +84,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "agentId": obj.get("agentId"), - "testId": obj.get("testId") + "testId": obj.get("testId"), + "nicModel": obj.get("nicModel"), + "nicDriverVersion": obj.get("nicDriverVersion") }) return _obj diff --git a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/real_user_endpoint_test_result_request_filter.py b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/real_user_endpoint_test_result_request_filter.py index 42ec71382..c315456c9 100644 --- a/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/real_user_endpoint_test_result_request_filter.py +++ b/thousandeyes-sdk-endpoint-test-results/src/thousandeyes_sdk/endpoint_test_results/models/real_user_endpoint_test_result_request_filter.py @@ -38,11 +38,13 @@ class RealUserEndpointTestResultRequestFilter(BaseModel): network_id: Optional[List[StrictStr]] = Field(default=None, description="Network ID.", alias="networkId") ssid: Optional[List[StrictStr]] = Field(default=None, description="WiFi SSID.") bssid: Optional[List[StrictStr]] = Field(default=None, description="WiFi BSSID.") + nic_model: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC models that exactly match one of the provided values. Matching is case-sensitive.", alias="nicModel") + nic_driver_version: Optional[List[StrictStr]] = Field(default=None, description="Filters results to NIC driver versions that exactly match one of the provided values. Matching is case-sensitive.", alias="nicDriverVersion") destination_ip: Optional[List[StrictStr]] = Field(default=None, description="Web site destination IP address.", alias="destinationIp") domain: Optional[List[StrictStr]] = Field(default=None, description="Web site base domain visited during the session.") trigger: Optional[List[Trigger]] = Field(default=None, description="Real user test trigger.") visited_site: Optional[List[StrictStr]] = Field(default=None, description="Web site domain visited during the session.", alias="visitedSite") - __properties: ClassVar[List[str]] = ["location", "connection", "platform", "gateway", "proxyTarget", "vpnTarget", "agentId", "networkId", "ssid", "bssid", "destinationIp", "domain", "trigger", "visitedSite"] + __properties: ClassVar[List[str]] = ["location", "connection", "platform", "gateway", "proxyTarget", "vpnTarget", "agentId", "networkId", "ssid", "bssid", "nicModel", "nicDriverVersion", "destinationIp", "domain", "trigger", "visitedSite"] model_config = ConfigDict( populate_by_name=True, @@ -106,6 +108,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "networkId": obj.get("networkId"), "ssid": obj.get("ssid"), "bssid": obj.get("bssid"), + "nicModel": obj.get("nicModel"), + "nicDriverVersion": obj.get("nicDriverVersion"), "destinationIp": obj.get("destinationIp"), "domain": obj.get("domain"), "trigger": obj.get("trigger"), 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 000000000..2edba7b32 --- /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 000000000..5565044a9 --- /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 000000000..494f9764f --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/mock_manifest.py @@ -0,0 +1,7530 @@ +# 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "gateway" : [ "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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ] + }, + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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.py b/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api.py index d5eea398b..516684ba3 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api.py @@ -395,8 +395,10 @@ def test_get_multi_test_filtered_http_server_scheduled_test_results_models_valid "order" : "desc" } ], "searchFilters" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] }, "thresholdFilter" : { @@ -722,8 +724,10 @@ def test_get_single_test_filtered_http_server_scheduled_test_results_models_vali "order" : "desc" } ], "searchFilters" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] }, "thresholdFilter" : { 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 000000000..b6425b452 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py @@ -0,0 +1,2418 @@ +# 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' + 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" : "" + }, { + "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" + } + """ + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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 + 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" : "" + }, { + "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" + } + """ + 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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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 + 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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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 + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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 + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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 + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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 + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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 + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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 + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + 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" : "" + }, { + "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" + } + """ + 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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + 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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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.py b/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api.py index d19b3c3ae..0bfee5f86 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api.py @@ -35,15 +35,17 @@ def test_filter_local_networks_test_results_topologies_models_validation(self) - "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" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], "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" ] + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] }, "thresholdFilter" : { "conditionalOperator" : "and", 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 000000000..0e3bfe50b --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py @@ -0,0 +1,1919 @@ +# 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" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "gateway" : [ "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' + 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, + + 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" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "gateway" : [ "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' + 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, + + 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" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "gateway" : [ "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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + 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" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "gateway" : [ "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "gateway" : [ "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "gateway" : [ "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "gateway" : [ "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "gateway" : [ "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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' + 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" : "" + }, { + "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" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_local_networks_test_results_topology( + + network_topology_id=network_topology_id, + + aid=aid, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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.py b/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api.py index 03f46b86b..0a516c72f 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api.py @@ -40,9 +40,11 @@ def test_filter_dynamic_test_network_results_models_validation(self) -> None: "order" : "desc" } ], "searchFilters" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] }, 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 000000000..097c743f0 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py @@ -0,0 +1,2307 @@ +# 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + 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" : "" + }, { + "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" + } + """ + 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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : "" + }, { + "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 + } ] + } + """ + 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" : "" + }, { + "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" + } + """ + 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.py b/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api.py index a4b79bb4a..bee8aaff0 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api.py @@ -40,7 +40,9 @@ def test_filter_scheduled_test_network_results_models_validation(self) -> None: "order" : "desc" } ], "searchFilters" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] }, "thresholdFilter" : { @@ -409,8 +411,10 @@ def test_filter_scheduled_tests_network_results_models_validation(self) -> None: "order" : "desc" } ], "searchFilters" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], - "testId" : [ "5", "5" ] + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ] }, "thresholdFilter" : { "conditionalOperator" : "and", 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 000000000..6aa98042f --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py @@ -0,0 +1,2987 @@ +# 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + 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" : "" + }, { + "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" + } + """ + 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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ] + }, + "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 + 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" : "" + }, { + "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" + } + """ + 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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ] + }, + "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 + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ] + }, + "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 + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ] + }, + "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 + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ] + }, + "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 + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ] + }, + "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 + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : { + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ] + }, + "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 + error_body_json = """ + { + "instance" : "instance", + "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, + + 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" : "" + }, { + "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 + } ] + } + """ + 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" : "" + }, { + "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" + } + """ + 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.py b/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api.py index ef90cec34..86e042120 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api.py @@ -41,11 +41,13 @@ def test_filter_real_user_tests_network_results_models_validation(self) -> None: "platform" : [ "mac", "mac" ], "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], "domain" : [ "thousandeyes.com" ], "location" : [ "San Francisco Bay Area", "Germany" ], "connection" : [ "wireless", "wireless" ], "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], "gateway" : [ "78.153.54.204", "78.153.54.206" ] } } @@ -179,11 +181,13 @@ def test_filter_real_user_tests_results_models_validation(self) -> None: "platform" : [ "mac", "mac" ], "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], "domain" : [ "thousandeyes.com" ], "location" : [ "San Francisco Bay Area", "Germany" ], "connection" : [ "wireless", "wireless" ], "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], "gateway" : [ "78.153.54.204", "78.153.54.206" ] } } @@ -256,11 +260,13 @@ def test_filter_real_user_tests_visited_pages_results_models_validation(self) -> "platform" : [ "mac", "mac" ], "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], "domain" : [ "thousandeyes.com" ], "location" : [ "San Francisco Bay Area", "Germany" ], "connection" : [ "wireless", "wireless" ], "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], "gateway" : [ "78.153.54.204", "78.153.54.206" ] } """ 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 000000000..127f49362 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py @@ -0,0 +1,2819 @@ +# 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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" ], + "nicModel" : [ "Intel(R) Wi-Fi 6 AX200 160MHz", "Intel(R) Wi-Fi 6 AX200 160MHz" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "nicDriverVersion" : [ "22.250.0.9", "22.250.0.9" ], + "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" : "" + }, { + "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 + } ] + } + """ + 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-test-results/test/test_utils.py b/thousandeyes-sdk-endpoint-test-results/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-tests/.openapi-generator/FILES index 9008d9790..01a462c32 100644 --- a/thousandeyes-sdk-endpoint-tests/.openapi-generator/FILES +++ b/thousandeyes-sdk-endpoint-tests/.openapi-generator/FILES @@ -114,9 +114,17 @@ src/thousandeyes_sdk/endpoint_tests/models/validation_error.py src/thousandeyes_sdk/endpoint_tests/models/validation_error_item.py src/thousandeyes_sdk/endpoint_tests/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_agent_to_server_endpoint_dynamic_tests_api.py +test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py test/test_agent_to_server_endpoint_scheduled_tests_api.py +test/test_agent_to_server_endpoint_scheduled_tests_api_integration.py test/test_endpoint_real_user_tests_api.py +test/test_endpoint_real_user_tests_api_integration.py test/test_endpoint_scheduled_tests_api.py +test/test_endpoint_scheduled_tests_api_integration.py test/test_http_server_endpoint_scheduled_tests_api.py +test/test_http_server_endpoint_scheduled_tests_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-endpoint-tests/README.md b/thousandeyes-sdk-endpoint-tests/README.md index b6b1e3f26..0032fcece 100644 --- a/thousandeyes-sdk-endpoint-tests/README.md +++ b/thousandeyes-sdk-endpoint-tests/README.md @@ -4,7 +4,7 @@ Manage endpoint agent dynamic and scheduled tests using the Endpoint Tests API. This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -77,7 +77,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_tests.AgentToServerEndpointDynamicTestsApi(api_client) - dynamic_test_request = thousandeyes_sdk.endpoint_tests.DynamicTestRequest() # DynamicTestRequest | + dynamic_test_request = # DynamicTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-endpoint-tests/docs/AgentToServerEndpointDynamicTestsApi.md b/thousandeyes-sdk-endpoint-tests/docs/AgentToServerEndpointDynamicTestsApi.md index 2d2d0d706..7491afcd1 100644 --- a/thousandeyes-sdk-endpoint-tests/docs/AgentToServerEndpointDynamicTestsApi.md +++ b/thousandeyes-sdk-endpoint-tests/docs/AgentToServerEndpointDynamicTestsApi.md @@ -49,7 +49,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_tests.AgentToServerEndpointDynamicTestsApi(api_client) - dynamic_test_request = thousandeyes_sdk.endpoint_tests.DynamicTestRequest() # DynamicTestRequest | + dynamic_test_request = # DynamicTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -395,7 +395,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_tests.AgentToServerEndpointDynamicTestsApi(api_client) test_id = '584739201' # str | Unique ID of endpoint test. - endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.EndpointDynamicTestUpdate() # EndpointDynamicTestUpdate | + endpoint_dynamic_test_update = # EndpointDynamicTestUpdate | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-endpoint-tests/docs/AgentToServerEndpointScheduledTestsApi.md b/thousandeyes-sdk-endpoint-tests/docs/AgentToServerEndpointScheduledTestsApi.md index 4e318151e..1d9d12632 100644 --- a/thousandeyes-sdk-endpoint-tests/docs/AgentToServerEndpointScheduledTestsApi.md +++ b/thousandeyes-sdk-endpoint-tests/docs/AgentToServerEndpointScheduledTestsApi.md @@ -49,7 +49,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_tests.AgentToServerEndpointScheduledTestsApi(api_client) - endpoint_agent_to_server_test_request = thousandeyes_sdk.endpoint_tests.EndpointAgentToServerTestRequest() # EndpointAgentToServerTestRequest | + endpoint_agent_to_server_test_request = # EndpointAgentToServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -395,7 +395,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_tests.AgentToServerEndpointScheduledTestsApi(api_client) test_id = '584739201' # str | Unique ID of endpoint test. - endpoint_network_test_update = thousandeyes_sdk.endpoint_tests.EndpointNetworkTestUpdate() # EndpointNetworkTestUpdate | + endpoint_network_test_update = # EndpointNetworkTestUpdate | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-endpoint-tests/docs/HTTPServerEndpointScheduledTestsApi.md b/thousandeyes-sdk-endpoint-tests/docs/HTTPServerEndpointScheduledTestsApi.md index fd71b1171..b082a202d 100644 --- a/thousandeyes-sdk-endpoint-tests/docs/HTTPServerEndpointScheduledTestsApi.md +++ b/thousandeyes-sdk-endpoint-tests/docs/HTTPServerEndpointScheduledTestsApi.md @@ -49,7 +49,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_tests.HTTPServerEndpointScheduledTestsApi(api_client) - endpoint_http_server_test_request = thousandeyes_sdk.endpoint_tests.EndpointHttpServerTestRequest() # EndpointHttpServerTestRequest | + endpoint_http_server_test_request = # EndpointHttpServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -395,7 +395,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.endpoint_tests.HTTPServerEndpointScheduledTestsApi(api_client) test_id = '584739201' # str | Unique ID of endpoint test. - endpoint_http_test_update = thousandeyes_sdk.endpoint_tests.EndpointHttpTestUpdate() # EndpointHttpTestUpdate | + endpoint_http_test_update = # EndpointHttpTestUpdate | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-endpoint-tests/test/conftest.py b/thousandeyes-sdk-endpoint-tests/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..5a1cf9656 --- /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 000000000..5f8f0d5ea --- /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 000000000..bb4673f4f --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py @@ -0,0 +1,1548 @@ +# 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 000000000..33fd5cb76 --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_scheduled_tests_api_integration.py @@ -0,0 +1,1561 @@ +# 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 000000000..f64c4578c --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/test_endpoint_real_user_tests_api_integration.py @@ -0,0 +1,176 @@ +# 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 000000000..ac442bfa7 --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/test_endpoint_scheduled_tests_api_integration.py @@ -0,0 +1,285 @@ +# 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 000000000..27b916f10 --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/test_http_server_endpoint_scheduled_tests_api_integration.py @@ -0,0 +1,1688 @@ +# 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-endpoint-tests/test/test_utils.py b/thousandeyes-sdk-endpoint-tests/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-event-detection/.openapi-generator/FILES index 36db1126f..c86b05444 100644 --- a/thousandeyes-sdk-event-detection/.openapi-generator/FILES +++ b/thousandeyes-sdk-event-detection/.openapi-generator/FILES @@ -5,15 +5,28 @@ docs/AffectedAgents.md docs/AffectedCount.md docs/AffectedTargets.md docs/AffectedTests.md +docs/AgentBranchEventDetail.md +docs/AgentBranchEventGrouping.md +docs/AgentEventDetail.md +docs/AgentEventGrouping.md docs/AgentLinks.md docs/AgentLocalEventDetail.md docs/AgentLocalEventGrouping.md docs/ApiAffectedTarget.md -docs/CloudEnterpriseAgentType.md +docs/ApplicationEventDetail.md +docs/ApplicationEventGrouping.md docs/DnsEventDetail.md docs/DnsEventGrouping.md +docs/DnsNameEventDetail.md +docs/DnsNameEventGrouping.md +docs/DnsServerEventDetail.md +docs/DnsServerEventGrouping.md +docs/DomainEventDetail.md +docs/DomainEventGrouping.md docs/Error.md docs/Event.md +docs/EventAffectedAgentType.md +docs/EventAgentType.md docs/EventAlertSeverity.md docs/EventApiAffectedAgent.md docs/EventApiAffectedTest.md @@ -24,7 +37,11 @@ docs/EventTestLinks.md docs/EventType.md docs/Events.md docs/EventsApi.md +docs/GatewayEventDetail.md +docs/GatewayEventGrouping.md docs/Link.md +docs/NameServerEventDetail.md +docs/NameServerEventGrouping.md docs/NetworkEventDetail.md docs/NetworkEventGrouping.md docs/NetworkPopEventDetail.md @@ -41,6 +58,10 @@ docs/TestType.md docs/UnauthorizedError.md docs/ValidationError.md docs/ValidationErrorItem.md +docs/VpnEventDetail.md +docs/VpnEventGrouping.md +docs/WirelessEventDetail.md +docs/WirelessEventGrouping.md pyproject.toml setup.cfg src/thousandeyes_sdk/event_detection/__init__.py @@ -51,15 +72,28 @@ src/thousandeyes_sdk/event_detection/models/affected_agents.py src/thousandeyes_sdk/event_detection/models/affected_count.py src/thousandeyes_sdk/event_detection/models/affected_targets.py src/thousandeyes_sdk/event_detection/models/affected_tests.py +src/thousandeyes_sdk/event_detection/models/agent_branch_event_detail.py +src/thousandeyes_sdk/event_detection/models/agent_branch_event_grouping.py +src/thousandeyes_sdk/event_detection/models/agent_event_detail.py +src/thousandeyes_sdk/event_detection/models/agent_event_grouping.py src/thousandeyes_sdk/event_detection/models/agent_links.py src/thousandeyes_sdk/event_detection/models/agent_local_event_detail.py src/thousandeyes_sdk/event_detection/models/agent_local_event_grouping.py src/thousandeyes_sdk/event_detection/models/api_affected_target.py -src/thousandeyes_sdk/event_detection/models/cloud_enterprise_agent_type.py +src/thousandeyes_sdk/event_detection/models/application_event_detail.py +src/thousandeyes_sdk/event_detection/models/application_event_grouping.py src/thousandeyes_sdk/event_detection/models/dns_event_detail.py src/thousandeyes_sdk/event_detection/models/dns_event_grouping.py +src/thousandeyes_sdk/event_detection/models/dns_name_event_detail.py +src/thousandeyes_sdk/event_detection/models/dns_name_event_grouping.py +src/thousandeyes_sdk/event_detection/models/dns_server_event_detail.py +src/thousandeyes_sdk/event_detection/models/dns_server_event_grouping.py +src/thousandeyes_sdk/event_detection/models/domain_event_detail.py +src/thousandeyes_sdk/event_detection/models/domain_event_grouping.py src/thousandeyes_sdk/event_detection/models/error.py src/thousandeyes_sdk/event_detection/models/event.py +src/thousandeyes_sdk/event_detection/models/event_affected_agent_type.py +src/thousandeyes_sdk/event_detection/models/event_agent_type.py src/thousandeyes_sdk/event_detection/models/event_alert_severity.py src/thousandeyes_sdk/event_detection/models/event_api_affected_agent.py src/thousandeyes_sdk/event_detection/models/event_api_affected_test.py @@ -69,7 +103,11 @@ src/thousandeyes_sdk/event_detection/models/event_state.py src/thousandeyes_sdk/event_detection/models/event_test_links.py src/thousandeyes_sdk/event_detection/models/event_type.py src/thousandeyes_sdk/event_detection/models/events.py +src/thousandeyes_sdk/event_detection/models/gateway_event_detail.py +src/thousandeyes_sdk/event_detection/models/gateway_event_grouping.py src/thousandeyes_sdk/event_detection/models/link.py +src/thousandeyes_sdk/event_detection/models/name_server_event_detail.py +src/thousandeyes_sdk/event_detection/models/name_server_event_grouping.py src/thousandeyes_sdk/event_detection/models/network_event_detail.py src/thousandeyes_sdk/event_detection/models/network_event_grouping.py src/thousandeyes_sdk/event_detection/models/network_pop_event_detail.py @@ -86,7 +124,15 @@ src/thousandeyes_sdk/event_detection/models/test_type.py src/thousandeyes_sdk/event_detection/models/unauthorized_error.py src/thousandeyes_sdk/event_detection/models/validation_error.py src/thousandeyes_sdk/event_detection/models/validation_error_item.py +src/thousandeyes_sdk/event_detection/models/vpn_event_detail.py +src/thousandeyes_sdk/event_detection/models/vpn_event_grouping.py +src/thousandeyes_sdk/event_detection/models/wireless_event_detail.py +src/thousandeyes_sdk/event_detection/models/wireless_event_grouping.py src/thousandeyes_sdk/event_detection/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_events_api.py +test/test_events_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-event-detection/README.md b/thousandeyes-sdk-event-detection/README.md index 58f9cf7d0..2d6970cec 100644 --- a/thousandeyes-sdk-event-detection/README.md +++ b/thousandeyes-sdk-event-detection/README.md @@ -11,7 +11,7 @@ With the Events API, you can perform the following tasks on the ThousandEyes pla This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -113,15 +113,28 @@ Class | Method | HTTP request | Description - [AffectedCount](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/AffectedCount.md) - [AffectedTargets](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/AffectedTargets.md) - [AffectedTests](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/AffectedTests.md) + - [AgentBranchEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/AgentBranchEventDetail.md) + - [AgentBranchEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/AgentBranchEventGrouping.md) + - [AgentEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/AgentEventDetail.md) + - [AgentEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/AgentEventGrouping.md) - [AgentLinks](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/AgentLinks.md) - [AgentLocalEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/AgentLocalEventDetail.md) - [AgentLocalEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/AgentLocalEventGrouping.md) - [ApiAffectedTarget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/ApiAffectedTarget.md) - - [CloudEnterpriseAgentType](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/CloudEnterpriseAgentType.md) + - [ApplicationEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/ApplicationEventDetail.md) + - [ApplicationEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/ApplicationEventGrouping.md) - [DnsEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/DnsEventDetail.md) - [DnsEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/DnsEventGrouping.md) + - [DnsNameEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/DnsNameEventDetail.md) + - [DnsNameEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/DnsNameEventGrouping.md) + - [DnsServerEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/DnsServerEventDetail.md) + - [DnsServerEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/DnsServerEventGrouping.md) + - [DomainEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/DomainEventDetail.md) + - [DomainEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/DomainEventGrouping.md) - [Error](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/Error.md) - [Event](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/Event.md) + - [EventAffectedAgentType](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/EventAffectedAgentType.md) + - [EventAgentType](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/EventAgentType.md) - [EventAlertSeverity](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/EventAlertSeverity.md) - [EventApiAffectedAgent](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/EventApiAffectedAgent.md) - [EventApiAffectedTest](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/EventApiAffectedTest.md) @@ -131,7 +144,11 @@ Class | Method | HTTP request | Description - [EventTestLinks](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/EventTestLinks.md) - [EventType](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/EventType.md) - [Events](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/Events.md) + - [GatewayEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/GatewayEventDetail.md) + - [GatewayEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/GatewayEventGrouping.md) - [Link](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/Link.md) + - [NameServerEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/NameServerEventDetail.md) + - [NameServerEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/NameServerEventGrouping.md) - [NetworkEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/NetworkEventDetail.md) - [NetworkEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/NetworkEventGrouping.md) - [NetworkPopEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/NetworkPopEventDetail.md) @@ -148,6 +165,10 @@ Class | Method | HTTP request | Description - [UnauthorizedError](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/UnauthorizedError.md) - [ValidationError](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/ValidationError.md) - [ValidationErrorItem](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/ValidationErrorItem.md) + - [VpnEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/VpnEventDetail.md) + - [VpnEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/VpnEventGrouping.md) + - [WirelessEventDetail](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/WirelessEventDetail.md) + - [WirelessEventGrouping](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-event-detection/docs/WirelessEventGrouping.md) diff --git a/thousandeyes-sdk-event-detection/docs/AgentBranchEventDetail.md b/thousandeyes-sdk-event-detection/docs/AgentBranchEventDetail.md new file mode 100644 index 000000000..54a716f4c --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/AgentBranchEventDetail.md @@ -0,0 +1,44 @@ +# AgentBranchEventDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique ID for each event. | [optional] [readonly] +**type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] +**state** | [**EventState**](EventState.md) | | [optional] +**start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] +**severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] +**aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] +**summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] +**affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] +**affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] +**affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] +**cause** | **List[str]** | The cause of the error. | [optional] +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] +**type** | **str** | Agent branch event type. | +**grouping** | [**AgentBranchEventGrouping**](AgentBranchEventGrouping.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.agent_branch_event_detail import AgentBranchEventDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of AgentBranchEventDetail from a JSON string +agent_branch_event_detail_instance = AgentBranchEventDetail.from_json(json) +# print the JSON string representation of the object +print(AgentBranchEventDetail.to_json()) + +# convert the object into a dict +agent_branch_event_detail_dict = agent_branch_event_detail_instance.to_dict() +# create an instance of AgentBranchEventDetail from a dict +agent_branch_event_detail_from_dict = AgentBranchEventDetail.from_dict(agent_branch_event_detail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/AgentBranchEventGrouping.md b/thousandeyes-sdk-event-detection/docs/AgentBranchEventGrouping.md new file mode 100644 index 000000000..637ec319c --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/AgentBranchEventGrouping.md @@ -0,0 +1,30 @@ +# AgentBranchEventGrouping + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asn** | **int** | AS number of the agent's network (for agent-branch events). | [optional] [readonly] +**asn_city** | **str** | City associated with the agent's AS (for agent-branch events). | [optional] [readonly] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.agent_branch_event_grouping import AgentBranchEventGrouping + +# TODO update the JSON string below +json = "{}" +# create an instance of AgentBranchEventGrouping from a JSON string +agent_branch_event_grouping_instance = AgentBranchEventGrouping.from_json(json) +# print the JSON string representation of the object +print(AgentBranchEventGrouping.to_json()) + +# convert the object into a dict +agent_branch_event_grouping_dict = agent_branch_event_grouping_instance.to_dict() +# create an instance of AgentBranchEventGrouping from a dict +agent_branch_event_grouping_from_dict = AgentBranchEventGrouping.from_dict(agent_branch_event_grouping_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/AgentEventDetail.md b/thousandeyes-sdk-event-detection/docs/AgentEventDetail.md new file mode 100644 index 000000000..db4bd8b8f --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/AgentEventDetail.md @@ -0,0 +1,44 @@ +# AgentEventDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique ID for each event. | [optional] [readonly] +**type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] +**state** | [**EventState**](EventState.md) | | [optional] +**start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] +**severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] +**aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] +**summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] +**affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] +**affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] +**affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] +**cause** | **List[str]** | The cause of the error. | [optional] +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] +**type** | **str** | Agent event type. | +**grouping** | [**AgentEventGrouping**](AgentEventGrouping.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.agent_event_detail import AgentEventDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of AgentEventDetail from a JSON string +agent_event_detail_instance = AgentEventDetail.from_json(json) +# print the JSON string representation of the object +print(AgentEventDetail.to_json()) + +# convert the object into a dict +agent_event_detail_dict = agent_event_detail_instance.to_dict() +# create an instance of AgentEventDetail from a dict +agent_event_detail_from_dict = AgentEventDetail.from_dict(agent_event_detail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/AgentEventGrouping.md b/thousandeyes-sdk-event-detection/docs/AgentEventGrouping.md new file mode 100644 index 000000000..2822a7cf8 --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/AgentEventGrouping.md @@ -0,0 +1,29 @@ +# AgentEventGrouping + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**agent_id** | **str** | Agent identifier (for agent events). Represents the machine ID for Endpoint Agents or the virtual agent ID for Cloud and Enterprise Agents'. | [optional] [readonly] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.agent_event_grouping import AgentEventGrouping + +# TODO update the JSON string below +json = "{}" +# create an instance of AgentEventGrouping from a JSON string +agent_event_grouping_instance = AgentEventGrouping.from_json(json) +# print the JSON string representation of the object +print(AgentEventGrouping.to_json()) + +# convert the object into a dict +agent_event_grouping_dict = agent_event_grouping_instance.to_dict() +# create an instance of AgentEventGrouping from a dict +agent_event_grouping_from_dict = AgentEventGrouping.from_dict(agent_event_grouping_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/AgentLocalEventDetail.md b/thousandeyes-sdk-event-detection/docs/AgentLocalEventDetail.md index e216e2b9b..f3e60b675 100644 --- a/thousandeyes-sdk-event-detection/docs/AgentLocalEventDetail.md +++ b/thousandeyes-sdk-event-detection/docs/AgentLocalEventDetail.md @@ -9,10 +9,11 @@ Name | Type | Description | Notes **type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] **state** | [**EventState**](EventState.md) | | [optional] **start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] -**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] **severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] **aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] **summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] **affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] **affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] **affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] diff --git a/thousandeyes-sdk-event-detection/docs/ApplicationEventDetail.md b/thousandeyes-sdk-event-detection/docs/ApplicationEventDetail.md new file mode 100644 index 000000000..f59efb399 --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/ApplicationEventDetail.md @@ -0,0 +1,44 @@ +# ApplicationEventDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique ID for each event. | [optional] [readonly] +**type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] +**state** | [**EventState**](EventState.md) | | [optional] +**start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] +**severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] +**aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] +**summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] +**affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] +**affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] +**affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] +**cause** | **List[str]** | The cause of the error. | [optional] +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] +**type** | **str** | Application event type. | +**grouping** | [**ApplicationEventGrouping**](ApplicationEventGrouping.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.application_event_detail import ApplicationEventDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of ApplicationEventDetail from a JSON string +application_event_detail_instance = ApplicationEventDetail.from_json(json) +# print the JSON string representation of the object +print(ApplicationEventDetail.to_json()) + +# convert the object into a dict +application_event_detail_dict = application_event_detail_instance.to_dict() +# create an instance of ApplicationEventDetail from a dict +application_event_detail_from_dict = ApplicationEventDetail.from_dict(application_event_detail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/ApplicationEventGrouping.md b/thousandeyes-sdk-event-detection/docs/ApplicationEventGrouping.md new file mode 100644 index 000000000..b6a091132 --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/ApplicationEventGrouping.md @@ -0,0 +1,29 @@ +# ApplicationEventGrouping + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fqdn** | **str** | Fully qualified domain name of the application (for application events). | [optional] [readonly] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.application_event_grouping import ApplicationEventGrouping + +# TODO update the JSON string below +json = "{}" +# create an instance of ApplicationEventGrouping from a JSON string +application_event_grouping_instance = ApplicationEventGrouping.from_json(json) +# print the JSON string representation of the object +print(ApplicationEventGrouping.to_json()) + +# convert the object into a dict +application_event_grouping_dict = application_event_grouping_instance.to_dict() +# create an instance of ApplicationEventGrouping from a dict +application_event_grouping_from_dict = ApplicationEventGrouping.from_dict(application_event_grouping_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/DnsEventDetail.md b/thousandeyes-sdk-event-detection/docs/DnsEventDetail.md index 6bd6eff10..a244ed736 100644 --- a/thousandeyes-sdk-event-detection/docs/DnsEventDetail.md +++ b/thousandeyes-sdk-event-detection/docs/DnsEventDetail.md @@ -9,10 +9,11 @@ Name | Type | Description | Notes **type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] **state** | [**EventState**](EventState.md) | | [optional] **start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] -**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] **severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] **aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] **summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] **affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] **affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] **affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] diff --git a/thousandeyes-sdk-event-detection/docs/DnsNameEventDetail.md b/thousandeyes-sdk-event-detection/docs/DnsNameEventDetail.md new file mode 100644 index 000000000..d11912ec1 --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/DnsNameEventDetail.md @@ -0,0 +1,44 @@ +# DnsNameEventDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique ID for each event. | [optional] [readonly] +**type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] +**state** | [**EventState**](EventState.md) | | [optional] +**start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] +**severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] +**aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] +**summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] +**affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] +**affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] +**affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] +**cause** | **List[str]** | The cause of the error. | [optional] +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] +**type** | **str** | DNS name event type. | +**grouping** | [**DnsNameEventGrouping**](DnsNameEventGrouping.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.dns_name_event_detail import DnsNameEventDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of DnsNameEventDetail from a JSON string +dns_name_event_detail_instance = DnsNameEventDetail.from_json(json) +# print the JSON string representation of the object +print(DnsNameEventDetail.to_json()) + +# convert the object into a dict +dns_name_event_detail_dict = dns_name_event_detail_instance.to_dict() +# create an instance of DnsNameEventDetail from a dict +dns_name_event_detail_from_dict = DnsNameEventDetail.from_dict(dns_name_event_detail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/DnsNameEventGrouping.md b/thousandeyes-sdk-event-detection/docs/DnsNameEventGrouping.md new file mode 100644 index 000000000..150d7bb17 --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/DnsNameEventGrouping.md @@ -0,0 +1,29 @@ +# DnsNameEventGrouping + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**domain_name_suffix** | **str** | Domain name suffix (for dns-name events). | [optional] [readonly] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.dns_name_event_grouping import DnsNameEventGrouping + +# TODO update the JSON string below +json = "{}" +# create an instance of DnsNameEventGrouping from a JSON string +dns_name_event_grouping_instance = DnsNameEventGrouping.from_json(json) +# print the JSON string representation of the object +print(DnsNameEventGrouping.to_json()) + +# convert the object into a dict +dns_name_event_grouping_dict = dns_name_event_grouping_instance.to_dict() +# create an instance of DnsNameEventGrouping from a dict +dns_name_event_grouping_from_dict = DnsNameEventGrouping.from_dict(dns_name_event_grouping_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/DnsServerEventDetail.md b/thousandeyes-sdk-event-detection/docs/DnsServerEventDetail.md new file mode 100644 index 000000000..434356232 --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/DnsServerEventDetail.md @@ -0,0 +1,44 @@ +# DnsServerEventDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique ID for each event. | [optional] [readonly] +**type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] +**state** | [**EventState**](EventState.md) | | [optional] +**start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] +**severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] +**aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] +**summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] +**affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] +**affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] +**affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] +**cause** | **List[str]** | The cause of the error. | [optional] +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] +**type** | **str** | DNS server event type. | +**grouping** | [**DnsServerEventGrouping**](DnsServerEventGrouping.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.dns_server_event_detail import DnsServerEventDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of DnsServerEventDetail from a JSON string +dns_server_event_detail_instance = DnsServerEventDetail.from_json(json) +# print the JSON string representation of the object +print(DnsServerEventDetail.to_json()) + +# convert the object into a dict +dns_server_event_detail_dict = dns_server_event_detail_instance.to_dict() +# create an instance of DnsServerEventDetail from a dict +dns_server_event_detail_from_dict = DnsServerEventDetail.from_dict(dns_server_event_detail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/DnsServerEventGrouping.md b/thousandeyes-sdk-event-detection/docs/DnsServerEventGrouping.md new file mode 100644 index 000000000..683d0aa86 --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/DnsServerEventGrouping.md @@ -0,0 +1,29 @@ +# DnsServerEventGrouping + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ip_address** | **str** | DNS server IP address (for dns-server events). | [optional] [readonly] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.dns_server_event_grouping import DnsServerEventGrouping + +# TODO update the JSON string below +json = "{}" +# create an instance of DnsServerEventGrouping from a JSON string +dns_server_event_grouping_instance = DnsServerEventGrouping.from_json(json) +# print the JSON string representation of the object +print(DnsServerEventGrouping.to_json()) + +# convert the object into a dict +dns_server_event_grouping_dict = dns_server_event_grouping_instance.to_dict() +# create an instance of DnsServerEventGrouping from a dict +dns_server_event_grouping_from_dict = DnsServerEventGrouping.from_dict(dns_server_event_grouping_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/DomainEventDetail.md b/thousandeyes-sdk-event-detection/docs/DomainEventDetail.md new file mode 100644 index 000000000..aeb21d27d --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/DomainEventDetail.md @@ -0,0 +1,44 @@ +# DomainEventDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique ID for each event. | [optional] [readonly] +**type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] +**state** | [**EventState**](EventState.md) | | [optional] +**start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] +**severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] +**aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] +**summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] +**affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] +**affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] +**affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] +**cause** | **List[str]** | The cause of the error. | [optional] +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] +**type** | **str** | Domain event type. | +**grouping** | [**DomainEventGrouping**](DomainEventGrouping.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.domain_event_detail import DomainEventDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of DomainEventDetail from a JSON string +domain_event_detail_instance = DomainEventDetail.from_json(json) +# print the JSON string representation of the object +print(DomainEventDetail.to_json()) + +# convert the object into a dict +domain_event_detail_dict = domain_event_detail_instance.to_dict() +# create an instance of DomainEventDetail from a dict +domain_event_detail_from_dict = DomainEventDetail.from_dict(domain_event_detail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/DomainEventGrouping.md b/thousandeyes-sdk-event-detection/docs/DomainEventGrouping.md new file mode 100644 index 000000000..c97c8a28e --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/DomainEventGrouping.md @@ -0,0 +1,29 @@ +# DomainEventGrouping + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fqdn** | **str** | Fully qualified domain name (for domain events). | [optional] [readonly] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.domain_event_grouping import DomainEventGrouping + +# TODO update the JSON string below +json = "{}" +# create an instance of DomainEventGrouping from a JSON string +domain_event_grouping_instance = DomainEventGrouping.from_json(json) +# print the JSON string representation of the object +print(DomainEventGrouping.to_json()) + +# convert the object into a dict +domain_event_grouping_dict = domain_event_grouping_instance.to_dict() +# create an instance of DomainEventGrouping from a dict +domain_event_grouping_from_dict = DomainEventGrouping.from_dict(domain_event_grouping_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/Event.md b/thousandeyes-sdk-event-detection/docs/Event.md index 01d6ae611..f70cad207 100644 --- a/thousandeyes-sdk-event-detection/docs/Event.md +++ b/thousandeyes-sdk-event-detection/docs/Event.md @@ -9,10 +9,11 @@ Name | Type | Description | Notes **type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] **state** | [**EventState**](EventState.md) | | [optional] **start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] -**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] **severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] **title** | **str** | Event title | [optional] [readonly] **type** | [**EventType**](EventType.md) | | [optional] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] **affected_tests** | [**AffectedCount**](AffectedCount.md) | | [optional] **affected_targets** | [**AffectedCount**](AffectedCount.md) | | [optional] **affected_agents** | [**AffectedCount**](AffectedCount.md) | | [optional] diff --git a/thousandeyes-sdk-event-detection/docs/CloudEnterpriseAgentType.md b/thousandeyes-sdk-event-detection/docs/EventAffectedAgentType.md similarity index 83% rename from thousandeyes-sdk-event-detection/docs/CloudEnterpriseAgentType.md rename to thousandeyes-sdk-event-detection/docs/EventAffectedAgentType.md index 371c853b2..e8c03cb24 100644 --- a/thousandeyes-sdk-event-detection/docs/CloudEnterpriseAgentType.md +++ b/thousandeyes-sdk-event-detection/docs/EventAffectedAgentType.md @@ -1,6 +1,6 @@ -# CloudEnterpriseAgentType +# EventAffectedAgentType -Type of the agent. +Type of the affected agent. ## Properties diff --git a/thousandeyes-sdk-event-detection/docs/EventAgentType.md b/thousandeyes-sdk-event-detection/docs/EventAgentType.md new file mode 100644 index 000000000..fcf63439c --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/EventAgentType.md @@ -0,0 +1,12 @@ +# EventAgentType + +Specifies the agent type associated with the event. Allowed values are `cloud-enterprise-agent` and `endpoint-agent`. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/EventApiAffectedAgent.md b/thousandeyes-sdk-event-detection/docs/EventApiAffectedAgent.md index 8bcfbd3ae..4ae9b6af1 100644 --- a/thousandeyes-sdk-event-detection/docs/EventApiAffectedAgent.md +++ b/thousandeyes-sdk-event-detection/docs/EventApiAffectedAgent.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **agent_id** | **str** | The ID of the virtual agent. | [optional] [readonly] -**type** | [**CloudEnterpriseAgentType**](CloudEnterpriseAgentType.md) | | [optional] +**type** | [**EventAffectedAgentType**](EventAffectedAgentType.md) | | [optional] **name** | **str** | The name of the agent as defined in settings. | [optional] [readonly] **location** | **str** | The name of the agent's location. | [optional] [readonly] **country_code** | **str** | The country code of the agent's location . | [optional] [readonly] diff --git a/thousandeyes-sdk-event-detection/docs/EventDetail.md b/thousandeyes-sdk-event-detection/docs/EventDetail.md index b3b4c39eb..784bbdc11 100644 --- a/thousandeyes-sdk-event-detection/docs/EventDetail.md +++ b/thousandeyes-sdk-event-detection/docs/EventDetail.md @@ -9,17 +9,18 @@ Name | Type | Description | Notes **type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] **state** | [**EventState**](EventState.md) | | [optional] **start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] -**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] **severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] **aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] **summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] **affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] **affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] **affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] **cause** | **List[str]** | The cause of the error. | [optional] **links** | [**SelfLinks**](SelfLinks.md) | | [optional] -**type** | **str** | Network pop event type. | -**grouping** | [**NetworkEventGrouping**](NetworkEventGrouping.md) | | [optional] +**type** | **str** | Name server event type. | +**grouping** | [**NameServerEventGrouping**](NameServerEventGrouping.md) | | [optional] ## Example diff --git a/thousandeyes-sdk-event-detection/docs/EventDetailBase.md b/thousandeyes-sdk-event-detection/docs/EventDetailBase.md index 305b1bd5b..10dda03cf 100644 --- a/thousandeyes-sdk-event-detection/docs/EventDetailBase.md +++ b/thousandeyes-sdk-event-detection/docs/EventDetailBase.md @@ -9,10 +9,11 @@ Name | Type | Description | Notes **type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] **state** | [**EventState**](EventState.md) | | [optional] **start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] -**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] **severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] **aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] **summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] **affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] **affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] **affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] diff --git a/thousandeyes-sdk-event-detection/docs/EventType.md b/thousandeyes-sdk-event-detection/docs/EventType.md index 6550e3618..6d3cc25af 100644 --- a/thousandeyes-sdk-event-detection/docs/EventType.md +++ b/thousandeyes-sdk-event-detection/docs/EventType.md @@ -1,6 +1,6 @@ # EventType -Specifies the event type in a machine-readable and backwards-compatible format. Allowed values are: `agent-local`, `network-pop`, `network`, `dns`, `target`, and `proxy`. +Specifies the event type in a machine-readable and backwards-compatible format, such as `agent` or `target`. ## Properties diff --git a/thousandeyes-sdk-event-detection/docs/EventsApi.md b/thousandeyes-sdk-event-detection/docs/EventsApi.md index 8e4dbe859..9bf9d9149 100644 --- a/thousandeyes-sdk-event-detection/docs/EventsApi.md +++ b/thousandeyes-sdk-event-detection/docs/EventsApi.md @@ -96,7 +96,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_events** -> Events get_events(aid=aid, window=window, start_date=start_date, end_date=end_date, max=max, cursor=cursor) +> Events get_events(aid=aid, window=window, start_date=start_date, end_date=end_date, max=max, cursor=cursor, ongoing=ongoing) List events @@ -138,10 +138,11 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) max = 5 # int | (Optional) Maximum number of objects to return. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) + ongoing = True # bool | 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. (optional) try: # List events - api_response = api_instance.get_events(aid=aid, window=window, start_date=start_date, end_date=end_date, max=max, cursor=cursor) + api_response = api_instance.get_events(aid=aid, window=window, start_date=start_date, end_date=end_date, max=max, cursor=cursor, ongoing=ongoing) print("The response of EventsApi->get_events:\n") pprint(api_response) except Exception as e: @@ -161,6 +162,7 @@ Name | Type | Description | Notes **end_date** | **datetime**| 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`. | [optional] **max** | **int**| (Optional) Maximum number of objects to return. | [optional] **cursor** | **str**| (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. | [optional] + **ongoing** | **bool**| 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. | [optional] ### Return type diff --git a/thousandeyes-sdk-event-detection/docs/GatewayEventDetail.md b/thousandeyes-sdk-event-detection/docs/GatewayEventDetail.md new file mode 100644 index 000000000..846acbd5b --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/GatewayEventDetail.md @@ -0,0 +1,44 @@ +# GatewayEventDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique ID for each event. | [optional] [readonly] +**type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] +**state** | [**EventState**](EventState.md) | | [optional] +**start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] +**severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] +**aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] +**summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] +**affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] +**affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] +**affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] +**cause** | **List[str]** | The cause of the error. | [optional] +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] +**type** | **str** | Gateway event type. | +**grouping** | [**GatewayEventGrouping**](GatewayEventGrouping.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.gateway_event_detail import GatewayEventDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of GatewayEventDetail from a JSON string +gateway_event_detail_instance = GatewayEventDetail.from_json(json) +# print the JSON string representation of the object +print(GatewayEventDetail.to_json()) + +# convert the object into a dict +gateway_event_detail_dict = gateway_event_detail_instance.to_dict() +# create an instance of GatewayEventDetail from a dict +gateway_event_detail_from_dict = GatewayEventDetail.from_dict(gateway_event_detail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/GatewayEventGrouping.md b/thousandeyes-sdk-event-detection/docs/GatewayEventGrouping.md new file mode 100644 index 000000000..7faf3e504 --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/GatewayEventGrouping.md @@ -0,0 +1,30 @@ +# GatewayEventGrouping + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ip_address** | **str** | Gateway IP address (for gateway events). | [optional] [readonly] +**mac_address** | **str** | Gateway MAC address (for gateway events). | [optional] [readonly] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.gateway_event_grouping import GatewayEventGrouping + +# TODO update the JSON string below +json = "{}" +# create an instance of GatewayEventGrouping from a JSON string +gateway_event_grouping_instance = GatewayEventGrouping.from_json(json) +# print the JSON string representation of the object +print(GatewayEventGrouping.to_json()) + +# convert the object into a dict +gateway_event_grouping_dict = gateway_event_grouping_instance.to_dict() +# create an instance of GatewayEventGrouping from a dict +gateway_event_grouping_from_dict = GatewayEventGrouping.from_dict(gateway_event_grouping_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/NameServerEventDetail.md b/thousandeyes-sdk-event-detection/docs/NameServerEventDetail.md new file mode 100644 index 000000000..7b340380d --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/NameServerEventDetail.md @@ -0,0 +1,44 @@ +# NameServerEventDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique ID for each event. | [optional] [readonly] +**type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] +**state** | [**EventState**](EventState.md) | | [optional] +**start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] +**severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] +**aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] +**summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] +**affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] +**affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] +**affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] +**cause** | **List[str]** | The cause of the error. | [optional] +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] +**type** | **str** | Name server event type. | +**grouping** | [**NameServerEventGrouping**](NameServerEventGrouping.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.name_server_event_detail import NameServerEventDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of NameServerEventDetail from a JSON string +name_server_event_detail_instance = NameServerEventDetail.from_json(json) +# print the JSON string representation of the object +print(NameServerEventDetail.to_json()) + +# convert the object into a dict +name_server_event_detail_dict = name_server_event_detail_instance.to_dict() +# create an instance of NameServerEventDetail from a dict +name_server_event_detail_from_dict = NameServerEventDetail.from_dict(name_server_event_detail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/NameServerEventGrouping.md b/thousandeyes-sdk-event-detection/docs/NameServerEventGrouping.md new file mode 100644 index 000000000..1dd233b68 --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/NameServerEventGrouping.md @@ -0,0 +1,29 @@ +# NameServerEventGrouping + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**server_name** | **str** | Name server hostname (for name-server events). | [optional] [readonly] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.name_server_event_grouping import NameServerEventGrouping + +# TODO update the JSON string below +json = "{}" +# create an instance of NameServerEventGrouping from a JSON string +name_server_event_grouping_instance = NameServerEventGrouping.from_json(json) +# print the JSON string representation of the object +print(NameServerEventGrouping.to_json()) + +# convert the object into a dict +name_server_event_grouping_dict = name_server_event_grouping_instance.to_dict() +# create an instance of NameServerEventGrouping from a dict +name_server_event_grouping_from_dict = NameServerEventGrouping.from_dict(name_server_event_grouping_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/NetworkEventDetail.md b/thousandeyes-sdk-event-detection/docs/NetworkEventDetail.md index ff18ae965..c24907d3a 100644 --- a/thousandeyes-sdk-event-detection/docs/NetworkEventDetail.md +++ b/thousandeyes-sdk-event-detection/docs/NetworkEventDetail.md @@ -9,10 +9,11 @@ Name | Type | Description | Notes **type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] **state** | [**EventState**](EventState.md) | | [optional] **start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] -**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] **severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] **aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] **summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] **affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] **affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] **affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] diff --git a/thousandeyes-sdk-event-detection/docs/NetworkPopEventDetail.md b/thousandeyes-sdk-event-detection/docs/NetworkPopEventDetail.md index b3685d60b..0a8bccbc6 100644 --- a/thousandeyes-sdk-event-detection/docs/NetworkPopEventDetail.md +++ b/thousandeyes-sdk-event-detection/docs/NetworkPopEventDetail.md @@ -9,10 +9,11 @@ Name | Type | Description | Notes **type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] **state** | [**EventState**](EventState.md) | | [optional] **start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] -**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] **severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] **aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] **summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] **affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] **affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] **affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] diff --git a/thousandeyes-sdk-event-detection/docs/ProxyEventDetail.md b/thousandeyes-sdk-event-detection/docs/ProxyEventDetail.md index 292202cf9..5b6328621 100644 --- a/thousandeyes-sdk-event-detection/docs/ProxyEventDetail.md +++ b/thousandeyes-sdk-event-detection/docs/ProxyEventDetail.md @@ -9,10 +9,11 @@ Name | Type | Description | Notes **type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] **state** | [**EventState**](EventState.md) | | [optional] **start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] -**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] **severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] **aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] **summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] **affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] **affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] **affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] diff --git a/thousandeyes-sdk-event-detection/docs/SimpleEventDetail.md b/thousandeyes-sdk-event-detection/docs/SimpleEventDetail.md index dc24e4298..5757a00d7 100644 --- a/thousandeyes-sdk-event-detection/docs/SimpleEventDetail.md +++ b/thousandeyes-sdk-event-detection/docs/SimpleEventDetail.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] **state** | [**EventState**](EventState.md) | | [optional] **start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] -**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] **severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] ## Example diff --git a/thousandeyes-sdk-event-detection/docs/TargetEventDetail.md b/thousandeyes-sdk-event-detection/docs/TargetEventDetail.md index c4f1956b8..47bffb3ad 100644 --- a/thousandeyes-sdk-event-detection/docs/TargetEventDetail.md +++ b/thousandeyes-sdk-event-detection/docs/TargetEventDetail.md @@ -9,10 +9,11 @@ Name | Type | Description | Notes **type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] **state** | [**EventState**](EventState.md) | | [optional] **start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] -**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] **severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] **aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] **summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] **affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] **affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] **affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] diff --git a/thousandeyes-sdk-event-detection/docs/TargetNetworkEventDetail.md b/thousandeyes-sdk-event-detection/docs/TargetNetworkEventDetail.md index 059fd3f9c..2d4daeb2c 100644 --- a/thousandeyes-sdk-event-detection/docs/TargetNetworkEventDetail.md +++ b/thousandeyes-sdk-event-detection/docs/TargetNetworkEventDetail.md @@ -9,10 +9,11 @@ Name | Type | Description | Notes **type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] **state** | [**EventState**](EventState.md) | | [optional] **start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] -**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] **severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] **aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] **summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] **affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] **affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] **affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] diff --git a/thousandeyes-sdk-event-detection/docs/VpnEventDetail.md b/thousandeyes-sdk-event-detection/docs/VpnEventDetail.md new file mode 100644 index 000000000..6e32467ed --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/VpnEventDetail.md @@ -0,0 +1,44 @@ +# VpnEventDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique ID for each event. | [optional] [readonly] +**type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] +**state** | [**EventState**](EventState.md) | | [optional] +**start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] +**severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] +**aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] +**summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] +**affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] +**affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] +**affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] +**cause** | **List[str]** | The cause of the error. | [optional] +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] +**type** | **str** | VPN event type. | +**grouping** | [**VpnEventGrouping**](VpnEventGrouping.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.vpn_event_detail import VpnEventDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of VpnEventDetail from a JSON string +vpn_event_detail_instance = VpnEventDetail.from_json(json) +# print the JSON string representation of the object +print(VpnEventDetail.to_json()) + +# convert the object into a dict +vpn_event_detail_dict = vpn_event_detail_instance.to_dict() +# create an instance of VpnEventDetail from a dict +vpn_event_detail_from_dict = VpnEventDetail.from_dict(vpn_event_detail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/VpnEventGrouping.md b/thousandeyes-sdk-event-detection/docs/VpnEventGrouping.md new file mode 100644 index 000000000..15e1bdbcc --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/VpnEventGrouping.md @@ -0,0 +1,30 @@ +# VpnEventGrouping + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**vpn_type** | **str** | VPN type (for vpn events). | [optional] [readonly] +**vpn_server_ip_address** | **str** | VPN server IP address (for vpn events). | [optional] [readonly] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.vpn_event_grouping import VpnEventGrouping + +# TODO update the JSON string below +json = "{}" +# create an instance of VpnEventGrouping from a JSON string +vpn_event_grouping_instance = VpnEventGrouping.from_json(json) +# print the JSON string representation of the object +print(VpnEventGrouping.to_json()) + +# convert the object into a dict +vpn_event_grouping_dict = vpn_event_grouping_instance.to_dict() +# create an instance of VpnEventGrouping from a dict +vpn_event_grouping_from_dict = VpnEventGrouping.from_dict(vpn_event_grouping_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/WirelessEventDetail.md b/thousandeyes-sdk-event-detection/docs/WirelessEventDetail.md new file mode 100644 index 000000000..b45741425 --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/WirelessEventDetail.md @@ -0,0 +1,44 @@ +# WirelessEventDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | A unique ID for each event. | [optional] [readonly] +**type_name** | **str** | Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue. | [optional] [readonly] +**state** | [**EventState**](EventState.md) | | [optional] +**start_date** | **datetime** | The start date and time (in UTC, ISO 8601 format) when the event was first detected. | [optional] [readonly] +**end_date** | **datetime** | The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved. | [optional] [readonly] +**severity** | [**EventAlertSeverity**](EventAlertSeverity.md) | | [optional] +**aid** | **str** | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. | [optional] +**summary** | **str** | A brief summary describing the cause of the event. | [optional] [readonly] +**agent_type** | [**EventAgentType**](EventAgentType.md) | | [optional] +**affected_tests** | [**AffectedTests**](AffectedTests.md) | | [optional] +**affected_targets** | [**AffectedTargets**](AffectedTargets.md) | | [optional] +**affected_agents** | [**AffectedAgents**](AffectedAgents.md) | | [optional] +**cause** | **List[str]** | The cause of the error. | [optional] +**links** | [**SelfLinks**](SelfLinks.md) | | [optional] +**type** | **str** | Wireless event type. | +**grouping** | [**WirelessEventGrouping**](WirelessEventGrouping.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.wireless_event_detail import WirelessEventDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of WirelessEventDetail from a JSON string +wireless_event_detail_instance = WirelessEventDetail.from_json(json) +# print the JSON string representation of the object +print(WirelessEventDetail.to_json()) + +# convert the object into a dict +wireless_event_detail_dict = wireless_event_detail_instance.to_dict() +# create an instance of WirelessEventDetail from a dict +wireless_event_detail_from_dict = WirelessEventDetail.from_dict(wireless_event_detail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/docs/WirelessEventGrouping.md b/thousandeyes-sdk-event-detection/docs/WirelessEventGrouping.md new file mode 100644 index 000000000..d8eea672d --- /dev/null +++ b/thousandeyes-sdk-event-detection/docs/WirelessEventGrouping.md @@ -0,0 +1,30 @@ +# WirelessEventGrouping + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ssid** | **str** | Wireless network SSID (for wireless events). | [optional] [readonly] +**bssid** | **str** | Wireless network BSSID (for wireless events). | [optional] [readonly] + +## Example + +```python +from thousandeyes_sdk.event_detection.models.wireless_event_grouping import WirelessEventGrouping + +# TODO update the JSON string below +json = "{}" +# create an instance of WirelessEventGrouping from a JSON string +wireless_event_grouping_instance = WirelessEventGrouping.from_json(json) +# print the JSON string representation of the object +print(WirelessEventGrouping.to_json()) + +# convert the object into a dict +wireless_event_grouping_dict = wireless_event_grouping_instance.to_dict() +# create an instance of WirelessEventGrouping from a dict +wireless_event_grouping_from_dict = WirelessEventGrouping.from_dict(wireless_event_grouping_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/__init__.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/__init__.py index 17bb81491..092b0fd54 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/__init__.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/__init__.py @@ -22,15 +22,28 @@ from thousandeyes_sdk.event_detection.models.affected_count import AffectedCount from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.agent_branch_event_detail import AgentBranchEventDetail +from thousandeyes_sdk.event_detection.models.agent_branch_event_grouping import AgentBranchEventGrouping +from thousandeyes_sdk.event_detection.models.agent_event_detail import AgentEventDetail +from thousandeyes_sdk.event_detection.models.agent_event_grouping import AgentEventGrouping from thousandeyes_sdk.event_detection.models.agent_links import AgentLinks from thousandeyes_sdk.event_detection.models.agent_local_event_detail import AgentLocalEventDetail from thousandeyes_sdk.event_detection.models.agent_local_event_grouping import AgentLocalEventGrouping from thousandeyes_sdk.event_detection.models.api_affected_target import ApiAffectedTarget -from thousandeyes_sdk.event_detection.models.cloud_enterprise_agent_type import CloudEnterpriseAgentType +from thousandeyes_sdk.event_detection.models.application_event_detail import ApplicationEventDetail +from thousandeyes_sdk.event_detection.models.application_event_grouping import ApplicationEventGrouping from thousandeyes_sdk.event_detection.models.dns_event_detail import DnsEventDetail from thousandeyes_sdk.event_detection.models.dns_event_grouping import DnsEventGrouping +from thousandeyes_sdk.event_detection.models.dns_name_event_detail import DnsNameEventDetail +from thousandeyes_sdk.event_detection.models.dns_name_event_grouping import DnsNameEventGrouping +from thousandeyes_sdk.event_detection.models.dns_server_event_detail import DnsServerEventDetail +from thousandeyes_sdk.event_detection.models.dns_server_event_grouping import DnsServerEventGrouping +from thousandeyes_sdk.event_detection.models.domain_event_detail import DomainEventDetail +from thousandeyes_sdk.event_detection.models.domain_event_grouping import DomainEventGrouping from thousandeyes_sdk.event_detection.models.error import Error from thousandeyes_sdk.event_detection.models.event import Event +from thousandeyes_sdk.event_detection.models.event_affected_agent_type import EventAffectedAgentType +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity from thousandeyes_sdk.event_detection.models.event_api_affected_agent import EventApiAffectedAgent from thousandeyes_sdk.event_detection.models.event_api_affected_test import EventApiAffectedTest @@ -40,7 +53,11 @@ from thousandeyes_sdk.event_detection.models.event_test_links import EventTestLinks from thousandeyes_sdk.event_detection.models.event_type import EventType from thousandeyes_sdk.event_detection.models.events import Events +from thousandeyes_sdk.event_detection.models.gateway_event_detail import GatewayEventDetail +from thousandeyes_sdk.event_detection.models.gateway_event_grouping import GatewayEventGrouping from thousandeyes_sdk.event_detection.models.link import Link +from thousandeyes_sdk.event_detection.models.name_server_event_detail import NameServerEventDetail +from thousandeyes_sdk.event_detection.models.name_server_event_grouping import NameServerEventGrouping from thousandeyes_sdk.event_detection.models.network_event_detail import NetworkEventDetail from thousandeyes_sdk.event_detection.models.network_event_grouping import NetworkEventGrouping from thousandeyes_sdk.event_detection.models.network_pop_event_detail import NetworkPopEventDetail @@ -57,3 +74,7 @@ from thousandeyes_sdk.event_detection.models.unauthorized_error import UnauthorizedError from thousandeyes_sdk.event_detection.models.validation_error import ValidationError from thousandeyes_sdk.event_detection.models.validation_error_item import ValidationErrorItem +from thousandeyes_sdk.event_detection.models.vpn_event_detail import VpnEventDetail +from thousandeyes_sdk.event_detection.models.vpn_event_grouping import VpnEventGrouping +from thousandeyes_sdk.event_detection.models.wireless_event_detail import WirelessEventDetail +from thousandeyes_sdk.event_detection.models.wireless_event_grouping import WirelessEventGrouping 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 afd97f049..3b98006a8 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 @@ 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 @@ def get_events_paginated( 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 @@ def get_events_paginated( :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 @@ def get_events_paginated( 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 @@ def get_events( 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 @@ def get_events( :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 @@ def get_events( end_date=end_date, max=max, cursor=cursor, + ongoing=ongoing, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -516,6 +523,7 @@ def get_events_with_http_info( 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 @@ def get_events_with_http_info( :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 @@ def get_events_with_http_info( end_date=end_date, max=max, cursor=cursor, + ongoing=ongoing, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -611,6 +622,7 @@ def get_events_without_preload_content( 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 @@ def get_events_without_preload_content( :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 @@ def get_events_without_preload_content( end_date=end_date, max=max, cursor=cursor, + ongoing=ongoing, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -700,6 +715,7 @@ def _get_events_serialize( end_date, max, cursor, + ongoing, _request_auth, _content_type, _headers, @@ -762,6 +778,10 @@ def _get_events_serialize( _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/src/thousandeyes_sdk/event_detection/models/__init__.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/__init__.py index c9364bddc..02890b343 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/__init__.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/__init__.py @@ -17,15 +17,28 @@ from thousandeyes_sdk.event_detection.models.affected_count import AffectedCount from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.agent_branch_event_detail import AgentBranchEventDetail +from thousandeyes_sdk.event_detection.models.agent_branch_event_grouping import AgentBranchEventGrouping +from thousandeyes_sdk.event_detection.models.agent_event_detail import AgentEventDetail +from thousandeyes_sdk.event_detection.models.agent_event_grouping import AgentEventGrouping from thousandeyes_sdk.event_detection.models.agent_links import AgentLinks from thousandeyes_sdk.event_detection.models.agent_local_event_detail import AgentLocalEventDetail from thousandeyes_sdk.event_detection.models.agent_local_event_grouping import AgentLocalEventGrouping from thousandeyes_sdk.event_detection.models.api_affected_target import ApiAffectedTarget -from thousandeyes_sdk.event_detection.models.cloud_enterprise_agent_type import CloudEnterpriseAgentType +from thousandeyes_sdk.event_detection.models.application_event_detail import ApplicationEventDetail +from thousandeyes_sdk.event_detection.models.application_event_grouping import ApplicationEventGrouping from thousandeyes_sdk.event_detection.models.dns_event_detail import DnsEventDetail from thousandeyes_sdk.event_detection.models.dns_event_grouping import DnsEventGrouping +from thousandeyes_sdk.event_detection.models.dns_name_event_detail import DnsNameEventDetail +from thousandeyes_sdk.event_detection.models.dns_name_event_grouping import DnsNameEventGrouping +from thousandeyes_sdk.event_detection.models.dns_server_event_detail import DnsServerEventDetail +from thousandeyes_sdk.event_detection.models.dns_server_event_grouping import DnsServerEventGrouping +from thousandeyes_sdk.event_detection.models.domain_event_detail import DomainEventDetail +from thousandeyes_sdk.event_detection.models.domain_event_grouping import DomainEventGrouping from thousandeyes_sdk.event_detection.models.error import Error from thousandeyes_sdk.event_detection.models.event import Event +from thousandeyes_sdk.event_detection.models.event_affected_agent_type import EventAffectedAgentType +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity from thousandeyes_sdk.event_detection.models.event_api_affected_agent import EventApiAffectedAgent from thousandeyes_sdk.event_detection.models.event_api_affected_test import EventApiAffectedTest @@ -35,7 +48,11 @@ from thousandeyes_sdk.event_detection.models.event_test_links import EventTestLinks from thousandeyes_sdk.event_detection.models.event_type import EventType from thousandeyes_sdk.event_detection.models.events import Events +from thousandeyes_sdk.event_detection.models.gateway_event_detail import GatewayEventDetail +from thousandeyes_sdk.event_detection.models.gateway_event_grouping import GatewayEventGrouping from thousandeyes_sdk.event_detection.models.link import Link +from thousandeyes_sdk.event_detection.models.name_server_event_detail import NameServerEventDetail +from thousandeyes_sdk.event_detection.models.name_server_event_grouping import NameServerEventGrouping from thousandeyes_sdk.event_detection.models.network_event_detail import NetworkEventDetail from thousandeyes_sdk.event_detection.models.network_event_grouping import NetworkEventGrouping from thousandeyes_sdk.event_detection.models.network_pop_event_detail import NetworkPopEventDetail @@ -52,3 +69,7 @@ from thousandeyes_sdk.event_detection.models.unauthorized_error import UnauthorizedError from thousandeyes_sdk.event_detection.models.validation_error import ValidationError from thousandeyes_sdk.event_detection.models.validation_error_item import ValidationErrorItem +from thousandeyes_sdk.event_detection.models.vpn_event_detail import VpnEventDetail +from thousandeyes_sdk.event_detection.models.vpn_event_grouping import VpnEventGrouping +from thousandeyes_sdk.event_detection.models.wireless_event_detail import WirelessEventDetail +from thousandeyes_sdk.event_detection.models.wireless_event_grouping import WirelessEventGrouping diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_branch_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_branch_event_detail.py new file mode 100644 index 000000000..9d82f5f79 --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_branch_event_detail.py @@ -0,0 +1,164 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents +from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets +from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.agent_branch_event_grouping import AgentBranchEventGrouping +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType +from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity +from thousandeyes_sdk.event_detection.models.event_state import EventState +from thousandeyes_sdk.event_detection.models.self_links import SelfLinks +from typing import Optional, Set +from typing_extensions import Self + +class AgentBranchEventDetail(BaseModel): + """ + AgentBranchEventDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique ID for each event.") + type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") + state: Optional[EventState] = None + start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") + severity: Optional[EventAlertSeverity] = None + aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") + summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") + affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") + affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") + affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") + cause: Optional[List[StrictStr]] = Field(default=None, description="The cause of the error.") + links: Optional[SelfLinks] = Field(default=None, alias="_links") + type: Annotated[str, Field(strict=True)] = Field(description="Agent branch event type.") + grouping: Optional[AgentBranchEventGrouping] = None + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^agent-branch$", value): + raise ValueError(r"must validate the regular expression /^agent-branch$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AgentBranchEventDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "type_name", + "start_date", + "end_date", + "summary", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of affected_tests + if self.affected_tests: + _dict['affectedTests'] = self.affected_tests.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_targets + if self.affected_targets: + _dict['affectedTargets'] = self.affected_targets.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_agents + if self.affected_agents: + _dict['affectedAgents'] = self.affected_agents.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of grouping + if self.grouping: + _dict['grouping'] = self.grouping.to_dict() + # set to None if end_date (nullable) is None + # and model_fields_set contains the field + if self.end_date is None and "end_date" in self.model_fields_set: + _dict['endDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AgentBranchEventDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "typeName": obj.get("typeName"), + "state": obj.get("state"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate"), + "severity": obj.get("severity"), + "aid": obj.get("aid"), + "summary": obj.get("summary"), + "agentType": obj.get("agentType"), + "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, + "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, + "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, + "cause": obj.get("cause"), + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "type": obj.get("type"), + "grouping": AgentBranchEventGrouping.from_dict(obj["grouping"]) if obj.get("grouping") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_branch_event_grouping.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_branch_event_grouping.py new file mode 100644 index 000000000..080302cd1 --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_branch_event_grouping.py @@ -0,0 +1,93 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class AgentBranchEventGrouping(BaseModel): + """ + AgentBranchEventGrouping + """ # noqa: E501 + asn: Optional[StrictInt] = Field(default=None, description="AS number of the agent's network (for agent-branch events).") + asn_city: Optional[StrictStr] = Field(default=None, description="City associated with the agent's AS (for agent-branch events).", alias="asnCity") + __properties: ClassVar[List[str]] = ["asn", "asnCity"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AgentBranchEventGrouping from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "asn", + "asn_city", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AgentBranchEventGrouping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "asn": obj.get("asn"), + "asnCity": obj.get("asnCity") + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_event_detail.py new file mode 100644 index 000000000..457167065 --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_event_detail.py @@ -0,0 +1,164 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents +from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets +from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.agent_event_grouping import AgentEventGrouping +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType +from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity +from thousandeyes_sdk.event_detection.models.event_state import EventState +from thousandeyes_sdk.event_detection.models.self_links import SelfLinks +from typing import Optional, Set +from typing_extensions import Self + +class AgentEventDetail(BaseModel): + """ + AgentEventDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique ID for each event.") + type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") + state: Optional[EventState] = None + start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") + severity: Optional[EventAlertSeverity] = None + aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") + summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") + affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") + affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") + affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") + cause: Optional[List[StrictStr]] = Field(default=None, description="The cause of the error.") + links: Optional[SelfLinks] = Field(default=None, alias="_links") + type: Annotated[str, Field(strict=True)] = Field(description="Agent event type.") + grouping: Optional[AgentEventGrouping] = None + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^agent$", value): + raise ValueError(r"must validate the regular expression /^agent$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AgentEventDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "type_name", + "start_date", + "end_date", + "summary", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of affected_tests + if self.affected_tests: + _dict['affectedTests'] = self.affected_tests.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_targets + if self.affected_targets: + _dict['affectedTargets'] = self.affected_targets.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_agents + if self.affected_agents: + _dict['affectedAgents'] = self.affected_agents.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of grouping + if self.grouping: + _dict['grouping'] = self.grouping.to_dict() + # set to None if end_date (nullable) is None + # and model_fields_set contains the field + if self.end_date is None and "end_date" in self.model_fields_set: + _dict['endDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AgentEventDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "typeName": obj.get("typeName"), + "state": obj.get("state"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate"), + "severity": obj.get("severity"), + "aid": obj.get("aid"), + "summary": obj.get("summary"), + "agentType": obj.get("agentType"), + "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, + "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, + "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, + "cause": obj.get("cause"), + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "type": obj.get("type"), + "grouping": AgentEventGrouping.from_dict(obj["grouping"]) if obj.get("grouping") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_event_grouping.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_event_grouping.py new file mode 100644 index 000000000..4cca640ca --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_event_grouping.py @@ -0,0 +1,89 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class AgentEventGrouping(BaseModel): + """ + AgentEventGrouping + """ # noqa: E501 + agent_id: Optional[StrictStr] = Field(default=None, description="Agent identifier (for agent events). Represents the machine ID for Endpoint Agents or the virtual agent ID for Cloud and Enterprise Agents'.", alias="agentId") + __properties: ClassVar[List[str]] = ["agentId"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AgentEventGrouping from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "agent_id", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AgentEventGrouping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "agentId": obj.get("agentId") + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_local_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_local_event_detail.py index 3f3be0289..66b286327 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_local_event_detail.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/agent_local_event_detail.py @@ -24,6 +24,7 @@ from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests from thousandeyes_sdk.event_detection.models.agent_local_event_grouping import AgentLocalEventGrouping +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity from thousandeyes_sdk.event_detection.models.event_state import EventState from thousandeyes_sdk.event_detection.models.self_links import SelfLinks @@ -38,10 +39,11 @@ class AgentLocalEventDetail(BaseModel): type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") state: Optional[EventState] = None start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") - end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events.", alias="endDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") severity: Optional[EventAlertSeverity] = None aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") @@ -49,7 +51,7 @@ class AgentLocalEventDetail(BaseModel): links: Optional[SelfLinks] = Field(default=None, alias="_links") type: Annotated[str, Field(strict=True)] = Field(description="Agent local event type.") grouping: Optional[AgentLocalEventGrouping] = None - __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] @field_validator('type') def type_validate_regular_expression(cls, value): @@ -148,6 +150,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "severity": obj.get("severity"), "aid": obj.get("aid"), "summary": obj.get("summary"), + "agentType": obj.get("agentType"), "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/application_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/application_event_detail.py new file mode 100644 index 000000000..9f02d54cf --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/application_event_detail.py @@ -0,0 +1,164 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents +from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets +from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.application_event_grouping import ApplicationEventGrouping +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType +from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity +from thousandeyes_sdk.event_detection.models.event_state import EventState +from thousandeyes_sdk.event_detection.models.self_links import SelfLinks +from typing import Optional, Set +from typing_extensions import Self + +class ApplicationEventDetail(BaseModel): + """ + ApplicationEventDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique ID for each event.") + type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") + state: Optional[EventState] = None + start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") + severity: Optional[EventAlertSeverity] = None + aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") + summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") + affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") + affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") + affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") + cause: Optional[List[StrictStr]] = Field(default=None, description="The cause of the error.") + links: Optional[SelfLinks] = Field(default=None, alias="_links") + type: Annotated[str, Field(strict=True)] = Field(description="Application event type.") + grouping: Optional[ApplicationEventGrouping] = None + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^application$", value): + raise ValueError(r"must validate the regular expression /^application$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApplicationEventDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "type_name", + "start_date", + "end_date", + "summary", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of affected_tests + if self.affected_tests: + _dict['affectedTests'] = self.affected_tests.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_targets + if self.affected_targets: + _dict['affectedTargets'] = self.affected_targets.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_agents + if self.affected_agents: + _dict['affectedAgents'] = self.affected_agents.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of grouping + if self.grouping: + _dict['grouping'] = self.grouping.to_dict() + # set to None if end_date (nullable) is None + # and model_fields_set contains the field + if self.end_date is None and "end_date" in self.model_fields_set: + _dict['endDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApplicationEventDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "typeName": obj.get("typeName"), + "state": obj.get("state"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate"), + "severity": obj.get("severity"), + "aid": obj.get("aid"), + "summary": obj.get("summary"), + "agentType": obj.get("agentType"), + "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, + "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, + "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, + "cause": obj.get("cause"), + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "type": obj.get("type"), + "grouping": ApplicationEventGrouping.from_dict(obj["grouping"]) if obj.get("grouping") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/application_event_grouping.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/application_event_grouping.py new file mode 100644 index 000000000..7b993dba8 --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/application_event_grouping.py @@ -0,0 +1,89 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ApplicationEventGrouping(BaseModel): + """ + ApplicationEventGrouping + """ # noqa: E501 + fqdn: Optional[StrictStr] = Field(default=None, description="Fully qualified domain name of the application (for application events).") + __properties: ClassVar[List[str]] = ["fqdn"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApplicationEventGrouping from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "fqdn", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApplicationEventGrouping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "fqdn": obj.get("fqdn") + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_event_detail.py index c8bde281e..532027dd2 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_event_detail.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_event_detail.py @@ -24,6 +24,7 @@ from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests from thousandeyes_sdk.event_detection.models.dns_event_grouping import DnsEventGrouping +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity from thousandeyes_sdk.event_detection.models.event_state import EventState from thousandeyes_sdk.event_detection.models.self_links import SelfLinks @@ -38,10 +39,11 @@ class DnsEventDetail(BaseModel): type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") state: Optional[EventState] = None start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") - end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events.", alias="endDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") severity: Optional[EventAlertSeverity] = None aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") @@ -49,7 +51,7 @@ class DnsEventDetail(BaseModel): links: Optional[SelfLinks] = Field(default=None, alias="_links") type: Annotated[str, Field(strict=True)] = Field(description="DNS event type.") grouping: Optional[DnsEventGrouping] = None - __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] @field_validator('type') def type_validate_regular_expression(cls, value): @@ -148,6 +150,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "severity": obj.get("severity"), "aid": obj.get("aid"), "summary": obj.get("summary"), + "agentType": obj.get("agentType"), "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_name_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_name_event_detail.py new file mode 100644 index 000000000..3c48cbabc --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_name_event_detail.py @@ -0,0 +1,164 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents +from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets +from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.dns_name_event_grouping import DnsNameEventGrouping +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType +from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity +from thousandeyes_sdk.event_detection.models.event_state import EventState +from thousandeyes_sdk.event_detection.models.self_links import SelfLinks +from typing import Optional, Set +from typing_extensions import Self + +class DnsNameEventDetail(BaseModel): + """ + DnsNameEventDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique ID for each event.") + type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") + state: Optional[EventState] = None + start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") + severity: Optional[EventAlertSeverity] = None + aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") + summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") + affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") + affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") + affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") + cause: Optional[List[StrictStr]] = Field(default=None, description="The cause of the error.") + links: Optional[SelfLinks] = Field(default=None, alias="_links") + type: Annotated[str, Field(strict=True)] = Field(description="DNS name event type.") + grouping: Optional[DnsNameEventGrouping] = None + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^dns-name$", value): + raise ValueError(r"must validate the regular expression /^dns-name$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DnsNameEventDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "type_name", + "start_date", + "end_date", + "summary", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of affected_tests + if self.affected_tests: + _dict['affectedTests'] = self.affected_tests.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_targets + if self.affected_targets: + _dict['affectedTargets'] = self.affected_targets.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_agents + if self.affected_agents: + _dict['affectedAgents'] = self.affected_agents.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of grouping + if self.grouping: + _dict['grouping'] = self.grouping.to_dict() + # set to None if end_date (nullable) is None + # and model_fields_set contains the field + if self.end_date is None and "end_date" in self.model_fields_set: + _dict['endDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DnsNameEventDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "typeName": obj.get("typeName"), + "state": obj.get("state"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate"), + "severity": obj.get("severity"), + "aid": obj.get("aid"), + "summary": obj.get("summary"), + "agentType": obj.get("agentType"), + "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, + "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, + "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, + "cause": obj.get("cause"), + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "type": obj.get("type"), + "grouping": DnsNameEventGrouping.from_dict(obj["grouping"]) if obj.get("grouping") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_name_event_grouping.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_name_event_grouping.py new file mode 100644 index 000000000..3ffaed8eb --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_name_event_grouping.py @@ -0,0 +1,89 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DnsNameEventGrouping(BaseModel): + """ + DnsNameEventGrouping + """ # noqa: E501 + domain_name_suffix: Optional[StrictStr] = Field(default=None, description="Domain name suffix (for dns-name events).", alias="domainNameSuffix") + __properties: ClassVar[List[str]] = ["domainNameSuffix"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DnsNameEventGrouping from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "domain_name_suffix", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DnsNameEventGrouping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "domainNameSuffix": obj.get("domainNameSuffix") + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_server_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_server_event_detail.py new file mode 100644 index 000000000..f5c10354d --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_server_event_detail.py @@ -0,0 +1,164 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents +from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets +from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.dns_server_event_grouping import DnsServerEventGrouping +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType +from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity +from thousandeyes_sdk.event_detection.models.event_state import EventState +from thousandeyes_sdk.event_detection.models.self_links import SelfLinks +from typing import Optional, Set +from typing_extensions import Self + +class DnsServerEventDetail(BaseModel): + """ + DnsServerEventDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique ID for each event.") + type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") + state: Optional[EventState] = None + start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") + severity: Optional[EventAlertSeverity] = None + aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") + summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") + affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") + affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") + affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") + cause: Optional[List[StrictStr]] = Field(default=None, description="The cause of the error.") + links: Optional[SelfLinks] = Field(default=None, alias="_links") + type: Annotated[str, Field(strict=True)] = Field(description="DNS server event type.") + grouping: Optional[DnsServerEventGrouping] = None + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^dns-server$", value): + raise ValueError(r"must validate the regular expression /^dns-server$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DnsServerEventDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "type_name", + "start_date", + "end_date", + "summary", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of affected_tests + if self.affected_tests: + _dict['affectedTests'] = self.affected_tests.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_targets + if self.affected_targets: + _dict['affectedTargets'] = self.affected_targets.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_agents + if self.affected_agents: + _dict['affectedAgents'] = self.affected_agents.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of grouping + if self.grouping: + _dict['grouping'] = self.grouping.to_dict() + # set to None if end_date (nullable) is None + # and model_fields_set contains the field + if self.end_date is None and "end_date" in self.model_fields_set: + _dict['endDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DnsServerEventDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "typeName": obj.get("typeName"), + "state": obj.get("state"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate"), + "severity": obj.get("severity"), + "aid": obj.get("aid"), + "summary": obj.get("summary"), + "agentType": obj.get("agentType"), + "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, + "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, + "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, + "cause": obj.get("cause"), + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "type": obj.get("type"), + "grouping": DnsServerEventGrouping.from_dict(obj["grouping"]) if obj.get("grouping") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_server_event_grouping.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_server_event_grouping.py new file mode 100644 index 000000000..caeb5019e --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/dns_server_event_grouping.py @@ -0,0 +1,89 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DnsServerEventGrouping(BaseModel): + """ + DnsServerEventGrouping + """ # noqa: E501 + ip_address: Optional[StrictStr] = Field(default=None, description="DNS server IP address (for dns-server events).", alias="ipAddress") + __properties: ClassVar[List[str]] = ["ipAddress"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DnsServerEventGrouping from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "ip_address", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DnsServerEventGrouping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ipAddress": obj.get("ipAddress") + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/domain_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/domain_event_detail.py new file mode 100644 index 000000000..c2be7c6bf --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/domain_event_detail.py @@ -0,0 +1,164 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents +from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets +from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.domain_event_grouping import DomainEventGrouping +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType +from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity +from thousandeyes_sdk.event_detection.models.event_state import EventState +from thousandeyes_sdk.event_detection.models.self_links import SelfLinks +from typing import Optional, Set +from typing_extensions import Self + +class DomainEventDetail(BaseModel): + """ + DomainEventDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique ID for each event.") + type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") + state: Optional[EventState] = None + start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") + severity: Optional[EventAlertSeverity] = None + aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") + summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") + affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") + affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") + affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") + cause: Optional[List[StrictStr]] = Field(default=None, description="The cause of the error.") + links: Optional[SelfLinks] = Field(default=None, alias="_links") + type: Annotated[str, Field(strict=True)] = Field(description="Domain event type.") + grouping: Optional[DomainEventGrouping] = None + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^domain$", value): + raise ValueError(r"must validate the regular expression /^domain$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DomainEventDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "type_name", + "start_date", + "end_date", + "summary", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of affected_tests + if self.affected_tests: + _dict['affectedTests'] = self.affected_tests.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_targets + if self.affected_targets: + _dict['affectedTargets'] = self.affected_targets.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_agents + if self.affected_agents: + _dict['affectedAgents'] = self.affected_agents.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of grouping + if self.grouping: + _dict['grouping'] = self.grouping.to_dict() + # set to None if end_date (nullable) is None + # and model_fields_set contains the field + if self.end_date is None and "end_date" in self.model_fields_set: + _dict['endDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DomainEventDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "typeName": obj.get("typeName"), + "state": obj.get("state"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate"), + "severity": obj.get("severity"), + "aid": obj.get("aid"), + "summary": obj.get("summary"), + "agentType": obj.get("agentType"), + "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, + "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, + "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, + "cause": obj.get("cause"), + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "type": obj.get("type"), + "grouping": DomainEventGrouping.from_dict(obj["grouping"]) if obj.get("grouping") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/domain_event_grouping.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/domain_event_grouping.py new file mode 100644 index 000000000..f53108696 --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/domain_event_grouping.py @@ -0,0 +1,89 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DomainEventGrouping(BaseModel): + """ + DomainEventGrouping + """ # noqa: E501 + fqdn: Optional[StrictStr] = Field(default=None, description="Fully qualified domain name (for domain events).") + __properties: ClassVar[List[str]] = ["fqdn"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DomainEventGrouping from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "fqdn", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DomainEventGrouping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "fqdn": obj.get("fqdn") + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event.py index 14dfdd757..20e8d2744 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional from thousandeyes_sdk.event_detection.models.affected_count import AffectedCount +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity from thousandeyes_sdk.event_detection.models.event_state import EventState from thousandeyes_sdk.event_detection.models.event_type import EventType @@ -35,15 +36,16 @@ class Event(BaseModel): type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") state: Optional[EventState] = None start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") - end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events.", alias="endDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") severity: Optional[EventAlertSeverity] = None title: Optional[StrictStr] = Field(default=None, description="Event title") type: Optional[EventType] = None + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") affected_tests: Optional[AffectedCount] = Field(default=None, alias="affectedTests") affected_targets: Optional[AffectedCount] = Field(default=None, alias="affectedTargets") affected_agents: Optional[AffectedCount] = Field(default=None, alias="affectedAgents") links: Optional[SelfLinks] = Field(default=None, alias="_links") - __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "title", "type", "affectedTests", "affectedTargets", "affectedAgents", "_links"] + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "title", "type", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "_links"] model_config = ConfigDict( populate_by_name=True, @@ -132,6 +134,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "severity": obj.get("severity"), "title": obj.get("title"), "type": obj.get("type"), + "agentType": obj.get("agentType"), "affectedTests": AffectedCount.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, "affectedTargets": AffectedCount.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, "affectedAgents": AffectedCount.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/cloud_enterprise_agent_type.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_affected_agent_type.py similarity index 86% rename from thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/cloud_enterprise_agent_type.py rename to thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_affected_agent_type.py index ff2ca4ae0..a7f593b1d 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/cloud_enterprise_agent_type.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_affected_agent_type.py @@ -17,9 +17,9 @@ from typing_extensions import Self -class CloudEnterpriseAgentType(str, Enum): +class EventAffectedAgentType(str, Enum): """ - Type of the agent. + Type of the affected agent. """ """ @@ -28,11 +28,14 @@ class CloudEnterpriseAgentType(str, Enum): CLOUD = 'cloud' ENTERPRISE_MINUS_CLUSTER = 'enterprise-cluster' ENTERPRISE = 'enterprise' + ENTERPRISE_MINUS_LITE = 'enterprise-lite' + ENTERPRISE_MINUS_PULSE = 'enterprise-pulse' + ENTERPRISE_MINUS_CSC = 'enterprise-csc' UNKNOWN = 'unknown' @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of CloudEnterpriseAgentType from a JSON string""" + """Create an instance of EventAffectedAgentType from a JSON string""" return cls(json.loads(json_str)) @classmethod diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_agent_type.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_agent_type.py new file mode 100644 index 000000000..4eaf255e3 --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_agent_type.py @@ -0,0 +1,41 @@ +# 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 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class EventAgentType(str, Enum): + """ + Specifies the agent type associated with the event. Allowed values are `cloud-enterprise-agent` and `endpoint-agent`. + """ + + """ + allowed enum values + """ + CLOUD_MINUS_ENTERPRISE_MINUS_AGENT = 'cloud-enterprise-agent' + ENDPOINT_MINUS_AGENT = 'endpoint-agent' + UNKNOWN = 'unknown' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of EventAgentType from a JSON string""" + return cls(json.loads(json_str)) + + @classmethod + def _missing_(cls, value): + """Handle unknown values""" + return cls.UNKNOWN + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_api_affected_agent.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_api_affected_agent.py index 5192944cb..53c68a467 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_api_affected_agent.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_api_affected_agent.py @@ -19,7 +19,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional from thousandeyes_sdk.event_detection.models.agent_links import AgentLinks -from thousandeyes_sdk.event_detection.models.cloud_enterprise_agent_type import CloudEnterpriseAgentType +from thousandeyes_sdk.event_detection.models.event_affected_agent_type import EventAffectedAgentType from typing import Optional, Set from typing_extensions import Self @@ -28,7 +28,7 @@ class EventApiAffectedAgent(BaseModel): EventApiAffectedAgent """ # noqa: E501 agent_id: Optional[StrictStr] = Field(default=None, description="The ID of the virtual agent.", alias="agentId") - type: Optional[CloudEnterpriseAgentType] = None + type: Optional[EventAffectedAgentType] = None name: Optional[StrictStr] = Field(default=None, description="The name of the agent as defined in settings.") location: Optional[StrictStr] = Field(default=None, description="The name of the agent's location.") country_code: Optional[StrictStr] = Field(default=None, description="The country code of the agent's location .", alias="countryCode") diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_detail.py index 45283f05c..ea34581d2 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_detail.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_detail.py @@ -16,18 +16,28 @@ import pprint from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional +from thousandeyes_sdk.event_detection.models.agent_branch_event_detail import AgentBranchEventDetail +from thousandeyes_sdk.event_detection.models.agent_event_detail import AgentEventDetail from thousandeyes_sdk.event_detection.models.agent_local_event_detail import AgentLocalEventDetail +from thousandeyes_sdk.event_detection.models.application_event_detail import ApplicationEventDetail from thousandeyes_sdk.event_detection.models.dns_event_detail import DnsEventDetail +from thousandeyes_sdk.event_detection.models.dns_name_event_detail import DnsNameEventDetail +from thousandeyes_sdk.event_detection.models.dns_server_event_detail import DnsServerEventDetail +from thousandeyes_sdk.event_detection.models.domain_event_detail import DomainEventDetail +from thousandeyes_sdk.event_detection.models.gateway_event_detail import GatewayEventDetail +from thousandeyes_sdk.event_detection.models.name_server_event_detail import NameServerEventDetail from thousandeyes_sdk.event_detection.models.network_event_detail import NetworkEventDetail from thousandeyes_sdk.event_detection.models.network_pop_event_detail import NetworkPopEventDetail from thousandeyes_sdk.event_detection.models.proxy_event_detail import ProxyEventDetail from thousandeyes_sdk.event_detection.models.target_event_detail import TargetEventDetail from thousandeyes_sdk.event_detection.models.target_network_event_detail import TargetNetworkEventDetail +from thousandeyes_sdk.event_detection.models.vpn_event_detail import VpnEventDetail +from thousandeyes_sdk.event_detection.models.wireless_event_detail import WirelessEventDetail from pydantic import StrictStr, Field, model_serializer from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -EVENTDETAIL_ONE_OF_SCHEMAS = ["AgentLocalEventDetail", "DnsEventDetail", "NetworkEventDetail", "NetworkPopEventDetail", "ProxyEventDetail", "TargetEventDetail", "TargetNetworkEventDetail"] +EVENTDETAIL_ONE_OF_SCHEMAS = ["AgentBranchEventDetail", "AgentEventDetail", "AgentLocalEventDetail", "ApplicationEventDetail", "DnsEventDetail", "DnsNameEventDetail", "DnsServerEventDetail", "DomainEventDetail", "GatewayEventDetail", "NameServerEventDetail", "NetworkEventDetail", "NetworkPopEventDetail", "ProxyEventDetail", "TargetEventDetail", "TargetNetworkEventDetail", "VpnEventDetail", "WirelessEventDetail"] class EventDetail(BaseModel): """ @@ -47,8 +57,28 @@ class EventDetail(BaseModel): oneof_schema_6_validator: Optional[NetworkEventDetail] = None # data type: NetworkPopEventDetail oneof_schema_7_validator: Optional[NetworkPopEventDetail] = None - actual_instance: Optional[Union[AgentLocalEventDetail, DnsEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail]] = None - one_of_schemas: Set[str] = { "AgentLocalEventDetail", "DnsEventDetail", "NetworkEventDetail", "NetworkPopEventDetail", "ProxyEventDetail", "TargetEventDetail", "TargetNetworkEventDetail" } + # data type: AgentEventDetail + oneof_schema_8_validator: Optional[AgentEventDetail] = None + # data type: ApplicationEventDetail + oneof_schema_9_validator: Optional[ApplicationEventDetail] = None + # data type: WirelessEventDetail + oneof_schema_10_validator: Optional[WirelessEventDetail] = None + # data type: GatewayEventDetail + oneof_schema_11_validator: Optional[GatewayEventDetail] = None + # data type: DnsServerEventDetail + oneof_schema_12_validator: Optional[DnsServerEventDetail] = None + # data type: DnsNameEventDetail + oneof_schema_13_validator: Optional[DnsNameEventDetail] = None + # data type: VpnEventDetail + oneof_schema_14_validator: Optional[VpnEventDetail] = None + # data type: AgentBranchEventDetail + oneof_schema_15_validator: Optional[AgentBranchEventDetail] = None + # data type: DomainEventDetail + oneof_schema_16_validator: Optional[DomainEventDetail] = None + # data type: NameServerEventDetail + oneof_schema_17_validator: Optional[NameServerEventDetail] = None + actual_instance: Optional[Union[AgentBranchEventDetail, AgentEventDetail, AgentLocalEventDetail, ApplicationEventDetail, DnsEventDetail, DnsNameEventDetail, DnsServerEventDetail, DomainEventDetail, GatewayEventDetail, NameServerEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail, VpnEventDetail, WirelessEventDetail]] = None + one_of_schemas: Set[str] = { "AgentBranchEventDetail", "AgentEventDetail", "AgentLocalEventDetail", "ApplicationEventDetail", "DnsEventDetail", "DnsNameEventDetail", "DnsServerEventDetail", "DomainEventDetail", "GatewayEventDetail", "NameServerEventDetail", "NetworkEventDetail", "NetworkPopEventDetail", "ProxyEventDetail", "TargetEventDetail", "TargetNetworkEventDetail", "VpnEventDetail", "WirelessEventDetail" } model_config = ConfigDict( validate_assignment=True, @@ -109,12 +139,62 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `NetworkPopEventDetail`") else: match += 1 + # validate data type: AgentEventDetail + if not isinstance(v, AgentEventDetail): + error_messages.append(f"Error! Input type `{type(v)}` is not `AgentEventDetail`") + else: + match += 1 + # validate data type: ApplicationEventDetail + if not isinstance(v, ApplicationEventDetail): + error_messages.append(f"Error! Input type `{type(v)}` is not `ApplicationEventDetail`") + else: + match += 1 + # validate data type: WirelessEventDetail + if not isinstance(v, WirelessEventDetail): + error_messages.append(f"Error! Input type `{type(v)}` is not `WirelessEventDetail`") + else: + match += 1 + # validate data type: GatewayEventDetail + if not isinstance(v, GatewayEventDetail): + error_messages.append(f"Error! Input type `{type(v)}` is not `GatewayEventDetail`") + else: + match += 1 + # validate data type: DnsServerEventDetail + if not isinstance(v, DnsServerEventDetail): + error_messages.append(f"Error! Input type `{type(v)}` is not `DnsServerEventDetail`") + else: + match += 1 + # validate data type: DnsNameEventDetail + if not isinstance(v, DnsNameEventDetail): + error_messages.append(f"Error! Input type `{type(v)}` is not `DnsNameEventDetail`") + else: + match += 1 + # validate data type: VpnEventDetail + if not isinstance(v, VpnEventDetail): + error_messages.append(f"Error! Input type `{type(v)}` is not `VpnEventDetail`") + else: + match += 1 + # validate data type: AgentBranchEventDetail + if not isinstance(v, AgentBranchEventDetail): + error_messages.append(f"Error! Input type `{type(v)}` is not `AgentBranchEventDetail`") + else: + match += 1 + # validate data type: DomainEventDetail + if not isinstance(v, DomainEventDetail): + error_messages.append(f"Error! Input type `{type(v)}` is not `DomainEventDetail`") + else: + match += 1 + # validate data type: NameServerEventDetail + if not isinstance(v, NameServerEventDetail): + error_messages.append(f"Error! Input type `{type(v)}` is not `NameServerEventDetail`") + else: + match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in EventDetail with oneOf schemas: AgentLocalEventDetail, DnsEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in EventDetail with oneOf schemas: AgentBranchEventDetail, AgentEventDetail, AgentLocalEventDetail, ApplicationEventDetail, DnsEventDetail, DnsNameEventDetail, DnsServerEventDetail, DomainEventDetail, GatewayEventDetail, NameServerEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail, VpnEventDetail, WirelessEventDetail. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in EventDetail with oneOf schemas: AgentLocalEventDetail, DnsEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in EventDetail with oneOf schemas: AgentBranchEventDetail, AgentEventDetail, AgentLocalEventDetail, ApplicationEventDetail, DnsEventDetail, DnsNameEventDetail, DnsServerEventDetail, DomainEventDetail, GatewayEventDetail, NameServerEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail, VpnEventDetail, WirelessEventDetail. Details: " + ", ".join(error_messages)) else: return v @@ -171,13 +251,73 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) + # deserialize data into AgentEventDetail + try: + instance.actual_instance = AgentEventDetail.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ApplicationEventDetail + try: + instance.actual_instance = ApplicationEventDetail.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into WirelessEventDetail + try: + instance.actual_instance = WirelessEventDetail.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into GatewayEventDetail + try: + instance.actual_instance = GatewayEventDetail.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into DnsServerEventDetail + try: + instance.actual_instance = DnsServerEventDetail.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into DnsNameEventDetail + try: + instance.actual_instance = DnsNameEventDetail.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into VpnEventDetail + try: + instance.actual_instance = VpnEventDetail.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into AgentBranchEventDetail + try: + instance.actual_instance = AgentBranchEventDetail.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into DomainEventDetail + try: + instance.actual_instance = DomainEventDetail.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into NameServerEventDetail + try: + instance.actual_instance = NameServerEventDetail.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into EventDetail with oneOf schemas: AgentLocalEventDetail, DnsEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into EventDetail with oneOf schemas: AgentBranchEventDetail, AgentEventDetail, AgentLocalEventDetail, ApplicationEventDetail, DnsEventDetail, DnsNameEventDetail, DnsServerEventDetail, DomainEventDetail, GatewayEventDetail, NameServerEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail, VpnEventDetail, WirelessEventDetail. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into EventDetail with oneOf schemas: AgentLocalEventDetail, DnsEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into EventDetail with oneOf schemas: AgentBranchEventDetail, AgentEventDetail, AgentLocalEventDetail, ApplicationEventDetail, DnsEventDetail, DnsNameEventDetail, DnsServerEventDetail, DomainEventDetail, GatewayEventDetail, NameServerEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail, VpnEventDetail, WirelessEventDetail. Details: " + ", ".join(error_messages)) else: return instance @@ -195,7 +335,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], AgentLocalEventDetail, DnsEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], AgentBranchEventDetail, AgentEventDetail, AgentLocalEventDetail, ApplicationEventDetail, DnsEventDetail, DnsNameEventDetail, DnsServerEventDetail, DomainEventDetail, GatewayEventDetail, NameServerEventDetail, NetworkEventDetail, NetworkPopEventDetail, ProxyEventDetail, TargetEventDetail, TargetNetworkEventDetail, VpnEventDetail, WirelessEventDetail]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_detail_base.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_detail_base.py index b71866509..ee0b5a9aa 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_detail_base.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_detail_base.py @@ -22,6 +22,7 @@ from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity from thousandeyes_sdk.event_detection.models.event_state import EventState from thousandeyes_sdk.event_detection.models.self_links import SelfLinks @@ -36,16 +37,17 @@ class EventDetailBase(BaseModel): type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") state: Optional[EventState] = None start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") - end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events.", alias="endDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") severity: Optional[EventAlertSeverity] = None aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") cause: Optional[List[StrictStr]] = Field(default=None, description="The cause of the error.") links: Optional[SelfLinks] = Field(default=None, alias="_links") - __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links"] + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links"] model_config = ConfigDict( populate_by_name=True, @@ -134,6 +136,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "severity": obj.get("severity"), "aid": obj.get("aid"), "summary": obj.get("summary"), + "agentType": obj.get("agentType"), "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_type.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_type.py index c9688b51a..2e6114579 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_type.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/event_type.py @@ -19,7 +19,7 @@ class EventType(str, Enum): """ - Specifies the event type in a machine-readable and backwards-compatible format. Allowed values are: `agent-local`, `network-pop`, `network`, `dns`, `target`, and `proxy`. + Specifies the event type in a machine-readable and backwards-compatible format, such as `agent` or `target`. """ """ @@ -32,6 +32,16 @@ class EventType(str, Enum): TARGET = 'target' TARGET_MINUS_NETWORK = 'target-network' PROXY = 'proxy' + AGENT = 'agent' + APPLICATION = 'application' + WIRELESS = 'wireless' + GATEWAY = 'gateway' + DNS_MINUS_SERVER = 'dns-server' + DNS_MINUS_NAME = 'dns-name' + VPN = 'vpn' + AGENT_MINUS_BRANCH = 'agent-branch' + DOMAIN = 'domain' + NAME_MINUS_SERVER = 'name-server' UNKNOWN = 'unknown' @classmethod diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/gateway_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/gateway_event_detail.py new file mode 100644 index 000000000..b0c9d32c0 --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/gateway_event_detail.py @@ -0,0 +1,164 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents +from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets +from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType +from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity +from thousandeyes_sdk.event_detection.models.event_state import EventState +from thousandeyes_sdk.event_detection.models.gateway_event_grouping import GatewayEventGrouping +from thousandeyes_sdk.event_detection.models.self_links import SelfLinks +from typing import Optional, Set +from typing_extensions import Self + +class GatewayEventDetail(BaseModel): + """ + GatewayEventDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique ID for each event.") + type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") + state: Optional[EventState] = None + start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") + severity: Optional[EventAlertSeverity] = None + aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") + summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") + affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") + affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") + affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") + cause: Optional[List[StrictStr]] = Field(default=None, description="The cause of the error.") + links: Optional[SelfLinks] = Field(default=None, alias="_links") + type: Annotated[str, Field(strict=True)] = Field(description="Gateway event type.") + grouping: Optional[GatewayEventGrouping] = None + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^gateway$", value): + raise ValueError(r"must validate the regular expression /^gateway$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GatewayEventDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "type_name", + "start_date", + "end_date", + "summary", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of affected_tests + if self.affected_tests: + _dict['affectedTests'] = self.affected_tests.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_targets + if self.affected_targets: + _dict['affectedTargets'] = self.affected_targets.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_agents + if self.affected_agents: + _dict['affectedAgents'] = self.affected_agents.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of grouping + if self.grouping: + _dict['grouping'] = self.grouping.to_dict() + # set to None if end_date (nullable) is None + # and model_fields_set contains the field + if self.end_date is None and "end_date" in self.model_fields_set: + _dict['endDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GatewayEventDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "typeName": obj.get("typeName"), + "state": obj.get("state"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate"), + "severity": obj.get("severity"), + "aid": obj.get("aid"), + "summary": obj.get("summary"), + "agentType": obj.get("agentType"), + "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, + "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, + "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, + "cause": obj.get("cause"), + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "type": obj.get("type"), + "grouping": GatewayEventGrouping.from_dict(obj["grouping"]) if obj.get("grouping") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/gateway_event_grouping.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/gateway_event_grouping.py new file mode 100644 index 000000000..ca3b4bf4d --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/gateway_event_grouping.py @@ -0,0 +1,93 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class GatewayEventGrouping(BaseModel): + """ + GatewayEventGrouping + """ # noqa: E501 + ip_address: Optional[StrictStr] = Field(default=None, description="Gateway IP address (for gateway events).", alias="ipAddress") + mac_address: Optional[StrictStr] = Field(default=None, description="Gateway MAC address (for gateway events).", alias="macAddress") + __properties: ClassVar[List[str]] = ["ipAddress", "macAddress"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GatewayEventGrouping from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "ip_address", + "mac_address", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GatewayEventGrouping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ipAddress": obj.get("ipAddress"), + "macAddress": obj.get("macAddress") + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/name_server_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/name_server_event_detail.py new file mode 100644 index 000000000..2fe9d1836 --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/name_server_event_detail.py @@ -0,0 +1,164 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents +from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets +from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType +from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity +from thousandeyes_sdk.event_detection.models.event_state import EventState +from thousandeyes_sdk.event_detection.models.name_server_event_grouping import NameServerEventGrouping +from thousandeyes_sdk.event_detection.models.self_links import SelfLinks +from typing import Optional, Set +from typing_extensions import Self + +class NameServerEventDetail(BaseModel): + """ + NameServerEventDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique ID for each event.") + type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") + state: Optional[EventState] = None + start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") + severity: Optional[EventAlertSeverity] = None + aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") + summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") + affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") + affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") + affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") + cause: Optional[List[StrictStr]] = Field(default=None, description="The cause of the error.") + links: Optional[SelfLinks] = Field(default=None, alias="_links") + type: Annotated[str, Field(strict=True)] = Field(description="Name server event type.") + grouping: Optional[NameServerEventGrouping] = None + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^name-server$", value): + raise ValueError(r"must validate the regular expression /^name-server$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of NameServerEventDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "type_name", + "start_date", + "end_date", + "summary", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of affected_tests + if self.affected_tests: + _dict['affectedTests'] = self.affected_tests.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_targets + if self.affected_targets: + _dict['affectedTargets'] = self.affected_targets.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_agents + if self.affected_agents: + _dict['affectedAgents'] = self.affected_agents.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of grouping + if self.grouping: + _dict['grouping'] = self.grouping.to_dict() + # set to None if end_date (nullable) is None + # and model_fields_set contains the field + if self.end_date is None and "end_date" in self.model_fields_set: + _dict['endDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of NameServerEventDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "typeName": obj.get("typeName"), + "state": obj.get("state"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate"), + "severity": obj.get("severity"), + "aid": obj.get("aid"), + "summary": obj.get("summary"), + "agentType": obj.get("agentType"), + "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, + "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, + "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, + "cause": obj.get("cause"), + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "type": obj.get("type"), + "grouping": NameServerEventGrouping.from_dict(obj["grouping"]) if obj.get("grouping") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/name_server_event_grouping.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/name_server_event_grouping.py new file mode 100644 index 000000000..3477250e2 --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/name_server_event_grouping.py @@ -0,0 +1,89 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class NameServerEventGrouping(BaseModel): + """ + NameServerEventGrouping + """ # noqa: E501 + server_name: Optional[StrictStr] = Field(default=None, description="Name server hostname (for name-server events).", alias="serverName") + __properties: ClassVar[List[str]] = ["serverName"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of NameServerEventGrouping from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "server_name", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of NameServerEventGrouping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "serverName": obj.get("serverName") + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/network_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/network_event_detail.py index 39be2a504..5bb46fbf9 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/network_event_detail.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/network_event_detail.py @@ -23,6 +23,7 @@ from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity from thousandeyes_sdk.event_detection.models.event_state import EventState from thousandeyes_sdk.event_detection.models.network_event_grouping import NetworkEventGrouping @@ -38,10 +39,11 @@ class NetworkEventDetail(BaseModel): type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") state: Optional[EventState] = None start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") - end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events.", alias="endDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") severity: Optional[EventAlertSeverity] = None aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") @@ -49,7 +51,7 @@ class NetworkEventDetail(BaseModel): links: Optional[SelfLinks] = Field(default=None, alias="_links") type: Annotated[str, Field(strict=True)] = Field(description="Network event type.") grouping: Optional[NetworkEventGrouping] = None - __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] @field_validator('type') def type_validate_regular_expression(cls, value): @@ -148,6 +150,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "severity": obj.get("severity"), "aid": obj.get("aid"), "summary": obj.get("summary"), + "agentType": obj.get("agentType"), "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/network_pop_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/network_pop_event_detail.py index f1c631f00..0daacad82 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/network_pop_event_detail.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/network_pop_event_detail.py @@ -23,6 +23,7 @@ from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity from thousandeyes_sdk.event_detection.models.event_state import EventState from thousandeyes_sdk.event_detection.models.network_event_grouping import NetworkEventGrouping @@ -38,10 +39,11 @@ class NetworkPopEventDetail(BaseModel): type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") state: Optional[EventState] = None start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") - end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events.", alias="endDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") severity: Optional[EventAlertSeverity] = None aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") @@ -49,7 +51,7 @@ class NetworkPopEventDetail(BaseModel): links: Optional[SelfLinks] = Field(default=None, alias="_links") type: Annotated[str, Field(strict=True)] = Field(description="Network pop event type.") grouping: Optional[NetworkEventGrouping] = None - __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] @field_validator('type') def type_validate_regular_expression(cls, value): @@ -148,6 +150,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "severity": obj.get("severity"), "aid": obj.get("aid"), "summary": obj.get("summary"), + "agentType": obj.get("agentType"), "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/proxy_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/proxy_event_detail.py index c7f0a0325..4bf649ebb 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/proxy_event_detail.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/proxy_event_detail.py @@ -23,6 +23,7 @@ from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity from thousandeyes_sdk.event_detection.models.event_state import EventState from thousandeyes_sdk.event_detection.models.proxy_event_grouping import ProxyEventGrouping @@ -38,10 +39,11 @@ class ProxyEventDetail(BaseModel): type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") state: Optional[EventState] = None start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") - end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events.", alias="endDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") severity: Optional[EventAlertSeverity] = None aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") @@ -49,7 +51,7 @@ class ProxyEventDetail(BaseModel): links: Optional[SelfLinks] = Field(default=None, alias="_links") type: Annotated[str, Field(strict=True)] = Field(description="Proxy event type.") grouping: Optional[ProxyEventGrouping] = None - __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] @field_validator('type') def type_validate_regular_expression(cls, value): @@ -148,6 +150,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "severity": obj.get("severity"), "aid": obj.get("aid"), "summary": obj.get("summary"), + "agentType": obj.get("agentType"), "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/simple_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/simple_event_detail.py index 5d6e39b0c..804db7e10 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/simple_event_detail.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/simple_event_detail.py @@ -32,7 +32,7 @@ class SimpleEventDetail(BaseModel): type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") state: Optional[EventState] = None start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") - end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events.", alias="endDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") severity: Optional[EventAlertSeverity] = None __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity"] diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/target_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/target_event_detail.py index ef1117a50..d0516e9ec 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/target_event_detail.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/target_event_detail.py @@ -23,6 +23,7 @@ from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity from thousandeyes_sdk.event_detection.models.event_state import EventState from thousandeyes_sdk.event_detection.models.self_links import SelfLinks @@ -38,10 +39,11 @@ class TargetEventDetail(BaseModel): type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") state: Optional[EventState] = None start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") - end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events.", alias="endDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") severity: Optional[EventAlertSeverity] = None aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") @@ -49,7 +51,7 @@ class TargetEventDetail(BaseModel): links: Optional[SelfLinks] = Field(default=None, alias="_links") type: Annotated[str, Field(strict=True)] = Field(description="Target event type.") grouping: Optional[TargetEventGrouping] = None - __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] @field_validator('type') def type_validate_regular_expression(cls, value): @@ -148,6 +150,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "severity": obj.get("severity"), "aid": obj.get("aid"), "summary": obj.get("summary"), + "agentType": obj.get("agentType"), "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/target_network_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/target_network_event_detail.py index 038c06c2c..cbccf19f2 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/target_network_event_detail.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/target_network_event_detail.py @@ -23,6 +23,7 @@ from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity from thousandeyes_sdk.event_detection.models.event_state import EventState from thousandeyes_sdk.event_detection.models.self_links import SelfLinks @@ -38,10 +39,11 @@ class TargetNetworkEventDetail(BaseModel): type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") state: Optional[EventState] = None start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") - end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is populated for \"ongoing\" events.", alias="endDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") severity: Optional[EventAlertSeverity] = None aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") @@ -49,7 +51,7 @@ class TargetNetworkEventDetail(BaseModel): links: Optional[SelfLinks] = Field(default=None, alias="_links") type: Annotated[str, Field(strict=True)] = Field(description="Target network event type.") grouping: Optional[TargetNetworkEventGrouping] = None - __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] @field_validator('type') def type_validate_regular_expression(cls, value): @@ -148,6 +150,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "severity": obj.get("severity"), "aid": obj.get("aid"), "summary": obj.get("summary"), + "agentType": obj.get("agentType"), "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/vpn_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/vpn_event_detail.py new file mode 100644 index 000000000..cb4a783f2 --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/vpn_event_detail.py @@ -0,0 +1,164 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents +from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets +from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType +from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity +from thousandeyes_sdk.event_detection.models.event_state import EventState +from thousandeyes_sdk.event_detection.models.self_links import SelfLinks +from thousandeyes_sdk.event_detection.models.vpn_event_grouping import VpnEventGrouping +from typing import Optional, Set +from typing_extensions import Self + +class VpnEventDetail(BaseModel): + """ + VpnEventDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique ID for each event.") + type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") + state: Optional[EventState] = None + start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") + severity: Optional[EventAlertSeverity] = None + aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") + summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") + affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") + affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") + affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") + cause: Optional[List[StrictStr]] = Field(default=None, description="The cause of the error.") + links: Optional[SelfLinks] = Field(default=None, alias="_links") + type: Annotated[str, Field(strict=True)] = Field(description="VPN event type.") + grouping: Optional[VpnEventGrouping] = None + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^vpn$", value): + raise ValueError(r"must validate the regular expression /^vpn$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VpnEventDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "type_name", + "start_date", + "end_date", + "summary", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of affected_tests + if self.affected_tests: + _dict['affectedTests'] = self.affected_tests.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_targets + if self.affected_targets: + _dict['affectedTargets'] = self.affected_targets.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_agents + if self.affected_agents: + _dict['affectedAgents'] = self.affected_agents.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of grouping + if self.grouping: + _dict['grouping'] = self.grouping.to_dict() + # set to None if end_date (nullable) is None + # and model_fields_set contains the field + if self.end_date is None and "end_date" in self.model_fields_set: + _dict['endDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VpnEventDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "typeName": obj.get("typeName"), + "state": obj.get("state"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate"), + "severity": obj.get("severity"), + "aid": obj.get("aid"), + "summary": obj.get("summary"), + "agentType": obj.get("agentType"), + "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, + "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, + "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, + "cause": obj.get("cause"), + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "type": obj.get("type"), + "grouping": VpnEventGrouping.from_dict(obj["grouping"]) if obj.get("grouping") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/vpn_event_grouping.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/vpn_event_grouping.py new file mode 100644 index 000000000..5adb0ce72 --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/vpn_event_grouping.py @@ -0,0 +1,93 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class VpnEventGrouping(BaseModel): + """ + VpnEventGrouping + """ # noqa: E501 + vpn_type: Optional[StrictStr] = Field(default=None, description="VPN type (for vpn events).", alias="vpnType") + vpn_server_ip_address: Optional[StrictStr] = Field(default=None, description="VPN server IP address (for vpn events).", alias="vpnServerIpAddress") + __properties: ClassVar[List[str]] = ["vpnType", "vpnServerIpAddress"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of VpnEventGrouping from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "vpn_type", + "vpn_server_ip_address", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of VpnEventGrouping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "vpnType": obj.get("vpnType"), + "vpnServerIpAddress": obj.get("vpnServerIpAddress") + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/wireless_event_detail.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/wireless_event_detail.py new file mode 100644 index 000000000..6472e007d --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/wireless_event_detail.py @@ -0,0 +1,164 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from thousandeyes_sdk.event_detection.models.affected_agents import AffectedAgents +from thousandeyes_sdk.event_detection.models.affected_targets import AffectedTargets +from thousandeyes_sdk.event_detection.models.affected_tests import AffectedTests +from thousandeyes_sdk.event_detection.models.event_agent_type import EventAgentType +from thousandeyes_sdk.event_detection.models.event_alert_severity import EventAlertSeverity +from thousandeyes_sdk.event_detection.models.event_state import EventState +from thousandeyes_sdk.event_detection.models.self_links import SelfLinks +from thousandeyes_sdk.event_detection.models.wireless_event_grouping import WirelessEventGrouping +from typing import Optional, Set +from typing_extensions import Self + +class WirelessEventDetail(BaseModel): + """ + WirelessEventDetail + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, description="A unique ID for each event.") + type_name: Optional[StrictStr] = Field(default=None, description="Event type name. Examples include, Local Agent Issue, Network Path Issue, Network Outage, DNS Issue, Server Issue, and Proxy Issue.", alias="typeName") + state: Optional[EventState] = None + start_date: Optional[datetime] = Field(default=None, description="The start date and time (in UTC, ISO 8601 format) when the event was first detected.", alias="startDate") + end_date: Optional[datetime] = Field(default=None, description="The end date and time (in UTC, ISO 8601 format) when the event was resolved (due to timeout). This value is null for \"ongoing\" (active) events and is populated once the event is resolved.", alias="endDate") + severity: Optional[EventAlertSeverity] = None + aid: Optional[StrictStr] = Field(default=None, description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint.") + summary: Optional[StrictStr] = Field(default=None, description="A brief summary describing the cause of the event.") + agent_type: Optional[EventAgentType] = Field(default=None, alias="agentType") + affected_tests: Optional[AffectedTests] = Field(default=None, alias="affectedTests") + affected_targets: Optional[AffectedTargets] = Field(default=None, alias="affectedTargets") + affected_agents: Optional[AffectedAgents] = Field(default=None, alias="affectedAgents") + cause: Optional[List[StrictStr]] = Field(default=None, description="The cause of the error.") + links: Optional[SelfLinks] = Field(default=None, alias="_links") + type: Annotated[str, Field(strict=True)] = Field(description="Wireless event type.") + grouping: Optional[WirelessEventGrouping] = None + __properties: ClassVar[List[str]] = ["id", "typeName", "state", "startDate", "endDate", "severity", "aid", "summary", "agentType", "affectedTests", "affectedTargets", "affectedAgents", "cause", "_links", "type", "grouping"] + + @field_validator('type') + def type_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not re.match(r"^wireless$", value): + raise ValueError(r"must validate the regular expression /^wireless$/") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WirelessEventDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "id", + "type_name", + "start_date", + "end_date", + "summary", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of affected_tests + if self.affected_tests: + _dict['affectedTests'] = self.affected_tests.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_targets + if self.affected_targets: + _dict['affectedTargets'] = self.affected_targets.to_dict() + # override the default output from pydantic by calling `to_dict()` of affected_agents + if self.affected_agents: + _dict['affectedAgents'] = self.affected_agents.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of grouping + if self.grouping: + _dict['grouping'] = self.grouping.to_dict() + # set to None if end_date (nullable) is None + # and model_fields_set contains the field + if self.end_date is None and "end_date" in self.model_fields_set: + _dict['endDate'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WirelessEventDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "typeName": obj.get("typeName"), + "state": obj.get("state"), + "startDate": obj.get("startDate"), + "endDate": obj.get("endDate"), + "severity": obj.get("severity"), + "aid": obj.get("aid"), + "summary": obj.get("summary"), + "agentType": obj.get("agentType"), + "affectedTests": AffectedTests.from_dict(obj["affectedTests"]) if obj.get("affectedTests") is not None else None, + "affectedTargets": AffectedTargets.from_dict(obj["affectedTargets"]) if obj.get("affectedTargets") is not None else None, + "affectedAgents": AffectedAgents.from_dict(obj["affectedAgents"]) if obj.get("affectedAgents") is not None else None, + "cause": obj.get("cause"), + "_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "type": obj.get("type"), + "grouping": WirelessEventGrouping.from_dict(obj["grouping"]) if obj.get("grouping") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/wireless_event_grouping.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/wireless_event_grouping.py new file mode 100644 index 000000000..d9428d2db --- /dev/null +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/wireless_event_grouping.py @@ -0,0 +1,93 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class WirelessEventGrouping(BaseModel): + """ + WirelessEventGrouping + """ # noqa: E501 + ssid: Optional[StrictStr] = Field(default=None, description="Wireless network SSID (for wireless events).") + bssid: Optional[StrictStr] = Field(default=None, description="Wireless network BSSID (for wireless events).") + __properties: ClassVar[List[str]] = ["ssid", "bssid"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WirelessEventGrouping from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "ssid", + "bssid", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WirelessEventGrouping from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "ssid": obj.get("ssid"), + "bssid": obj.get("bssid") + }) + return _obj + + diff --git a/thousandeyes-sdk-event-detection/test/conftest.py b/thousandeyes-sdk-event-detection/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..bb20b37ca --- /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 000000000..f5715b1d7 --- /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.py b/thousandeyes-sdk-event-detection/test/test_events_api.py index aed81efbe..a83f1b172 100644 --- a/thousandeyes-sdk-event-detection/test/test_events_api.py +++ b/thousandeyes-sdk-event-detection/test/test_events_api.py @@ -35,6 +35,7 @@ def test_get_event_models_validation(self) -> None: { "severity" : "medium", "summary" : "Significant number of issues detected with 66.29.146.15", + "agentType" : "cloud-enterprise-agent", "affectedTests" : { "total" : 5, "tests" : [ { @@ -134,7 +135,7 @@ def test_get_event_models_validation(self) -> None: "name" : "São Paulo, Brazil - agent", "location" : "São Paulo, Brazil", "affectedTestIds" : [ "2954", "2953" ], - "type" : "enterprise-cluster" + "type" : "enterprise" }, { "affectedTargetIds" : [ "123", "1234" ], "agentId" : "2954", @@ -154,7 +155,7 @@ def test_get_event_models_validation(self) -> None: "name" : "São Paulo, Brazil - agent", "location" : "São Paulo, Brazil", "affectedTestIds" : [ "2954", "2953" ], - "type" : "enterprise-cluster" + "type" : "enterprise" } ] }, "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", @@ -199,6 +200,7 @@ def test_get_events_models_validation(self) -> None: "startDate" : "2022-07-17T22:00:54Z", "events" : [ { "severity" : "medium", + "agentType" : "cloud-enterprise-agent", "affectedTests" : { "total" : 5, "inAccountGroup" : 2 @@ -216,22 +218,23 @@ def test_get_events_models_validation(self) -> None: "title" : "title" } }, - "affectedAgents" : { - "total" : 5, - "inAccountGroup" : 2 - }, "typeName" : "Network Issue", - "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", - "state" : "resolved", "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 @@ -249,19 +252,19 @@ def test_get_events_models_validation(self) -> None: "title" : "title" } }, - "affectedAgents" : { - "total" : 5, - "inAccountGroup" : 2 - }, "typeName" : "Network Issue", - "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", - "state" : "resolved", "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" } ] }""" 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 000000000..4b0ca5d10 --- /dev/null +++ b/thousandeyes-sdk-event-detection/test/test_events_api_integration.py @@ -0,0 +1,789 @@ +# 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-event-detection/test/test_utils.py b/thousandeyes-sdk-event-detection/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-instant-tests/.openapi-generator/FILES index fa33a7c1c..316b07b88 100644 --- a/thousandeyes-sdk-instant-tests/.openapi-generator/FILES +++ b/thousandeyes-sdk-instant-tests/.openapi-generator/FILES @@ -89,6 +89,7 @@ docs/SipServerProperties.md docs/SipTestProtocol.md docs/TestAgent.md docs/TestAuthType.md +docs/TestChromiumTrack.md docs/TestCustomHeaders.md docs/TestDirection.md docs/TestDnsServer.md @@ -217,6 +218,7 @@ src/thousandeyes_sdk/instant_tests/models/sip_server_properties.py src/thousandeyes_sdk/instant_tests/models/sip_test_protocol.py src/thousandeyes_sdk/instant_tests/models/test_agent.py src/thousandeyes_sdk/instant_tests/models/test_auth_type.py +src/thousandeyes_sdk/instant_tests/models/test_chromium_track.py src/thousandeyes_sdk/instant_tests/models/test_custom_headers.py src/thousandeyes_sdk/instant_tests/models/test_direction.py src/thousandeyes_sdk/instant_tests/models/test_dns_server.py @@ -250,17 +252,33 @@ src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test_response. src/thousandeyes_sdk/instant_tests/models/web_transaction_properties.py src/thousandeyes_sdk/instant_tests/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_agent_to_agent_instant_tests_api.py +test/test_agent_to_agent_instant_tests_api_integration.py test/test_agent_to_server_instant_tests_api.py +test/test_agent_to_server_instant_tests_api_integration.py test/test_api_instant_tests_api.py +test/test_api_instant_tests_api_integration.py test/test_dns_server_instant_tests_api.py +test/test_dns_server_instant_tests_api_integration.py test/test_dns_trace_instant_tests_api.py +test/test_dns_trace_instant_tests_api_integration.py test/test_dnssec_instant_tests_api.py +test/test_dnssec_instant_tests_api_integration.py test/test_ftp_server_instant_tests_api.py +test/test_ftp_server_instant_tests_api_integration.py test/test_http_page_load_instant_tests_api.py +test/test_http_page_load_instant_tests_api_integration.py test/test_http_server_instant_tests_api.py +test/test_http_server_instant_tests_api_integration.py test/test_instant_tests_api.py +test/test_instant_tests_api_integration.py test/test_sip_server_instant_tests_api.py +test/test_sip_server_instant_tests_api_integration.py test/test_utils.py test/test_voice_instant_tests_api.py +test/test_voice_instant_tests_api_integration.py test/test_web_transaction_instant_tests_api.py +test/test_web_transaction_instant_tests_api_integration.py diff --git a/thousandeyes-sdk-instant-tests/README.md b/thousandeyes-sdk-instant-tests/README.md index 697ee8336..684353a2d 100644 --- a/thousandeyes-sdk-instant-tests/README.md +++ b/thousandeyes-sdk-instant-tests/README.md @@ -6,7 +6,7 @@ The response does not include the immediate test results. Use the Test Results e This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -79,9 +79,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.APIInstantTestsApi(api_client) - api_instant_test_request = thousandeyes_sdk.instant_tests.ApiInstantTestRequest() # ApiInstantTestRequest | + api_instant_test_request = # ApiInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create API instant test @@ -193,6 +193,7 @@ Class | Method | HTTP request | Description - [SipTestProtocol](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-instant-tests/docs/SipTestProtocol.md) - [TestAgent](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-instant-tests/docs/TestAgent.md) - [TestAuthType](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-instant-tests/docs/TestAuthType.md) + - [TestChromiumTrack](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-instant-tests/docs/TestChromiumTrack.md) - [TestCustomHeaders](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-instant-tests/docs/TestCustomHeaders.md) - [TestDirection](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-instant-tests/docs/TestDirection.md) - [TestDnsServer](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-instant-tests/docs/TestDnsServer.md) diff --git a/thousandeyes-sdk-instant-tests/docs/APIInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/APIInstantTestsApi.md index 5cc2f820b..58a031600 100644 --- a/thousandeyes-sdk-instant-tests/docs/APIInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/APIInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.APIInstantTestsApi(api_client) - api_instant_test_request = thousandeyes_sdk.instant_tests.ApiInstantTestRequest() # ApiInstantTestRequest | + api_instant_test_request = # ApiInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create API instant test diff --git a/thousandeyes-sdk-instant-tests/docs/AgentToAgentInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/AgentToAgentInstantTestsApi.md index 994ec2c8b..d6a088e42 100644 --- a/thousandeyes-sdk-instant-tests/docs/AgentToAgentInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/AgentToAgentInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.AgentToAgentInstantTestsApi(api_client) - agent_to_agent_instant_test_request = thousandeyes_sdk.instant_tests.AgentToAgentInstantTestRequest() # AgentToAgentInstantTestRequest | + agent_to_agent_instant_test_request = # AgentToAgentInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create agent-to-agent instant test diff --git a/thousandeyes-sdk-instant-tests/docs/AgentToServerInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/AgentToServerInstantTestsApi.md index a277f45e4..60190d8ab 100644 --- a/thousandeyes-sdk-instant-tests/docs/AgentToServerInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/AgentToServerInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.AgentToServerInstantTestsApi(api_client) - agent_to_server_instant_test_request = thousandeyes_sdk.instant_tests.AgentToServerInstantTestRequest() # AgentToServerInstantTestRequest | + agent_to_server_instant_test_request = # AgentToServerInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create agent-to-server instant test diff --git a/thousandeyes-sdk-instant-tests/docs/DNSSECInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/DNSSECInstantTestsApi.md index af6435539..e944b647d 100644 --- a/thousandeyes-sdk-instant-tests/docs/DNSSECInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/DNSSECInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.DNSSECInstantTestsApi(api_client) - dns_sec_instant_test_request = thousandeyes_sdk.instant_tests.DnsSecInstantTestRequest() # DnsSecInstantTestRequest | + dns_sec_instant_test_request = # DnsSecInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create DNSSEC instant test diff --git a/thousandeyes-sdk-instant-tests/docs/DNSServerInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/DNSServerInstantTestsApi.md index 603b4c415..f56bc4f6d 100644 --- a/thousandeyes-sdk-instant-tests/docs/DNSServerInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/DNSServerInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.DNSServerInstantTestsApi(api_client) - dns_server_instant_test_request = thousandeyes_sdk.instant_tests.DnsServerInstantTestRequest() # DnsServerInstantTestRequest | + dns_server_instant_test_request = # DnsServerInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create DNS server instant test diff --git a/thousandeyes-sdk-instant-tests/docs/DNSTraceInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/DNSTraceInstantTestsApi.md index f2e3a2f3d..fd4290eae 100644 --- a/thousandeyes-sdk-instant-tests/docs/DNSTraceInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/DNSTraceInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.DNSTraceInstantTestsApi(api_client) - dns_trace_instant_test_request = thousandeyes_sdk.instant_tests.DnsTraceInstantTestRequest() # DnsTraceInstantTestRequest | + dns_trace_instant_test_request = # DnsTraceInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create DNS trace instant test diff --git a/thousandeyes-sdk-instant-tests/docs/FTPServerInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/FTPServerInstantTestsApi.md index 6e722db29..4d640382b 100644 --- a/thousandeyes-sdk-instant-tests/docs/FTPServerInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/FTPServerInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.FTPServerInstantTestsApi(api_client) - ftp_server_instant_test_request = thousandeyes_sdk.instant_tests.FtpServerInstantTestRequest() # FtpServerInstantTestRequest | + ftp_server_instant_test_request = # FtpServerInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create FTP server instant test diff --git a/thousandeyes-sdk-instant-tests/docs/HTTPPageLoadInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/HTTPPageLoadInstantTestsApi.md index 78b35f19b..213873791 100644 --- a/thousandeyes-sdk-instant-tests/docs/HTTPPageLoadInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/HTTPPageLoadInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.HTTPPageLoadInstantTestsApi(api_client) - page_load_instant_test_request = thousandeyes_sdk.instant_tests.PageLoadInstantTestRequest() # PageLoadInstantTestRequest | + page_load_instant_test_request = # PageLoadInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create HTTP page load instant test diff --git a/thousandeyes-sdk-instant-tests/docs/HTTPServerInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/HTTPServerInstantTestsApi.md index bc6518551..dca62d65d 100644 --- a/thousandeyes-sdk-instant-tests/docs/HTTPServerInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/HTTPServerInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.HTTPServerInstantTestsApi(api_client) - http_server_instant_test_request = thousandeyes_sdk.instant_tests.HttpServerInstantTestRequest() # HttpServerInstantTestRequest | + http_server_instant_test_request = # HttpServerInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create HTTP server instant test diff --git a/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTest.md b/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTest.md index 15851e353..9db82ca5c 100644 --- a/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTest.md +++ b/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTest.md @@ -65,6 +65,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTestRequest.md b/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTestRequest.md index 7eb636894..24ccf2ae9 100644 --- a/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTestRequest.md +++ b/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTestRequest.md @@ -62,6 +62,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTestResponse.md b/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTestResponse.md index 5d975ec00..01cc2c915 100644 --- a/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTestResponse.md +++ b/thousandeyes-sdk-instant-tests/docs/PageLoadInstantTestResponse.md @@ -65,6 +65,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-instant-tests/docs/PageLoadProperties.md b/thousandeyes-sdk-instant-tests/docs/PageLoadProperties.md index 84f9ef7c7..218ab51ef 100644 --- a/thousandeyes-sdk-instant-tests/docs/PageLoadProperties.md +++ b/thousandeyes-sdk-instant-tests/docs/PageLoadProperties.md @@ -51,6 +51,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **type** | **str** | | [optional] [readonly] diff --git a/thousandeyes-sdk-instant-tests/docs/SIPServerInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/SIPServerInstantTestsApi.md index e21a2a64a..5ceafceed 100644 --- a/thousandeyes-sdk-instant-tests/docs/SIPServerInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/SIPServerInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.SIPServerInstantTestsApi(api_client) - sip_server_instant_test_request = thousandeyes_sdk.instant_tests.SipServerInstantTestRequest() # SipServerInstantTestRequest | + sip_server_instant_test_request = # SipServerInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create SIP server instant test diff --git a/thousandeyes-sdk-instant-tests/docs/TestChromiumTrack.md b/thousandeyes-sdk-instant-tests/docs/TestChromiumTrack.md new file mode 100644 index 000000000..be0647131 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/docs/TestChromiumTrack.md @@ -0,0 +1,12 @@ +# TestChromiumTrack + +* `stable`: Uses the default Chromium version. * `latest`: Uses the newest Chromium version available from ThousandEyes as soon as it is available. Performance may differ from tests using the default Chromium version. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-instant-tests/docs/VoiceInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/VoiceInstantTestsApi.md index f616bb31a..33a437be4 100644 --- a/thousandeyes-sdk-instant-tests/docs/VoiceInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/VoiceInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.VoiceInstantTestsApi(api_client) - voice_instant_test_request = thousandeyes_sdk.instant_tests.VoiceInstantTestRequest() # VoiceInstantTestRequest | + voice_instant_test_request = # VoiceInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create voice instant test diff --git a/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTest.md b/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTest.md index 992916d53..be299c624 100644 --- a/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTest.md +++ b/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTest.md @@ -59,6 +59,7 @@ Name | Type | Description | Notes **target_time** | **int** | Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value. | [optional] [default to 10] **time_limit** | **int** | Time limit for transaction in seconds. | [optional] [default to 30] **transaction_script** | **str** | JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ). | +**flag_collect_console_logs** | **bool** | Whether to collect console logs during script execution. | [optional] [default to False] **block_domains** | **str** | Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests. | [optional] **disable_screenshot** | **bool** | Enables or disables screenshots on error. Set true to not capture | [optional] [default to False] **allow_mic_and_camera** | **bool** | Set true allow the use of a fake mic and camera in the browser. | [optional] [default to False] @@ -66,6 +67,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestRequest.md b/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestRequest.md index e24b9e8fa..7529a8d01 100644 --- a/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestRequest.md +++ b/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestRequest.md @@ -56,6 +56,7 @@ Name | Type | Description | Notes **target_time** | **int** | Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value. | [optional] [default to 10] **time_limit** | **int** | Time limit for transaction in seconds. | [optional] [default to 30] **transaction_script** | **str** | JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ). | +**flag_collect_console_logs** | **bool** | Whether to collect console logs during script execution. | [optional] [default to False] **block_domains** | **str** | Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests. | [optional] **disable_screenshot** | **bool** | Enables or disables screenshots on error. Set true to not capture | [optional] [default to False] **allow_mic_and_camera** | **bool** | Set true allow the use of a fake mic and camera in the browser. | [optional] [default to False] @@ -63,6 +64,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestResponse.md b/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestResponse.md index b2ee39ad1..f3f16a2c5 100644 --- a/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestResponse.md +++ b/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestResponse.md @@ -59,6 +59,7 @@ Name | Type | Description | Notes **target_time** | **int** | Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value. | [optional] [default to 10] **time_limit** | **int** | Time limit for transaction in seconds. | [optional] [default to 30] **transaction_script** | **str** | JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ). | +**flag_collect_console_logs** | **bool** | Whether to collect console logs during script execution. | [optional] [default to False] **block_domains** | **str** | Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests. | [optional] **disable_screenshot** | **bool** | Enables or disables screenshots on error. Set true to not capture | [optional] [default to False] **allow_mic_and_camera** | **bool** | Set true allow the use of a fake mic and camera in the browser. | [optional] [default to False] @@ -66,6 +67,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestsApi.md index 96f77cbee..240e66c85 100644 --- a/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestsApi.md +++ b/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestsApi.md @@ -46,9 +46,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.instant_tests.WebTransactionInstantTestsApi(api_client) - web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.WebTransactionInstantTestRequest() # WebTransactionInstantTestRequest | + web_transaction_instant_test_request = # WebTransactionInstantTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()] # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) + expand = # List[ExpandInstantTestOptions] | (Optional) Indicates if the test sub-resources should be expanded. Defaults to no expansion. To expand the `agents` sub-resource, use the query `?expand=agent`. (optional) try: # Create web transactions instant test diff --git a/thousandeyes-sdk-instant-tests/docs/WebTransactionProperties.md b/thousandeyes-sdk-instant-tests/docs/WebTransactionProperties.md index 5357d7ad3..9c00341ad 100644 --- a/thousandeyes-sdk-instant-tests/docs/WebTransactionProperties.md +++ b/thousandeyes-sdk-instant-tests/docs/WebTransactionProperties.md @@ -45,6 +45,7 @@ Name | Type | Description | Notes **target_time** | **int** | Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value. | [optional] [default to 10] **time_limit** | **int** | Time limit for transaction in seconds. | [optional] [default to 30] **transaction_script** | **str** | JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ). | +**flag_collect_console_logs** | **bool** | Whether to collect console logs during script execution. | [optional] [default to False] **block_domains** | **str** | Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests. | [optional] **disable_screenshot** | **bool** | Enables or disables screenshots on error. Set true to not capture | [optional] [default to False] **allow_mic_and_camera** | **bool** | Set true allow the use of a fake mic and camera in the browser. | [optional] [default to False] @@ -52,6 +53,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **type** | **str** | | [optional] [readonly] diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/__init__.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/__init__.py index 1bef80437..97a06c485 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/__init__.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/__init__.py @@ -107,6 +107,7 @@ from thousandeyes_sdk.instant_tests.models.sip_test_protocol import SipTestProtocol from thousandeyes_sdk.instant_tests.models.test_agent import TestAgent from thousandeyes_sdk.instant_tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.instant_tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.instant_tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.instant_tests.models.test_direction import TestDirection from thousandeyes_sdk.instant_tests.models.test_dns_server import TestDnsServer diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/__init__.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/__init__.py index e4b9258e6..333022dff 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/__init__.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/__init__.py @@ -90,6 +90,7 @@ from thousandeyes_sdk.instant_tests.models.sip_test_protocol import SipTestProtocol from thousandeyes_sdk.instant_tests.models.test_agent import TestAgent from thousandeyes_sdk.instant_tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.instant_tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.instant_tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.instant_tests.models.test_direction import TestDirection from thousandeyes_sdk.instant_tests.models.test_dns_server import TestDnsServer diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test.py index 1cabf1a98..2809f8bad 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test.py @@ -24,6 +24,7 @@ from thousandeyes_sdk.instant_tests.models.o_auth import OAuth from thousandeyes_sdk.instant_tests.models.shared_with_account import SharedWithAccount from thousandeyes_sdk.instant_tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.instant_tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.instant_tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.instant_tests.models.test_label import TestLabel from thousandeyes_sdk.instant_tests.models.test_links import TestLinks @@ -101,10 +102,11 @@ class PageLoadInstantTest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") - __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent"] + __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent"] model_config = ConfigDict( populate_by_name=True, @@ -282,6 +284,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test_request.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test_request.py index 6dd037d49..169ef846c 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test_request.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test_request.py @@ -24,6 +24,7 @@ from thousandeyes_sdk.instant_tests.models.o_auth import OAuth from thousandeyes_sdk.instant_tests.models.test_agent import TestAgent from thousandeyes_sdk.instant_tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.instant_tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.instant_tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.instant_tests.models.test_links import TestLinks from thousandeyes_sdk.instant_tests.models.test_page_loading_strategy import TestPageLoadingStrategy @@ -96,6 +97,7 @@ class PageLoadInstantTestRequest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") @@ -103,7 +105,7 @@ class PageLoadInstantTestRequest(BaseModel): tags: Optional[List[StrictStr]] = Field(default=None, description="A list of test tag identifiers (get `id` from `/tags` endpoint).") shared_with_accounts: Optional[List[StrictStr]] = Field(default=None, description="A list of account group identifiers that the test is shared with (get `aid` from `/account-groups` endpoint).", alias="sharedWithAccounts") agents: List[TestAgent] = Field(description="A list of objects with `agentId` (required) and `sourceIpAddress` (optional).") - __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "labels", "tags", "sharedWithAccounts", "agents"] + __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "labels", "tags", "sharedWithAccounts", "agents"] model_config = ConfigDict( populate_by_name=True, @@ -258,6 +260,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test_response.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test_response.py index 45eec0c2c..38b99da4e 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test_response.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_instant_test_response.py @@ -25,6 +25,7 @@ from thousandeyes_sdk.instant_tests.models.o_auth import OAuth from thousandeyes_sdk.instant_tests.models.shared_with_account import SharedWithAccount from thousandeyes_sdk.instant_tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.instant_tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.instant_tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.instant_tests.models.test_label import TestLabel from thousandeyes_sdk.instant_tests.models.test_links import TestLinks @@ -102,11 +103,12 @@ class PageLoadInstantTestResponse(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") agents: Optional[List[AgentResponse]] = Field(default=None, description="Contains list of agents.") - __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "agents"] + __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "agents"] model_config = ConfigDict( populate_by_name=True, @@ -291,6 +293,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_properties.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_properties.py index de6fcf39a..44b160e32 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_properties.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/page_load_properties.py @@ -22,6 +22,7 @@ from thousandeyes_sdk.instant_tests.models.agent_interfaces import AgentInterfaces from thousandeyes_sdk.instant_tests.models.o_auth import OAuth from thousandeyes_sdk.instant_tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.instant_tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.instant_tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.instant_tests.models.test_page_loading_strategy import TestPageLoadingStrategy from thousandeyes_sdk.instant_tests.models.test_path_trace_mode import TestPathTraceMode @@ -82,11 +83,12 @@ class PageLoadProperties(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") type: Optional[StrictStr] = None identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") - __properties: ClassVar[List[str]] = ["authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "type", "identifyAgentTrafficWithUserAgent"] + __properties: ClassVar[List[str]] = ["authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "type", "identifyAgentTrafficWithUserAgent"] model_config = ConfigDict( populate_by_name=True, @@ -206,6 +208,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "type": obj.get("type"), diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/test_chromium_track.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/test_chromium_track.py new file mode 100644 index 000000000..dcb8012c4 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/test_chromium_track.py @@ -0,0 +1,41 @@ +# 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 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class TestChromiumTrack(str, Enum): + """ + * `stable`: Uses the default Chromium version. * `latest`: Uses the newest Chromium version available from ThousandEyes as soon as it is available. Performance may differ from tests using the default Chromium version. + """ + + """ + allowed enum values + """ + STABLE = 'stable' + LATEST = 'latest' + UNKNOWN = 'unknown' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TestChromiumTrack from a JSON string""" + return cls(json.loads(json_str)) + + @classmethod + def _missing_(cls, value): + """Handle unknown values""" + return cls.UNKNOWN + diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test.py index 8eec7ab59..b2c00cbb1 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test.py @@ -24,6 +24,7 @@ from thousandeyes_sdk.instant_tests.models.o_auth import OAuth from thousandeyes_sdk.instant_tests.models.shared_with_account import SharedWithAccount from thousandeyes_sdk.instant_tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.instant_tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.instant_tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.instant_tests.models.test_label import TestLabel from thousandeyes_sdk.instant_tests.models.test_links import TestLinks @@ -95,6 +96,7 @@ class WebTransactionInstantTest(BaseModel): target_time: Optional[Annotated[int, Field(le=180, strict=True, ge=1)]] = Field(default=10, description="Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value.", alias="targetTime") time_limit: Optional[Annotated[int, Field(le=180, strict=True, ge=5)]] = Field(default=30, description="Time limit for transaction in seconds.", alias="timeLimit") transaction_script: StrictStr = Field(description="JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ).", alias="transactionScript") + flag_collect_console_logs: Optional[StrictBool] = Field(default=False, description="Whether to collect console logs during script execution.", alias="flagCollectConsoleLogs") block_domains: Optional[StrictStr] = Field(default=None, description="Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests.", alias="blockDomains") disable_screenshot: Optional[StrictBool] = Field(default=False, description="Enables or disables screenshots on error. Set true to not capture", alias="disableScreenshot") allow_mic_and_camera: Optional[StrictBool] = Field(default=False, description="Set true allow the use of a fake mic and camera in the browser.", alias="allowMicAndCamera") @@ -102,11 +104,12 @@ class WebTransactionInstantTest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") credentials: Optional[List[StrictStr]] = Field(default=None, description="Contains a list of credential IDs (get `credentialId` from `/credentials` endpoint).") - __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "credentials"] + __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "flagCollectConsoleLogs", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "credentials"] model_config = ConfigDict( populate_by_name=True, @@ -278,6 +281,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "targetTime": obj.get("targetTime") if obj.get("targetTime") is not None else 10, "timeLimit": obj.get("timeLimit") if obj.get("timeLimit") is not None else 30, "transactionScript": obj.get("transactionScript"), + "flagCollectConsoleLogs": obj.get("flagCollectConsoleLogs") if obj.get("flagCollectConsoleLogs") is not None else False, "blockDomains": obj.get("blockDomains"), "disableScreenshot": obj.get("disableScreenshot") if obj.get("disableScreenshot") is not None else False, "allowMicAndCamera": obj.get("allowMicAndCamera") if obj.get("allowMicAndCamera") is not None else False, @@ -285,6 +289,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test_request.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test_request.py index 6d201c13b..387747c3a 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test_request.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test_request.py @@ -24,6 +24,7 @@ from thousandeyes_sdk.instant_tests.models.o_auth import OAuth from thousandeyes_sdk.instant_tests.models.test_agent import TestAgent from thousandeyes_sdk.instant_tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.instant_tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.instant_tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.instant_tests.models.test_links import TestLinks from thousandeyes_sdk.instant_tests.models.test_page_loading_strategy import TestPageLoadingStrategy @@ -90,6 +91,7 @@ class WebTransactionInstantTestRequest(BaseModel): target_time: Optional[Annotated[int, Field(le=180, strict=True, ge=1)]] = Field(default=10, description="Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value.", alias="targetTime") time_limit: Optional[Annotated[int, Field(le=180, strict=True, ge=5)]] = Field(default=30, description="Time limit for transaction in seconds.", alias="timeLimit") transaction_script: StrictStr = Field(description="JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ).", alias="transactionScript") + flag_collect_console_logs: Optional[StrictBool] = Field(default=False, description="Whether to collect console logs during script execution.", alias="flagCollectConsoleLogs") block_domains: Optional[StrictStr] = Field(default=None, description="Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests.", alias="blockDomains") disable_screenshot: Optional[StrictBool] = Field(default=False, description="Enables or disables screenshots on error. Set true to not capture", alias="disableScreenshot") allow_mic_and_camera: Optional[StrictBool] = Field(default=False, description="Set true allow the use of a fake mic and camera in the browser.", alias="allowMicAndCamera") @@ -97,6 +99,7 @@ class WebTransactionInstantTestRequest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") @@ -105,7 +108,7 @@ class WebTransactionInstantTestRequest(BaseModel): shared_with_accounts: Optional[List[StrictStr]] = Field(default=None, description="A list of account group identifiers that the test is shared with (get `aid` from `/account-groups` endpoint).", alias="sharedWithAccounts") agents: List[TestAgent] = Field(description="A list of objects with `agentId` (required) and `sourceIpAddress` (optional).") credentials: Optional[List[StrictStr]] = Field(default=None, description="Contains a list of credential IDs (get `credentialId` from `/credentials` endpoint).") - __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "labels", "tags", "sharedWithAccounts", "agents", "credentials"] + __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "flagCollectConsoleLogs", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "labels", "tags", "sharedWithAccounts", "agents", "credentials"] model_config = ConfigDict( populate_by_name=True, @@ -254,6 +257,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "targetTime": obj.get("targetTime") if obj.get("targetTime") is not None else 10, "timeLimit": obj.get("timeLimit") if obj.get("timeLimit") is not None else 30, "transactionScript": obj.get("transactionScript"), + "flagCollectConsoleLogs": obj.get("flagCollectConsoleLogs") if obj.get("flagCollectConsoleLogs") is not None else False, "blockDomains": obj.get("blockDomains"), "disableScreenshot": obj.get("disableScreenshot") if obj.get("disableScreenshot") is not None else False, "allowMicAndCamera": obj.get("allowMicAndCamera") if obj.get("allowMicAndCamera") is not None else False, @@ -261,6 +265,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test_response.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test_response.py index f73351f1c..6981409b1 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test_response.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_instant_test_response.py @@ -25,6 +25,7 @@ from thousandeyes_sdk.instant_tests.models.o_auth import OAuth from thousandeyes_sdk.instant_tests.models.shared_with_account import SharedWithAccount from thousandeyes_sdk.instant_tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.instant_tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.instant_tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.instant_tests.models.test_label import TestLabel from thousandeyes_sdk.instant_tests.models.test_links import TestLinks @@ -96,6 +97,7 @@ class WebTransactionInstantTestResponse(BaseModel): target_time: Optional[Annotated[int, Field(le=180, strict=True, ge=1)]] = Field(default=10, description="Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value.", alias="targetTime") time_limit: Optional[Annotated[int, Field(le=180, strict=True, ge=5)]] = Field(default=30, description="Time limit for transaction in seconds.", alias="timeLimit") transaction_script: StrictStr = Field(description="JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ).", alias="transactionScript") + flag_collect_console_logs: Optional[StrictBool] = Field(default=False, description="Whether to collect console logs during script execution.", alias="flagCollectConsoleLogs") block_domains: Optional[StrictStr] = Field(default=None, description="Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests.", alias="blockDomains") disable_screenshot: Optional[StrictBool] = Field(default=False, description="Enables or disables screenshots on error. Set true to not capture", alias="disableScreenshot") allow_mic_and_camera: Optional[StrictBool] = Field(default=False, description="Set true allow the use of a fake mic and camera in the browser.", alias="allowMicAndCamera") @@ -103,12 +105,13 @@ class WebTransactionInstantTestResponse(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") credentials: Optional[List[StrictStr]] = Field(default=None, description="Contains a list of credential IDs (get `credentialId` from `/credentials` endpoint).") agents: Optional[List[AgentResponse]] = Field(default=None, description="Contains list of agents.") - __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "credentials", "agents"] + __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "flagCollectConsoleLogs", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "credentials", "agents"] model_config = ConfigDict( populate_by_name=True, @@ -287,6 +290,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "targetTime": obj.get("targetTime") if obj.get("targetTime") is not None else 10, "timeLimit": obj.get("timeLimit") if obj.get("timeLimit") is not None else 30, "transactionScript": obj.get("transactionScript"), + "flagCollectConsoleLogs": obj.get("flagCollectConsoleLogs") if obj.get("flagCollectConsoleLogs") is not None else False, "blockDomains": obj.get("blockDomains"), "disableScreenshot": obj.get("disableScreenshot") if obj.get("disableScreenshot") is not None else False, "allowMicAndCamera": obj.get("allowMicAndCamera") if obj.get("allowMicAndCamera") is not None else False, @@ -294,6 +298,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_properties.py b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_properties.py index b1202b74b..94d9d025a 100644 --- a/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_properties.py +++ b/thousandeyes-sdk-instant-tests/src/thousandeyes_sdk/instant_tests/models/web_transaction_properties.py @@ -22,6 +22,7 @@ from thousandeyes_sdk.instant_tests.models.agent_interfaces import AgentInterfaces from thousandeyes_sdk.instant_tests.models.o_auth import OAuth from thousandeyes_sdk.instant_tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.instant_tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.instant_tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.instant_tests.models.test_page_loading_strategy import TestPageLoadingStrategy from thousandeyes_sdk.instant_tests.models.test_path_trace_mode import TestPathTraceMode @@ -76,6 +77,7 @@ class WebTransactionProperties(BaseModel): target_time: Optional[Annotated[int, Field(le=180, strict=True, ge=1)]] = Field(default=10, description="Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value.", alias="targetTime") time_limit: Optional[Annotated[int, Field(le=180, strict=True, ge=5)]] = Field(default=30, description="Time limit for transaction in seconds.", alias="timeLimit") transaction_script: StrictStr = Field(description="JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ).", alias="transactionScript") + flag_collect_console_logs: Optional[StrictBool] = Field(default=False, description="Whether to collect console logs during script execution.", alias="flagCollectConsoleLogs") block_domains: Optional[StrictStr] = Field(default=None, description="Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests.", alias="blockDomains") disable_screenshot: Optional[StrictBool] = Field(default=False, description="Enables or disables screenshots on error. Set true to not capture", alias="disableScreenshot") allow_mic_and_camera: Optional[StrictBool] = Field(default=False, description="Set true allow the use of a fake mic and camera in the browser.", alias="allowMicAndCamera") @@ -83,11 +85,12 @@ class WebTransactionProperties(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") type: Optional[StrictStr] = None identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") - __properties: ClassVar[List[str]] = ["authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "type", "identifyAgentTrafficWithUserAgent"] + __properties: ClassVar[List[str]] = ["authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "flagCollectConsoleLogs", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "type", "identifyAgentTrafficWithUserAgent"] model_config = ConfigDict( populate_by_name=True, @@ -201,6 +204,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "targetTime": obj.get("targetTime") if obj.get("targetTime") is not None else 10, "timeLimit": obj.get("timeLimit") if obj.get("timeLimit") is not None else 30, "transactionScript": obj.get("transactionScript"), + "flagCollectConsoleLogs": obj.get("flagCollectConsoleLogs") if obj.get("flagCollectConsoleLogs") is not None else False, "blockDomains": obj.get("blockDomains"), "disableScreenshot": obj.get("disableScreenshot") if obj.get("disableScreenshot") is not None else False, "allowMicAndCamera": obj.get("allowMicAndCamera") if obj.get("allowMicAndCamera") is not None else False, @@ -208,6 +212,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "type": obj.get("type"), diff --git a/thousandeyes-sdk-instant-tests/test/conftest.py b/thousandeyes-sdk-instant-tests/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..b4de1e4fe --- /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 000000000..0d77b9d61 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/mock_manifest.py @@ -0,0 +1,3986 @@ +# 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, + "chromiumTrack" : "stable", + "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, + "chromiumTrack" : "stable", + "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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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 000000000..117ba1ffd --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py @@ -0,0 +1,824 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..1601027ba --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_agent_to_server_instant_tests_api_integration.py @@ -0,0 +1,833 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..40cd11762 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_api_instant_tests_api_integration.py @@ -0,0 +1,1724 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..51c0d6190 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_dns_server_instant_tests_api_integration.py @@ -0,0 +1,839 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..890a53036 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_dns_trace_instant_tests_api_integration.py @@ -0,0 +1,734 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..fa8372bb9 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_dnssec_instant_tests_api_integration.py @@ -0,0 +1,725 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..4065b5a56 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_ftp_server_instant_tests_api_integration.py @@ -0,0 +1,869 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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.py b/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api.py index acc196f87..b66579c9e 100644 --- a/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api.py +++ b/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api.py @@ -91,6 +91,7 @@ def test_create_page_load_instant_test_models_validation(self) -> None: "sslVersion" : "Auto", "useNtlm" : false, "downloadLimit" : 2048, + "chromiumTrack" : "stable", "description" : "ThousandEyes Test", "httpTimeLimit" : 5, "blockDomains" : "domain.com/", @@ -237,6 +238,7 @@ def test_create_page_load_instant_test_models_validation(self) -> None: "sslVersion" : "Auto", "useNtlm" : false, "downloadLimit" : 2048, + "chromiumTrack" : "stable", "description" : "ThousandEyes Test", "httpTimeLimit" : 5, "blockDomains" : "domain.com/", 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 000000000..c436dce5f --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py @@ -0,0 +1,1409 @@ +# 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, + "chromiumTrack" : "stable", + "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' + 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, + "chromiumTrack" : "stable", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + 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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..b01cbdae5 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_http_server_instant_tests_api_integration.py @@ -0,0 +1,1328 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..67b19d69e --- /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 000000000..96614a41d --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py @@ -0,0 +1,876 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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_utils.py b/thousandeyes-sdk-instant-tests/test/test_utils.py index 930528d9b..37913f626 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-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 000000000..b441e7737 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py @@ -0,0 +1,788 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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.py b/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api.py index 42cc933a5..adef707a8 100644 --- a/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api.py +++ b/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api.py @@ -92,6 +92,7 @@ def test_create_web_transaction_instant_test_models_validation(self) -> None: "useNtlm" : false, "credentials" : [ "3247", "1051" ], "downloadLimit" : 2048, + "chromiumTrack" : "stable", "description" : "ThousandEyes Test", "httpTimeLimit" : 5, "blockDomains" : "domain.com/", @@ -142,6 +143,7 @@ def test_create_web_transaction_instant_test_models_validation(self) -> None: "createdDate" : "2022-07-17T22:00:54Z", "disableScreenshot" : false, "createdBy" : "user@user.com", + "flagCollectConsoleLogs" : false, "testId" : "281474976710706", "chromeOptions" : "--disable-gpu", "desiredStatusCode" : "200", @@ -240,6 +242,7 @@ def test_create_web_transaction_instant_test_models_validation(self) -> None: "useNtlm" : false, "credentials" : [ "3247", "1051" ], "downloadLimit" : 2048, + "chromiumTrack" : "stable", "description" : "ThousandEyes Test", "httpTimeLimit" : 5, "blockDomains" : "domain.com/", @@ -326,6 +329,7 @@ def test_create_web_transaction_instant_test_models_validation(self) -> None: "createdDate" : "2022-07-17T22:00:54Z", "disableScreenshot" : false, "createdBy" : "user@user.com", + "flagCollectConsoleLogs" : false, "testId" : "281474976710706", "chromeOptions" : "--disable-gpu", "desiredStatusCode" : "200", 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 000000000..c7fbe7cc6 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py @@ -0,0 +1,1436 @@ +# 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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + 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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + 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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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/.openapi-generator/FILES b/thousandeyes-sdk-internet-insights/.openapi-generator/FILES index 465fddf71..240c5fd72 100644 --- a/thousandeyes-sdk-internet-insights/.openapi-generator/FILES +++ b/thousandeyes-sdk-internet-insights/.openapi-generator/FILES @@ -58,6 +58,11 @@ src/thousandeyes_sdk/internet_insights/models/validation_error.py src/thousandeyes_sdk/internet_insights/models/validation_error_item.py src/thousandeyes_sdk/internet_insights/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_internet_insights_catalog_providers_api.py +test/test_internet_insights_catalog_providers_api_integration.py test/test_internet_insights_outages_api.py +test/test_internet_insights_outages_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-internet-insights/README.md b/thousandeyes-sdk-internet-insights/README.md index 4dd0eb420..334b9e00b 100644 --- a/thousandeyes-sdk-internet-insights/README.md +++ b/thousandeyes-sdk-internet-insights/README.md @@ -16,7 +16,7 @@ For more information about Internet Insights, see the [Internet Insights](https: This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -89,7 +89,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.internet_insights.InternetInsightsCatalogProvidersApi(api_client) - api_catalog_provider_filter = thousandeyes_sdk.internet_insights.ApiCatalogProviderFilter() # ApiCatalogProviderFilter | + api_catalog_provider_filter = # ApiCatalogProviderFilter | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-internet-insights/docs/InternetInsightsCatalogProvidersApi.md b/thousandeyes-sdk-internet-insights/docs/InternetInsightsCatalogProvidersApi.md index d98e531d2..0edf337eb 100644 --- a/thousandeyes-sdk-internet-insights/docs/InternetInsightsCatalogProvidersApi.md +++ b/thousandeyes-sdk-internet-insights/docs/InternetInsightsCatalogProvidersApi.md @@ -46,7 +46,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.internet_insights.InternetInsightsCatalogProvidersApi(api_client) - api_catalog_provider_filter = thousandeyes_sdk.internet_insights.ApiCatalogProviderFilter() # ApiCatalogProviderFilter | + api_catalog_provider_filter = # ApiCatalogProviderFilter | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-internet-insights/docs/InternetInsightsOutagesApi.md b/thousandeyes-sdk-internet-insights/docs/InternetInsightsOutagesApi.md index 2c19fd3f8..97dd6efbb 100644 --- a/thousandeyes-sdk-internet-insights/docs/InternetInsightsOutagesApi.md +++ b/thousandeyes-sdk-internet-insights/docs/InternetInsightsOutagesApi.md @@ -47,7 +47,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.internet_insights.InternetInsightsOutagesApi(api_client) - api_outage_filter = thousandeyes_sdk.internet_insights.ApiOutageFilter() # ApiOutageFilter | + api_outage_filter = # ApiOutageFilter | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-internet-insights/test/conftest.py b/thousandeyes-sdk-internet-insights/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..693c4b1e8 --- /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 000000000..c925a517e --- /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 000000000..689bbf01f --- /dev/null +++ b/thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py @@ -0,0 +1,669 @@ +# 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 000000000..cd7d39907 --- /dev/null +++ b/thousandeyes-sdk-internet-insights/test/test_internet_insights_outages_api_integration.py @@ -0,0 +1,972 @@ +# 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-internet-insights/test/test_utils.py b/thousandeyes-sdk-internet-insights/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-snapshots/.openapi-generator/FILES index 88c13d48d..ea6466d9a 100644 --- a/thousandeyes-sdk-snapshots/.openapi-generator/FILES +++ b/thousandeyes-sdk-snapshots/.openapi-generator/FILES @@ -42,5 +42,9 @@ src/thousandeyes_sdk/snapshots/models/validation_error.py src/thousandeyes_sdk/snapshots/models/validation_error_item.py src/thousandeyes_sdk/snapshots/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_test_snapshots_api.py +test/test_test_snapshots_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-snapshots/README.md b/thousandeyes-sdk-snapshots/README.md index 4237ce5f3..cd8c5d9db 100644 --- a/thousandeyes-sdk-snapshots/README.md +++ b/thousandeyes-sdk-snapshots/README.md @@ -3,7 +3,7 @@ Creates a new test snapshot in ThousandEyes. This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -77,7 +77,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.snapshots.TestSnapshotsApi(api_client) test_id = '202701' # str | Test ID - snapshot_request = thousandeyes_sdk.snapshots.SnapshotRequest() # SnapshotRequest | + snapshot_request = # SnapshotRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-snapshots/docs/TestSnapshotsApi.md b/thousandeyes-sdk-snapshots/docs/TestSnapshotsApi.md index 5bdeeb967..8615d20cf 100644 --- a/thousandeyes-sdk-snapshots/docs/TestSnapshotsApi.md +++ b/thousandeyes-sdk-snapshots/docs/TestSnapshotsApi.md @@ -46,7 +46,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.snapshots.TestSnapshotsApi(api_client) test_id = '202701' # str | Test ID - snapshot_request = thousandeyes_sdk.snapshots.SnapshotRequest() # SnapshotRequest | + snapshot_request = # SnapshotRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-snapshots/test/conftest.py b/thousandeyes-sdk-snapshots/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..f7109bbbf --- /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 000000000..0b88c58de --- /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 000000000..a8bf42de2 --- /dev/null +++ b/thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py @@ -0,0 +1,427 @@ +# 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-snapshots/test/test_utils.py b/thousandeyes-sdk-snapshots/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-streaming/.openapi-generator/FILES index fcda2a9e2..230602a3d 100644 --- a/thousandeyes-sdk-streaming/.openapi-generator/FILES +++ b/thousandeyes-sdk-streaming/.openapi-generator/FILES @@ -6,6 +6,7 @@ docs/ApiErrorIntegrationLimits.md docs/AuditOperation.md docs/AuditOperationWithUpdate.md docs/BadRequestError.md +docs/ConnectedDevices.md docs/CreateStreamResponse.md docs/DataModelVersion.md docs/EndpointAgentLabel.md @@ -18,6 +19,8 @@ docs/ExporterConfigSplunkHec.md docs/Filters.md docs/FiltersTestTypes.md docs/GetStreamResponse.md +docs/InputConfig.md +docs/InputConfigMetric.md docs/PutStream.md docs/Signal.md docs/Stream.md @@ -44,6 +47,7 @@ src/thousandeyes_sdk/streaming/models/api_error_integration_limits.py src/thousandeyes_sdk/streaming/models/audit_operation.py src/thousandeyes_sdk/streaming/models/audit_operation_with_update.py src/thousandeyes_sdk/streaming/models/bad_request_error.py +src/thousandeyes_sdk/streaming/models/connected_devices.py src/thousandeyes_sdk/streaming/models/create_stream_response.py src/thousandeyes_sdk/streaming/models/data_model_version.py src/thousandeyes_sdk/streaming/models/endpoint_agent_label.py @@ -56,6 +60,8 @@ src/thousandeyes_sdk/streaming/models/exporter_config_splunk_hec.py src/thousandeyes_sdk/streaming/models/filters.py src/thousandeyes_sdk/streaming/models/filters_test_types.py src/thousandeyes_sdk/streaming/models/get_stream_response.py +src/thousandeyes_sdk/streaming/models/input_config.py +src/thousandeyes_sdk/streaming/models/input_config_metric.py src/thousandeyes_sdk/streaming/models/put_stream.py src/thousandeyes_sdk/streaming/models/signal.py src/thousandeyes_sdk/streaming/models/stream.py @@ -72,5 +78,9 @@ src/thousandeyes_sdk/streaming/models/test_type.py src/thousandeyes_sdk/streaming/models/unauthorized_error.py src/thousandeyes_sdk/streaming/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_streaming_api.py +test/test_streaming_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-streaming/README.md b/thousandeyes-sdk-streaming/README.md index 902038d83..e817cf0db 100644 --- a/thousandeyes-sdk-streaming/README.md +++ b/thousandeyes-sdk-streaming/README.md @@ -2,6 +2,7 @@ **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces +* Connected Devices * OTel-based integrations that rely on connectors and operations, including: * Splunk Cloud Platform HEC * Splunk Enterprise HEC @@ -24,7 +25,7 @@ For more information about ThousandEyes for OpenTelemetry, see the [product docu This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -98,7 +99,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.streaming.StreamingApi(api_client) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - stream = thousandeyes_sdk.streaming.Stream() # Stream | Stream to configure (optional) + stream = # Stream | Stream to configure (optional) try: # Create data stream @@ -130,6 +131,7 @@ Class | Method | HTTP request | Description - [AuditOperation](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/AuditOperation.md) - [AuditOperationWithUpdate](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/AuditOperationWithUpdate.md) - [BadRequestError](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/BadRequestError.md) + - [ConnectedDevices](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/ConnectedDevices.md) - [CreateStreamResponse](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/CreateStreamResponse.md) - [DataModelVersion](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/DataModelVersion.md) - [EndpointAgentLabel](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/EndpointAgentLabel.md) @@ -142,6 +144,8 @@ Class | Method | HTTP request | Description - [Filters](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/Filters.md) - [FiltersTestTypes](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/FiltersTestTypes.md) - [GetStreamResponse](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/GetStreamResponse.md) + - [InputConfig](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/InputConfig.md) + - [InputConfigMetric](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/InputConfigMetric.md) - [PutStream](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/PutStream.md) - [Signal](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/Signal.md) - [Stream](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-streaming/docs/Stream.md) diff --git a/thousandeyes-sdk-streaming/docs/ConnectedDevices.md b/thousandeyes-sdk-streaming/docs/ConnectedDevices.md new file mode 100644 index 000000000..6ea0a9492 --- /dev/null +++ b/thousandeyes-sdk-streaming/docs/ConnectedDevices.md @@ -0,0 +1,30 @@ +# ConnectedDevices + +Configuration for Connected Devices metric data in the stream integration. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enabled** | **bool** | Flag to enable or disable Connected Devices data. | [default to False] + +## Example + +```python +from thousandeyes_sdk.streaming.models.connected_devices import ConnectedDevices + +# TODO update the JSON string below +json = "{}" +# create an instance of ConnectedDevices from a JSON string +connected_devices_instance = ConnectedDevices.from_json(json) +# print the JSON string representation of the object +print(ConnectedDevices.to_json()) + +# convert the object into a dict +connected_devices_dict = connected_devices_instance.to_dict() +# create an instance of ConnectedDevices from a dict +connected_devices_from_dict = ConnectedDevices.from_dict(connected_devices_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-streaming/docs/CreateStreamResponse.md b/thousandeyes-sdk-streaming/docs/CreateStreamResponse.md index 42c62a735..76ebd54a6 100644 --- a/thousandeyes-sdk-streaming/docs/CreateStreamResponse.md +++ b/thousandeyes-sdk-streaming/docs/CreateStreamResponse.md @@ -17,6 +17,7 @@ Name | Type | Description | Notes **tag_match** | [**List[TagMatch]**](TagMatch.md) | A collection of tags that determine what tests are included in the data stream. These tag values are also included as attributes in the data stream metrics. Tags are invalid if the tag key includes characters that are not allowed by the [OpenTelemetry naming recommendations for attributes](https://opentelemetry.io/docs/specs/semconv/general/naming/#recommendations-for-application-developers). | [optional] **test_match** | [**List[TestMatch]**](TestMatch.md) | A collection of tests to be included in the data stream. | [optional] **filters** | [**Filters**](Filters.md) | | [optional] +**input_config** | [**InputConfig**](InputConfig.md) | | [optional] **exporter_config** | [**ExporterConfig**](ExporterConfig.md) | | [optional] **endpoint_agent_label** | [**List[EndpointAgentLabel]**](EndpointAgentLabel.md) | A collection of Endpoint Agent label IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized. | [optional] **endpoint_agent_tag** | [**List[EndpointAgentTag]**](EndpointAgentTag.md) | A collection of Endpoint Agent Tag IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized. | [optional] diff --git a/thousandeyes-sdk-streaming/docs/GetStreamResponse.md b/thousandeyes-sdk-streaming/docs/GetStreamResponse.md index 65078eb99..4cb7c374c 100644 --- a/thousandeyes-sdk-streaming/docs/GetStreamResponse.md +++ b/thousandeyes-sdk-streaming/docs/GetStreamResponse.md @@ -17,6 +17,7 @@ Name | Type | Description | Notes **tag_match** | [**List[TagMatch]**](TagMatch.md) | A collection of tags that determine what tests are included in the data stream. These tag values are also included as attributes in the data stream metrics. Tags are invalid if the tag key includes characters that are not allowed by the [OpenTelemetry naming recommendations for attributes](https://opentelemetry.io/docs/specs/semconv/general/naming/#recommendations-for-application-developers). | [optional] **test_match** | [**List[TestMatch]**](TestMatch.md) | A collection of tests to be included in the data stream. | [optional] **filters** | [**Filters**](Filters.md) | | [optional] +**input_config** | [**InputConfig**](InputConfig.md) | | [optional] **exporter_config** | [**ExporterConfig**](ExporterConfig.md) | | [optional] **endpoint_agent_label** | [**List[EndpointAgentLabel]**](EndpointAgentLabel.md) | A collection of Endpoint Agent label IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized. | [optional] **endpoint_agent_tag** | [**List[EndpointAgentTag]**](EndpointAgentTag.md) | A collection of Endpoint Agent Tag IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized. | [optional] diff --git a/thousandeyes-sdk-streaming/docs/InputConfig.md b/thousandeyes-sdk-streaming/docs/InputConfig.md new file mode 100644 index 000000000..8bf1cb880 --- /dev/null +++ b/thousandeyes-sdk-streaming/docs/InputConfig.md @@ -0,0 +1,30 @@ +# InputConfig + +Configuration that specifies which input data is included for each signal. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metric** | [**InputConfigMetric**](InputConfigMetric.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.streaming.models.input_config import InputConfig + +# TODO update the JSON string below +json = "{}" +# create an instance of InputConfig from a JSON string +input_config_instance = InputConfig.from_json(json) +# print the JSON string representation of the object +print(InputConfig.to_json()) + +# convert the object into a dict +input_config_dict = input_config_instance.to_dict() +# create an instance of InputConfig from a dict +input_config_from_dict = InputConfig.from_dict(input_config_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-streaming/docs/InputConfigMetric.md b/thousandeyes-sdk-streaming/docs/InputConfigMetric.md new file mode 100644 index 000000000..a07b93b57 --- /dev/null +++ b/thousandeyes-sdk-streaming/docs/InputConfigMetric.md @@ -0,0 +1,30 @@ +# InputConfigMetric + +Configuration for metric input data in the stream integration. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**connected_devices** | [**ConnectedDevices**](ConnectedDevices.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.streaming.models.input_config_metric import InputConfigMetric + +# TODO update the JSON string below +json = "{}" +# create an instance of InputConfigMetric from a JSON string +input_config_metric_instance = InputConfigMetric.from_json(json) +# print the JSON string representation of the object +print(InputConfigMetric.to_json()) + +# convert the object into a dict +input_config_metric_dict = input_config_metric_instance.to_dict() +# create an instance of InputConfigMetric from a dict +input_config_metric_from_dict = InputConfigMetric.from_dict(input_config_metric_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-streaming/docs/PutStream.md b/thousandeyes-sdk-streaming/docs/PutStream.md index b2554a71e..37748d325 100644 --- a/thousandeyes-sdk-streaming/docs/PutStream.md +++ b/thousandeyes-sdk-streaming/docs/PutStream.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **test_match** | [**List[TestMatch]**](TestMatch.md) | A collection of tests to be included in the data stream. | [optional] **enabled** | **bool** | Flag to enable or disable the stream integration. | [optional] **filters** | [**Filters**](Filters.md) | | [optional] +**input_config** | [**InputConfig**](InputConfig.md) | | [optional] **exporter_config** | [**ExporterConfig**](ExporterConfig.md) | | [optional] **endpoint_agent_label** | [**List[EndpointAgentLabel]**](EndpointAgentLabel.md) | A collection of Endpoint Agent label IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized. | [optional] **endpoint_agent_tag** | [**List[EndpointAgentTag]**](EndpointAgentTag.md) | A collection of Endpoint Agent Tag IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized. | [optional] diff --git a/thousandeyes-sdk-streaming/docs/Stream.md b/thousandeyes-sdk-streaming/docs/Stream.md index f754c1f31..23f364721 100644 --- a/thousandeyes-sdk-streaming/docs/Stream.md +++ b/thousandeyes-sdk-streaming/docs/Stream.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **test_match** | [**List[TestMatch]**](TestMatch.md) | A collection of tests to be included in the data stream. | [optional] **enabled** | **bool** | Flag to enable or disable the stream integration. | [optional] **filters** | [**Filters**](Filters.md) | | [optional] +**input_config** | [**InputConfig**](InputConfig.md) | | [optional] **exporter_config** | [**ExporterConfig**](ExporterConfig.md) | | [optional] **endpoint_agent_label** | [**List[EndpointAgentLabel]**](EndpointAgentLabel.md) | A collection of Endpoint Agent label IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized. | [optional] **endpoint_agent_tag** | [**List[EndpointAgentTag]**](EndpointAgentTag.md) | A collection of Endpoint Agent Tag IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized. | [optional] diff --git a/thousandeyes-sdk-streaming/docs/StreamingApi.md b/thousandeyes-sdk-streaming/docs/StreamingApi.md index ebf24a0ce..dd20f1c7b 100644 --- a/thousandeyes-sdk-streaming/docs/StreamingApi.md +++ b/thousandeyes-sdk-streaming/docs/StreamingApi.md @@ -50,7 +50,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.streaming.StreamingApi(api_client) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - stream = thousandeyes_sdk.streaming.Stream() # Stream | Stream to configure (optional) + stream = # Stream | Stream to configure (optional) try: # Create data stream @@ -219,7 +219,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.streaming.StreamingApi(api_client) id = 'id_example' # str | ID of stream to query aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - type = thousandeyes_sdk.streaming.StreamType() # StreamType | Optional filter on type of Stream; should match one of Stream `type` enum (optional) + type = # StreamType | Optional filter on type of Stream; should match one of Stream `type` enum (optional) try: # Retrieve data stream @@ -306,7 +306,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.streaming.StreamingApi(api_client) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - type = thousandeyes_sdk.streaming.StreamType() # StreamType | Optional filter on type of Stream; should match one of Stream `type` enum (optional) + type = # StreamType | Optional filter on type of Stream; should match one of Stream `type` enum (optional) try: # List data streams @@ -393,7 +393,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.streaming.StreamingApi(api_client) id = 'id_example' # str | ID of stream to query aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - put_stream = thousandeyes_sdk.streaming.PutStream() # PutStream | (optional) + put_stream = # PutStream | (optional) try: # Update data stream diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/__init__.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/__init__.py index ff143b3b4..9b4ad71fd 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/__init__.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/__init__.py @@ -5,7 +5,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) @@ -23,6 +23,7 @@ from thousandeyes_sdk.streaming.models.audit_operation import AuditOperation from thousandeyes_sdk.streaming.models.audit_operation_with_update import AuditOperationWithUpdate from thousandeyes_sdk.streaming.models.bad_request_error import BadRequestError +from thousandeyes_sdk.streaming.models.connected_devices import ConnectedDevices from thousandeyes_sdk.streaming.models.create_stream_response import CreateStreamResponse from thousandeyes_sdk.streaming.models.data_model_version import DataModelVersion from thousandeyes_sdk.streaming.models.endpoint_agent_label import EndpointAgentLabel @@ -35,6 +36,8 @@ from thousandeyes_sdk.streaming.models.filters import Filters from thousandeyes_sdk.streaming.models.filters_test_types import FiltersTestTypes from thousandeyes_sdk.streaming.models.get_stream_response import GetStreamResponse +from thousandeyes_sdk.streaming.models.input_config import InputConfig +from thousandeyes_sdk.streaming.models.input_config_metric import InputConfigMetric from thousandeyes_sdk.streaming.models.put_stream import PutStream from thousandeyes_sdk.streaming.models.signal import Signal from thousandeyes_sdk.streaming.models.stream import Stream diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/api/streaming_api.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/api/streaming_api.py index b4e9ff1d2..194062eb7 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/api/streaming_api.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/api/streaming_api.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/__init__.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/__init__.py index f4eb459d9..14edddd06 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/__init__.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/__init__.py @@ -4,7 +4,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) @@ -18,6 +18,7 @@ from thousandeyes_sdk.streaming.models.audit_operation import AuditOperation from thousandeyes_sdk.streaming.models.audit_operation_with_update import AuditOperationWithUpdate from thousandeyes_sdk.streaming.models.bad_request_error import BadRequestError +from thousandeyes_sdk.streaming.models.connected_devices import ConnectedDevices from thousandeyes_sdk.streaming.models.create_stream_response import CreateStreamResponse from thousandeyes_sdk.streaming.models.data_model_version import DataModelVersion from thousandeyes_sdk.streaming.models.endpoint_agent_label import EndpointAgentLabel @@ -30,6 +31,8 @@ from thousandeyes_sdk.streaming.models.filters import Filters from thousandeyes_sdk.streaming.models.filters_test_types import FiltersTestTypes from thousandeyes_sdk.streaming.models.get_stream_response import GetStreamResponse +from thousandeyes_sdk.streaming.models.input_config import InputConfig +from thousandeyes_sdk.streaming.models.input_config_metric import InputConfigMetric from thousandeyes_sdk.streaming.models.put_stream import PutStream from thousandeyes_sdk.streaming.models.signal import Signal from thousandeyes_sdk.streaming.models.stream import Stream diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/api_error.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/api_error.py index 4b020de9a..106405109 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/api_error.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/api_error.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/api_error_integration_limits.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/api_error_integration_limits.py index 9504badd3..9e89d87b5 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/api_error_integration_limits.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/api_error_integration_limits.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/audit_operation.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/audit_operation.py index 2fc027179..e3ecafd70 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/audit_operation.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/audit_operation.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/audit_operation_with_update.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/audit_operation_with_update.py index 186ae201b..a4edb082f 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/audit_operation_with_update.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/audit_operation_with_update.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/bad_request_error.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/bad_request_error.py index e24ed21af..d071fffed 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/bad_request_error.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/bad_request_error.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/connected_devices.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/connected_devices.py new file mode 100644 index 000000000..df7029172 --- /dev/null +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/connected_devices.py @@ -0,0 +1,87 @@ +# coding: utf-8 + +""" + ThousandEyes for OpenTelemetry API + + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ConnectedDevices(BaseModel): + """ + Configuration for Connected Devices metric data in the stream integration. + """ # noqa: E501 + enabled: StrictBool = Field(description="Flag to enable or disable Connected Devices data.") + __properties: ClassVar[List[str]] = ["enabled"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConnectedDevices from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConnectedDevices from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "enabled": obj.get("enabled") if obj.get("enabled") is not None else False + }) + return _obj + + diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/create_stream_response.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/create_stream_response.py index 55f4667a8..0375dec39 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/create_stream_response.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/create_stream_response.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) @@ -25,6 +25,7 @@ from thousandeyes_sdk.streaming.models.endpoint_type import EndpointType from thousandeyes_sdk.streaming.models.exporter_config import ExporterConfig from thousandeyes_sdk.streaming.models.filters import Filters +from thousandeyes_sdk.streaming.models.input_config import InputConfig from thousandeyes_sdk.streaming.models.signal import Signal from thousandeyes_sdk.streaming.models.stream_links import StreamLinks from thousandeyes_sdk.streaming.models.stream_status import StreamStatus @@ -50,12 +51,13 @@ class CreateStreamResponse(BaseModel): tag_match: Optional[List[TagMatch]] = Field(default=None, description="A collection of tags that determine what tests are included in the data stream. These tag values are also included as attributes in the data stream metrics. Tags are invalid if the tag key includes characters that are not allowed by the [OpenTelemetry naming recommendations for attributes](https://opentelemetry.io/docs/specs/semconv/general/naming/#recommendations-for-application-developers).", alias="tagMatch") test_match: Optional[List[TestMatch]] = Field(default=None, description="A collection of tests to be included in the data stream.", alias="testMatch") filters: Optional[Filters] = None + input_config: Optional[InputConfig] = Field(default=None, alias="inputConfig") exporter_config: Optional[ExporterConfig] = Field(default=None, alias="exporterConfig") endpoint_agent_label: Optional[List[EndpointAgentLabel]] = Field(default=None, description="A collection of Endpoint Agent label IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized.", alias="endpointAgentLabel") endpoint_agent_tag: Optional[List[EndpointAgentTag]] = Field(default=None, description="A collection of Endpoint Agent Tag IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized.", alias="endpointAgentTag") audit_operation: Optional[AuditOperation] = Field(default=None, alias="auditOperation") stream_status: Optional[StreamStatus] = Field(default=None, alias="streamStatus") - __properties: ClassVar[List[str]] = ["id", "enabled", "_links", "type", "signal", "endpointType", "streamEndpointUrl", "dataModelVersion", "customHeaders", "tagMatch", "testMatch", "filters", "exporterConfig", "endpointAgentLabel", "endpointAgentTag", "auditOperation", "streamStatus"] + __properties: ClassVar[List[str]] = ["id", "enabled", "_links", "type", "signal", "endpointType", "streamEndpointUrl", "dataModelVersion", "customHeaders", "tagMatch", "testMatch", "filters", "inputConfig", "exporterConfig", "endpointAgentLabel", "endpointAgentTag", "auditOperation", "streamStatus"] model_config = ConfigDict( populate_by_name=True, @@ -119,6 +121,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of filters if self.filters: _dict['filters'] = self.filters.to_dict() + # override the default output from pydantic by calling `to_dict()` of input_config + if self.input_config: + _dict['inputConfig'] = self.input_config.to_dict() # override the default output from pydantic by calling `to_dict()` of exporter_config if self.exporter_config: _dict['exporterConfig'] = self.exporter_config.to_dict() @@ -166,6 +171,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "tagMatch": [TagMatch.from_dict(_item) for _item in obj["tagMatch"]] if obj.get("tagMatch") is not None else None, "testMatch": [TestMatch.from_dict(_item) for _item in obj["testMatch"]] if obj.get("testMatch") is not None else None, "filters": Filters.from_dict(obj["filters"]) if obj.get("filters") is not None else None, + "inputConfig": InputConfig.from_dict(obj["inputConfig"]) if obj.get("inputConfig") is not None else None, "exporterConfig": ExporterConfig.from_dict(obj["exporterConfig"]) if obj.get("exporterConfig") is not None else None, "endpointAgentLabel": [EndpointAgentLabel.from_dict(_item) for _item in obj["endpointAgentLabel"]] if obj.get("endpointAgentLabel") is not None else None, "endpointAgentTag": [EndpointAgentTag.from_dict(_item) for _item in obj["endpointAgentTag"]] if obj.get("endpointAgentTag") is not None else None, diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/data_model_version.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/data_model_version.py index 34d4ccb17..069a229e7 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/data_model_version.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/data_model_version.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_agent_label.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_agent_label.py index e5fb3caa0..84ab8de8e 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_agent_label.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_agent_label.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_agent_tag.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_agent_tag.py index 7ce889e62..d25474350 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_agent_tag.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_agent_tag.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_type.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_type.py index 36ba4bb4c..a45fbdf69 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_type.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/endpoint_type.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config.py index b4b701877..11dc1a39a 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_authorization.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_authorization.py index b6b16b765..086cb7070 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_authorization.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_authorization.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_o_auth2.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_o_auth2.py index 003a7426c..d869536f0 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_o_auth2.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_o_auth2.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_splunk_hec.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_splunk_hec.py index 6428f35b5..d18b795cb 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_splunk_hec.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/exporter_config_splunk_hec.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/filters.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/filters.py index 776d0e2a1..7fe30cc58 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/filters.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/filters.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/filters_test_types.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/filters_test_types.py index 82fdb461d..d17ddea1a 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/filters_test_types.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/filters_test_types.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/get_stream_response.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/get_stream_response.py index aa46f55bc..5e445440c 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/get_stream_response.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/get_stream_response.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) @@ -25,6 +25,7 @@ from thousandeyes_sdk.streaming.models.endpoint_type import EndpointType from thousandeyes_sdk.streaming.models.exporter_config import ExporterConfig from thousandeyes_sdk.streaming.models.filters import Filters +from thousandeyes_sdk.streaming.models.input_config import InputConfig from thousandeyes_sdk.streaming.models.signal import Signal from thousandeyes_sdk.streaming.models.stream_links import StreamLinks from thousandeyes_sdk.streaming.models.stream_status import StreamStatus @@ -50,12 +51,13 @@ class GetStreamResponse(BaseModel): tag_match: Optional[List[TagMatch]] = Field(default=None, description="A collection of tags that determine what tests are included in the data stream. These tag values are also included as attributes in the data stream metrics. Tags are invalid if the tag key includes characters that are not allowed by the [OpenTelemetry naming recommendations for attributes](https://opentelemetry.io/docs/specs/semconv/general/naming/#recommendations-for-application-developers).", alias="tagMatch") test_match: Optional[List[TestMatch]] = Field(default=None, description="A collection of tests to be included in the data stream.", alias="testMatch") filters: Optional[Filters] = None + input_config: Optional[InputConfig] = Field(default=None, alias="inputConfig") exporter_config: Optional[ExporterConfig] = Field(default=None, alias="exporterConfig") endpoint_agent_label: Optional[List[EndpointAgentLabel]] = Field(default=None, description="A collection of Endpoint Agent label IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized.", alias="endpointAgentLabel") endpoint_agent_tag: Optional[List[EndpointAgentTag]] = Field(default=None, description="A collection of Endpoint Agent Tag IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized.", alias="endpointAgentTag") audit_operation: Optional[AuditOperationWithUpdate] = Field(default=None, alias="auditOperation") stream_status: Optional[StreamStatus] = Field(default=None, alias="streamStatus") - __properties: ClassVar[List[str]] = ["id", "enabled", "_links", "type", "signal", "endpointType", "streamEndpointUrl", "dataModelVersion", "customHeaders", "tagMatch", "testMatch", "filters", "exporterConfig", "endpointAgentLabel", "endpointAgentTag", "auditOperation", "streamStatus"] + __properties: ClassVar[List[str]] = ["id", "enabled", "_links", "type", "signal", "endpointType", "streamEndpointUrl", "dataModelVersion", "customHeaders", "tagMatch", "testMatch", "filters", "inputConfig", "exporterConfig", "endpointAgentLabel", "endpointAgentTag", "auditOperation", "streamStatus"] model_config = ConfigDict( populate_by_name=True, @@ -119,6 +121,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of filters if self.filters: _dict['filters'] = self.filters.to_dict() + # override the default output from pydantic by calling `to_dict()` of input_config + if self.input_config: + _dict['inputConfig'] = self.input_config.to_dict() # override the default output from pydantic by calling `to_dict()` of exporter_config if self.exporter_config: _dict['exporterConfig'] = self.exporter_config.to_dict() @@ -166,6 +171,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "tagMatch": [TagMatch.from_dict(_item) for _item in obj["tagMatch"]] if obj.get("tagMatch") is not None else None, "testMatch": [TestMatch.from_dict(_item) for _item in obj["testMatch"]] if obj.get("testMatch") is not None else None, "filters": Filters.from_dict(obj["filters"]) if obj.get("filters") is not None else None, + "inputConfig": InputConfig.from_dict(obj["inputConfig"]) if obj.get("inputConfig") is not None else None, "exporterConfig": ExporterConfig.from_dict(obj["exporterConfig"]) if obj.get("exporterConfig") is not None else None, "endpointAgentLabel": [EndpointAgentLabel.from_dict(_item) for _item in obj["endpointAgentLabel"]] if obj.get("endpointAgentLabel") is not None else None, "endpointAgentTag": [EndpointAgentTag.from_dict(_item) for _item in obj["endpointAgentTag"]] if obj.get("endpointAgentTag") is not None else None, diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/input_config.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/input_config.py new file mode 100644 index 000000000..431ba1216 --- /dev/null +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/input_config.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + ThousandEyes for OpenTelemetry API + + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from thousandeyes_sdk.streaming.models.input_config_metric import InputConfigMetric +from typing import Optional, Set +from typing_extensions import Self + +class InputConfig(BaseModel): + """ + Configuration that specifies which input data is included for each signal. + """ # noqa: E501 + metric: Optional[InputConfigMetric] = None + __properties: ClassVar[List[str]] = ["metric"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InputConfig from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of metric + if self.metric: + _dict['metric'] = self.metric.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InputConfig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metric": InputConfigMetric.from_dict(obj["metric"]) if obj.get("metric") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/input_config_metric.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/input_config_metric.py new file mode 100644 index 000000000..74278adaf --- /dev/null +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/input_config_metric.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + ThousandEyes for OpenTelemetry API + + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from thousandeyes_sdk.streaming.models.connected_devices import ConnectedDevices +from typing import Optional, Set +from typing_extensions import Self + +class InputConfigMetric(BaseModel): + """ + Configuration for metric input data in the stream integration. + """ # noqa: E501 + connected_devices: Optional[ConnectedDevices] = Field(default=None, alias="connectedDevices") + __properties: ClassVar[List[str]] = ["connectedDevices"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of InputConfigMetric from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of connected_devices + if self.connected_devices: + _dict['connectedDevices'] = self.connected_devices.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of InputConfigMetric from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "connectedDevices": ConnectedDevices.from_dict(obj["connectedDevices"]) if obj.get("connectedDevices") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/put_stream.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/put_stream.py index d9f2c7810..9bba4fce5 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/put_stream.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/put_stream.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) @@ -22,6 +22,7 @@ from thousandeyes_sdk.streaming.models.endpoint_agent_tag import EndpointAgentTag from thousandeyes_sdk.streaming.models.exporter_config import ExporterConfig from thousandeyes_sdk.streaming.models.filters import Filters +from thousandeyes_sdk.streaming.models.input_config import InputConfig from thousandeyes_sdk.streaming.models.tag_match import TagMatch from thousandeyes_sdk.streaming.models.test_match import TestMatch from typing import Optional, Set @@ -37,10 +38,11 @@ class PutStream(BaseModel): test_match: Optional[List[TestMatch]] = Field(default=None, description="A collection of tests to be included in the data stream.", alias="testMatch") enabled: Optional[StrictBool] = Field(default=None, description="Flag to enable or disable the stream integration.") filters: Optional[Filters] = None + input_config: Optional[InputConfig] = Field(default=None, alias="inputConfig") exporter_config: Optional[ExporterConfig] = Field(default=None, alias="exporterConfig") endpoint_agent_label: Optional[List[EndpointAgentLabel]] = Field(default=None, description="A collection of Endpoint Agent label IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized.", alias="endpointAgentLabel") endpoint_agent_tag: Optional[List[EndpointAgentTag]] = Field(default=None, description="A collection of Endpoint Agent Tag IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized.", alias="endpointAgentTag") - __properties: ClassVar[List[str]] = ["customHeaders", "streamEndpointUrl", "tagMatch", "testMatch", "enabled", "filters", "exporterConfig", "endpointAgentLabel", "endpointAgentTag"] + __properties: ClassVar[List[str]] = ["customHeaders", "streamEndpointUrl", "tagMatch", "testMatch", "enabled", "filters", "inputConfig", "exporterConfig", "endpointAgentLabel", "endpointAgentTag"] model_config = ConfigDict( populate_by_name=True, @@ -99,6 +101,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of filters if self.filters: _dict['filters'] = self.filters.to_dict() + # override the default output from pydantic by calling `to_dict()` of input_config + if self.input_config: + _dict['inputConfig'] = self.input_config.to_dict() # override the default output from pydantic by calling `to_dict()` of exporter_config if self.exporter_config: _dict['exporterConfig'] = self.exporter_config.to_dict() @@ -134,6 +139,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "testMatch": [TestMatch.from_dict(_item) for _item in obj["testMatch"]] if obj.get("testMatch") is not None else None, "enabled": obj.get("enabled"), "filters": Filters.from_dict(obj["filters"]) if obj.get("filters") is not None else None, + "inputConfig": InputConfig.from_dict(obj["inputConfig"]) if obj.get("inputConfig") is not None else None, "exporterConfig": ExporterConfig.from_dict(obj["exporterConfig"]) if obj.get("exporterConfig") is not None else None, "endpointAgentLabel": [EndpointAgentLabel.from_dict(_item) for _item in obj["endpointAgentLabel"]] if obj.get("endpointAgentLabel") is not None else None, "endpointAgentTag": [EndpointAgentTag.from_dict(_item) for _item in obj["endpointAgentTag"]] if obj.get("endpointAgentTag") is not None else None diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/signal.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/signal.py index ec1275a7a..9c14cda7a 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/signal.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/signal.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream.py index 402afcf0f..e7d67aae4 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) @@ -24,6 +24,7 @@ from thousandeyes_sdk.streaming.models.endpoint_type import EndpointType from thousandeyes_sdk.streaming.models.exporter_config import ExporterConfig from thousandeyes_sdk.streaming.models.filters import Filters +from thousandeyes_sdk.streaming.models.input_config import InputConfig from thousandeyes_sdk.streaming.models.signal import Signal from thousandeyes_sdk.streaming.models.stream_type import StreamType from thousandeyes_sdk.streaming.models.tag_match import TagMatch @@ -41,6 +42,7 @@ class Stream(BaseModel): test_match: Optional[List[TestMatch]] = Field(default=None, description="A collection of tests to be included in the data stream.", alias="testMatch") enabled: Optional[StrictBool] = Field(default=None, description="Flag to enable or disable the stream integration.") filters: Optional[Filters] = None + input_config: Optional[InputConfig] = Field(default=None, alias="inputConfig") exporter_config: Optional[ExporterConfig] = Field(default=None, alias="exporterConfig") endpoint_agent_label: Optional[List[EndpointAgentLabel]] = Field(default=None, description="A collection of Endpoint Agent label IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized.", alias="endpointAgentLabel") endpoint_agent_tag: Optional[List[EndpointAgentTag]] = Field(default=None, description="A collection of Endpoint Agent Tag IDs that determines what local network data is included in the data stream. `endpointAgentLabel` and `endpointAgentTag` represent the same data. Configure only one; both are synchronized.", alias="endpointAgentTag") @@ -48,7 +50,7 @@ class Stream(BaseModel): signal: Optional[Signal] = None endpoint_type: Optional[EndpointType] = Field(default=None, alias="endpointType") data_model_version: Optional[DataModelVersion] = Field(default=None, alias="dataModelVersion") - __properties: ClassVar[List[str]] = ["customHeaders", "streamEndpointUrl", "tagMatch", "testMatch", "enabled", "filters", "exporterConfig", "endpointAgentLabel", "endpointAgentTag", "type", "signal", "endpointType", "dataModelVersion"] + __properties: ClassVar[List[str]] = ["customHeaders", "streamEndpointUrl", "tagMatch", "testMatch", "enabled", "filters", "inputConfig", "exporterConfig", "endpointAgentLabel", "endpointAgentTag", "type", "signal", "endpointType", "dataModelVersion"] model_config = ConfigDict( populate_by_name=True, @@ -107,6 +109,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of filters if self.filters: _dict['filters'] = self.filters.to_dict() + # override the default output from pydantic by calling `to_dict()` of input_config + if self.input_config: + _dict['inputConfig'] = self.input_config.to_dict() # override the default output from pydantic by calling `to_dict()` of exporter_config if self.exporter_config: _dict['exporterConfig'] = self.exporter_config.to_dict() @@ -142,6 +147,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "testMatch": [TestMatch.from_dict(_item) for _item in obj["testMatch"]] if obj.get("testMatch") is not None else None, "enabled": obj.get("enabled"), "filters": Filters.from_dict(obj["filters"]) if obj.get("filters") is not None else None, + "inputConfig": InputConfig.from_dict(obj["inputConfig"]) if obj.get("inputConfig") is not None else None, "exporterConfig": ExporterConfig.from_dict(obj["exporterConfig"]) if obj.get("exporterConfig") is not None else None, "endpointAgentLabel": [EndpointAgentLabel.from_dict(_item) for _item in obj["endpointAgentLabel"]] if obj.get("endpointAgentLabel") is not None else None, "endpointAgentTag": [EndpointAgentTag.from_dict(_item) for _item in obj["endpointAgentTag"]] if obj.get("endpointAgentTag") is not None else None, diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_links.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_links.py index f2e174528..8f3f5e529 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_links.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_links.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_response.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_response.py index fdfffcf01..55457d7b9 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_response.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_response.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_self_link.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_self_link.py index 440547c49..c73584a83 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_self_link.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_self_link.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_status.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_status.py index 54cecd298..8252180ee 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_status.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_status.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_status_type.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_status_type.py index 005ef888c..f56f47055 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_status_type.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_status_type.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_type.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_type.py index ad4b1ea86..cfcaea585 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_type.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/stream_type.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/tag_match.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/tag_match.py index f3abb84f6..7af90bac2 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/tag_match.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/tag_match.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_match.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_match.py index f7d784509..34daa8459 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_match.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_match.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_match_domain.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_match_domain.py index 8378c6506..04d54c0a6 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_match_domain.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_match_domain.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_type.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_type.py index e9e2997e7..852cb9006 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_type.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/test_type.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/unauthorized_error.py b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/unauthorized_error.py index d8a18edee..a278848c9 100644 --- a/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/unauthorized_error.py +++ b/thousandeyes-sdk-streaming/src/thousandeyes_sdk/streaming/models/unauthorized_error.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) diff --git a/thousandeyes-sdk-streaming/test/conftest.py b/thousandeyes-sdk-streaming/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..3318023d8 --- /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 * Connected Devices * 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 000000000..7f8ea0102 --- /dev/null +++ b/thousandeyes-sdk-streaming/test/mock_manifest.py @@ -0,0 +1,808 @@ +# coding: utf-8 + +""" + ThousandEyes for OpenTelemetry API + + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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.py b/thousandeyes-sdk-streaming/test/test_streaming_api.py index 1bd73a8e7..d41c2794d 100644 --- a/thousandeyes-sdk-streaming/test/test_streaming_api.py +++ b/thousandeyes-sdk-streaming/test/test_streaming_api.py @@ -3,7 +3,7 @@ """ 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). + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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) @@ -37,6 +37,13 @@ def test_create_stream_models_validation(self) -> None: }, { "id" : "1234" } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, "endpointType" : "grpc", "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", "exporterConfig" : { @@ -101,6 +108,13 @@ def test_create_stream_models_validation(self) -> None: }, { "id" : "1234" } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, "endpointType" : "grpc", "_links" : { "self" : { @@ -186,6 +200,13 @@ def test_get_stream_models_validation(self) -> None: }, { "id" : "1234" } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, "endpointType" : "grpc", "_links" : { "self" : { @@ -269,6 +290,13 @@ def test_get_streams_models_validation(self) -> None: }, { "id" : "1234" } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, "endpointType" : "grpc", "_links" : { "self" : { @@ -342,6 +370,13 @@ def test_get_streams_models_validation(self) -> None: }, { "id" : "1234" } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, "endpointType" : "grpc", "_links" : { "self" : { @@ -439,6 +474,13 @@ def test_update_stream_models_validation(self) -> None: "id" : "5678", "domain" : "endpoint" } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", "exporterConfig" : { "authorization" : { @@ -487,6 +529,13 @@ def test_update_stream_models_validation(self) -> None: }, { "id" : "1234" } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, "endpointType" : "grpc", "_links" : { "self" : { 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 000000000..e09be920a --- /dev/null +++ b/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py @@ -0,0 +1,1502 @@ +# coding: utf-8 + +""" + ThousandEyes for OpenTelemetry API + + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * Connected Devices * 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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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' + response_body_json = """ + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + 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, + + _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' + response_body_json = """ + [ { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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, + + _headers=self.te_headers("get_streams"), + ) + 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: + """Integration test for get_streams error path (HTTP 400)""" + 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.get_streams( + + aid=aid, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + 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, + + _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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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" + } ], + "inputConfig" : { + "metric" : { + "connectedDevices" : { + "enabled" : true + } + } + }, + "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-streaming/test/test_utils.py b/thousandeyes-sdk-streaming/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-tags/.openapi-generator/FILES index 2bfbde680..f6df16c34 100644 --- a/thousandeyes-sdk-tags/.openapi-generator/FILES +++ b/thousandeyes-sdk-tags/.openapi-generator/FILES @@ -62,6 +62,11 @@ src/thousandeyes_sdk/tags/models/validation_error.py src/thousandeyes_sdk/tags/models/validation_error_item.py src/thousandeyes_sdk/tags/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_tag_assignment_api.py +test/test_tag_assignment_api_integration.py test/test_tags_api.py +test/test_tags_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-tags/README.md b/thousandeyes-sdk-tags/README.md index 09a4b4809..9554db83d 100644 --- a/thousandeyes-sdk-tags/README.md +++ b/thousandeyes-sdk-tags/README.md @@ -16,7 +16,7 @@ Things to note with the ThousandEyes Tags API: This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -90,7 +90,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tags.TagAssignmentApi(api_client) id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' # str | Tag ID - tag_assignment = thousandeyes_sdk.tags.TagAssignment() # TagAssignment | + tag_assignment = # TagAssignment | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-tags/docs/TagAssignmentApi.md b/thousandeyes-sdk-tags/docs/TagAssignmentApi.md index 91dd869a3..c2a83daaf 100644 --- a/thousandeyes-sdk-tags/docs/TagAssignmentApi.md +++ b/thousandeyes-sdk-tags/docs/TagAssignmentApi.md @@ -49,7 +49,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tags.TagAssignmentApi(api_client) id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' # str | Tag ID - tag_assignment = thousandeyes_sdk.tags.TagAssignment() # TagAssignment | + tag_assignment = # TagAssignment | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -83,7 +83,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json - - **Accept**: application/hal+json, application/json, application/problem+json + - **Accept**: application/json, application/hal+json, application/problem+json ### HTTP response details @@ -135,7 +135,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tags.TagAssignmentApi(api_client) - bulk_tag_assignments = thousandeyes_sdk.tags.BulkTagAssignments() # BulkTagAssignments | + bulk_tag_assignments = # BulkTagAssignments | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -168,7 +168,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json - - **Accept**: application/hal+json, application/json, application/problem+json + - **Accept**: application/json, application/hal+json, application/problem+json ### HTTP response details @@ -221,7 +221,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tags.TagAssignmentApi(api_client) id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' # str | Tag ID - tag_assignment = thousandeyes_sdk.tags.TagAssignment() # TagAssignment | + tag_assignment = # TagAssignment | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -305,7 +305,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tags.TagAssignmentApi(api_client) - bulk_tag_assignments = thousandeyes_sdk.tags.BulkTagAssignments() # BulkTagAssignments | + bulk_tag_assignments = # BulkTagAssignments | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -338,7 +338,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json - - **Accept**: application/hal+json, application/json, application/problem+json + - **Accept**: application/json, application/hal+json, application/problem+json ### HTTP response details diff --git a/thousandeyes-sdk-tags/docs/TagsApi.md b/thousandeyes-sdk-tags/docs/TagsApi.md index 0c5c03f2c..5fb2d811b 100644 --- a/thousandeyes-sdk-tags/docs/TagsApi.md +++ b/thousandeyes-sdk-tags/docs/TagsApi.md @@ -51,7 +51,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tags.TagsApi(api_client) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - tag_info = thousandeyes_sdk.tags.TagInfo() # TagInfo | Tag resource (optional) + tag_info = {"key":"network-interface","value":"approved-nics","objectType":"endpoint-agent","type":"dynamic","matchType":"and","filters":[{"key":"nic-model","values":["Intel(R) Wi-Fi 6 AX200 160MHz"],"mode":"in","scope":"default"},{"key":"nic-driver-version","values":["22.250.0.9"],"mode":"in","scope":"default"}]} # TagInfo | Tag resource (optional) try: # Create tag @@ -83,7 +83,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json - - **Accept**: application/hal+json, application/json, application/problem+json + - **Accept**: application/json, application/hal+json, application/problem+json ### HTTP response details @@ -135,7 +135,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tags.TagsApi(api_client) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - bulk_tag_response = thousandeyes_sdk.tags.BulkTagResponse() # BulkTagResponse | Tag resource (optional) + bulk_tag_response = # BulkTagResponse | Tag resource (optional) try: # Create multiple tags @@ -167,7 +167,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json - - **Accept**: application/hal+json, application/json, application/problem+json + - **Accept**: application/json, application/hal+json, application/problem+json ### HTTP response details @@ -302,7 +302,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.tags.TagsApi(api_client) id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' # str | Tag ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] # List[ExpandTagsOptions] | Optional, to retrieve associated assignments. Only static tags will return object assignments. (optional) + expand = # List[ExpandTagsOptions] | Optional, to retrieve associated assignments. Only static tags will return object assignments. (optional) try: # Retrieve tag @@ -335,7 +335,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/hal+json, application/json, application/problem+json + - **Accept**: application/json, application/hal+json, application/problem+json ### HTTP response details @@ -389,7 +389,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tags.TagsApi(api_client) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tags.ExpandTagsOptions()] # List[ExpandTagsOptions] | Optional, to retrieve associated assignments. Only static tags will return object assignments. (optional) + expand = # List[ExpandTagsOptions] | Optional, to retrieve associated assignments. Only static tags will return object assignments. (optional) try: # List tags @@ -421,7 +421,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/hal+json, application/json, application/problem+json + - **Accept**: application/json, application/hal+json, application/problem+json ### HTTP response details @@ -476,7 +476,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.tags.TagsApi(api_client) id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55' # str | ID of tag to update aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - tag_info = thousandeyes_sdk.tags.TagInfo() # TagInfo | (optional) + tag_info = # TagInfo | (optional) try: # Update tag @@ -509,7 +509,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json - - **Accept**: application/hal+json, application/json, application/problem+json + - **Accept**: application/json, application/hal+json, application/problem+json ### HTTP response details diff --git a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tag_assignment_api.py b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tag_assignment_api.py index 5223fe67f..a4f1ca36a 100644 --- a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tag_assignment_api.py +++ b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tag_assignment_api.py @@ -324,8 +324,8 @@ def _assign_tag_serialize( # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( [ - 'application/hal+json', 'application/json', + 'application/hal+json', 'application/problem+json' ] ) @@ -631,8 +631,8 @@ def _assign_tags_serialize( # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( [ - 'application/hal+json', 'application/json', + 'application/hal+json', 'application/problem+json' ] ) @@ -1259,8 +1259,8 @@ def _unassign_tags_serialize( # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( [ - 'application/hal+json', 'application/json', + 'application/hal+json', 'application/problem+json' ] ) diff --git a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tags_api.py b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tags_api.py index fcbe6965a..8489f4b28 100644 --- a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tags_api.py +++ b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/api/tags_api.py @@ -308,8 +308,8 @@ def _create_tag_serialize( # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( [ - 'application/hal+json', 'application/json', + 'application/hal+json', 'application/problem+json' ] ) @@ -609,8 +609,8 @@ def _create_tags_serialize( # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( [ - 'application/hal+json', 'application/json', + 'application/hal+json', 'application/problem+json' ] ) @@ -1227,8 +1227,8 @@ def _get_tag_serialize( # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( [ - 'application/hal+json', 'application/json', + 'application/hal+json', 'application/problem+json' ] ) @@ -1524,8 +1524,8 @@ def _get_tags_serialize( # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( [ - 'application/hal+json', 'application/json', + 'application/hal+json', 'application/problem+json' ] ) @@ -1833,8 +1833,8 @@ def _update_tag_serialize( # set the HTTP header `Accept` _header_params['Accept'] = self.api_client.select_header_accept( [ - 'application/hal+json', 'application/json', + 'application/hal+json', 'application/problem+json' ] ) diff --git a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/models/tag.py b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/models/tag.py index 0af3a07de..0370bb8f1 100644 --- a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/models/tag.py +++ b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/models/tag.py @@ -124,6 +124,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of links if self.links: _dict['_links'] = self.links.to_dict() + # set to None if aid (nullable) is None + # and model_fields_set contains the field + if self.aid is None and "aid" in self.model_fields_set: + _dict['aid'] = None + # set to None if icon (nullable) is None # and model_fields_set contains the field if self.icon is None and "icon" in self.model_fields_set: diff --git a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/models/tag_info.py b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/models/tag_info.py index c5464d26e..699a9d493 100644 --- a/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/models/tag_info.py +++ b/thousandeyes-sdk-tags/src/thousandeyes_sdk/tags/models/tag_info.py @@ -119,6 +119,11 @@ def to_dict(self) -> Dict[str, Any]: if _item: _items.append(_item.to_dict()) _dict['filters'] = _items + # set to None if aid (nullable) is None + # and model_fields_set contains the field + if self.aid is None and "aid" in self.model_fields_set: + _dict['aid'] = None + # set to None if icon (nullable) is None # and model_fields_set contains the field if self.icon is None and "icon" in self.model_fields_set: diff --git a/thousandeyes-sdk-tags/test/conftest.py b/thousandeyes-sdk-tags/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..38df1ff20 --- /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 000000000..6d9518519 --- /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 000000000..692a2599f --- /dev/null +++ b/thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py @@ -0,0 +1,1717 @@ +# 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 000000000..c26524625 --- /dev/null +++ b/thousandeyes-sdk-tags/test/test_tags_api_integration.py @@ -0,0 +1,2469 @@ +# 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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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-tags/test/test_utils.py b/thousandeyes-sdk-tags/test/test_utils.py index 930528d9b..37913f626 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/.openapi-generator/FILES b/thousandeyes-sdk-test-results/.openapi-generator/FILES index 641dee9c8..2906b994f 100644 --- a/thousandeyes-sdk-test-results/.openapi-generator/FILES +++ b/thousandeyes-sdk-test-results/.openapi-generator/FILES @@ -16,6 +16,9 @@ docs/BgpTestResult.md docs/BgpTestResults.md docs/BgpTestRouteInformationResult.md docs/BgpTestRouteInformationResults.md +docs/ConsoleLogs.md +docs/ConsoleLogsResult.md +docs/ConsoleLogsTestResults.md docs/DNSSECTestResultsApi.md docs/DNSServerTestResultsApi.md docs/DNSTraceTestResultsApi.md @@ -127,6 +130,9 @@ src/thousandeyes_sdk/test_results/models/bgp_test_result.py src/thousandeyes_sdk/test_results/models/bgp_test_results.py src/thousandeyes_sdk/test_results/models/bgp_test_route_information_result.py src/thousandeyes_sdk/test_results/models/bgp_test_route_information_results.py +src/thousandeyes_sdk/test_results/models/console_logs.py +src/thousandeyes_sdk/test_results/models/console_logs_result.py +src/thousandeyes_sdk/test_results/models/console_logs_test_results.py src/thousandeyes_sdk/test_results/models/dns_measurement_protocol.py src/thousandeyes_sdk/test_results/models/dns_opcode.py src/thousandeyes_sdk/test_results/models/dns_qr.py @@ -198,16 +204,31 @@ src/thousandeyes_sdk/test_results/models/web_transaction_test_result.py src/thousandeyes_sdk/test_results/models/web_transaction_test_results.py src/thousandeyes_sdk/test_results/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_api_test_results_api.py +test/test_api_test_results_api_integration.py test/test_dns_server_test_results_api.py +test/test_dns_server_test_results_api_integration.py test/test_dns_trace_test_results_api.py +test/test_dns_trace_test_results_api_integration.py test/test_dnssec_test_results_api.py +test/test_dnssec_test_results_api_integration.py test/test_network_bgp_test_results_api.py +test/test_network_bgp_test_results_api_integration.py test/test_network_test_results_api.py +test/test_network_test_results_api_integration.py test/test_utils.py test/test_voice_rtp_server_test_results_api.py +test/test_voice_rtp_server_test_results_api_integration.py test/test_voice_sip_server_test_results_api.py +test/test_voice_sip_server_test_results_api_integration.py test/test_web_ftp_server_test_results_api.py +test/test_web_ftp_server_test_results_api_integration.py test/test_web_http_server_test_results_api.py +test/test_web_http_server_test_results_api_integration.py test/test_web_page_load_test_results_api.py +test/test_web_page_load_test_results_api_integration.py test/test_web_transactions_test_results_api.py +test/test_web_transactions_test_results_api_integration.py diff --git a/thousandeyes-sdk-test-results/README.md b/thousandeyes-sdk-test-results/README.md index 431001c18..4da412a49 100644 --- a/thousandeyes-sdk-test-results/README.md +++ b/thousandeyes-sdk-test-results/README.md @@ -3,7 +3,7 @@ Get test result metrics for Network and Application Synthetics tests. This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -114,6 +114,7 @@ Class | Method | HTTP request | Description *WebHTTPServerTestResultsApi* | [**get_test_http_server_results**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/WebHTTPServerTestResultsApi.md#get_test_http_server_results) | **GET** /test-results/{testId}/http-server | Get HTTP server test results *WebPageLoadTestResultsApi* | [**get_test_page_load_agent_round_results**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/WebPageLoadTestResultsApi.md#get_test_page_load_agent_round_results) | **GET** /test-results/{testId}/page-load/agent/{agentId}/round/{roundId} | Get page load server test results by agent and round *WebPageLoadTestResultsApi* | [**get_test_page_load_results**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/WebPageLoadTestResultsApi.md#get_test_page_load_results) | **GET** /test-results/{testId}/page-load | Get page load server test results +*WebTransactionsTestResultsApi* | [**get_test_console_logs_agent_round_results**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/WebTransactionsTestResultsApi.md#get_test_console_logs_agent_round_results) | **GET** /test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId}/console-logs | Get console logs test results by agent and round *WebTransactionsTestResultsApi* | [**get_test_web_transaction_agent_round_page_results**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/WebTransactionsTestResultsApi.md#get_test_web_transaction_agent_round_page_results) | **GET** /test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId}/page/{pageId} | Get detailed web transactions test result by agent, round, and page *WebTransactionsTestResultsApi* | [**get_test_web_transaction_agent_round_results**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/WebTransactionsTestResultsApi.md#get_test_web_transaction_agent_round_results) | **GET** /test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId} | Get web transactions test results by agent and round *WebTransactionsTestResultsApi* | [**get_test_web_transaction_results**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/WebTransactionsTestResultsApi.md#get_test_web_transaction_results) | **GET** /test-results/{testId}/web-transactions | Get web transactions test results @@ -135,6 +136,9 @@ Class | Method | HTTP request | Description - [BgpTestResults](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/BgpTestResults.md) - [BgpTestRouteInformationResult](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/BgpTestRouteInformationResult.md) - [BgpTestRouteInformationResults](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/BgpTestRouteInformationResults.md) + - [ConsoleLogs](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/ConsoleLogs.md) + - [ConsoleLogsResult](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/ConsoleLogsResult.md) + - [ConsoleLogsTestResults](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/ConsoleLogsTestResults.md) - [DnsMeasurementProtocol](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/DnsMeasurementProtocol.md) - [DnsOpcode](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/DnsOpcode.md) - [DnsQr](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-test-results/docs/DnsQr.md) diff --git a/thousandeyes-sdk-test-results/docs/ConsoleLogs.md b/thousandeyes-sdk-test-results/docs/ConsoleLogs.md new file mode 100644 index 000000000..063d25d0d --- /dev/null +++ b/thousandeyes-sdk-test-results/docs/ConsoleLogs.md @@ -0,0 +1,32 @@ +# ConsoleLogs + +Console logs captured during script execution to help troubleshoot transaction issues. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**level** | **str** | Severity level of the log, or UNKNOWN if the log is system-generated. | [optional] +**timestamp** | **str** | Unix epoch time, in milliseconds, when the log entry was captured. | [optional] +**value** | **str** | Log message. | [optional] + +## Example + +```python +from thousandeyes_sdk.test_results.models.console_logs import ConsoleLogs + +# TODO update the JSON string below +json = "{}" +# create an instance of ConsoleLogs from a JSON string +console_logs_instance = ConsoleLogs.from_json(json) +# print the JSON string representation of the object +print(ConsoleLogs.to_json()) + +# convert the object into a dict +console_logs_dict = console_logs_instance.to_dict() +# create an instance of ConsoleLogs from a dict +console_logs_from_dict = ConsoleLogs.from_dict(console_logs_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-test-results/docs/ConsoleLogsResult.md b/thousandeyes-sdk-test-results/docs/ConsoleLogsResult.md new file mode 100644 index 000000000..a46673ea2 --- /dev/null +++ b/thousandeyes-sdk-test-results/docs/ConsoleLogsResult.md @@ -0,0 +1,33 @@ +# ConsoleLogsResult + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_date** | **datetime** | Data point date UTC (ISO date-time format). | [optional] [readonly] +**round_id** | **int** | Epoch time (seconds) indicating the start time of the round | [optional] [readonly] +**links** | [**TestResultAppLinks**](TestResultAppLinks.md) | | [optional] +**agent** | [**TestResultAgent**](TestResultAgent.md) | | [optional] +**console_logs** | [**List[ConsoleLogs]**](ConsoleLogs.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.test_results.models.console_logs_result import ConsoleLogsResult + +# TODO update the JSON string below +json = "{}" +# create an instance of ConsoleLogsResult from a JSON string +console_logs_result_instance = ConsoleLogsResult.from_json(json) +# print the JSON string representation of the object +print(ConsoleLogsResult.to_json()) + +# convert the object into a dict +console_logs_result_dict = console_logs_result_instance.to_dict() +# create an instance of ConsoleLogsResult from a dict +console_logs_result_from_dict = ConsoleLogsResult.from_dict(console_logs_result_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-test-results/docs/ConsoleLogsTestResults.md b/thousandeyes-sdk-test-results/docs/ConsoleLogsTestResults.md new file mode 100644 index 000000000..0e6dc4c00 --- /dev/null +++ b/thousandeyes-sdk-test-results/docs/ConsoleLogsTestResults.md @@ -0,0 +1,31 @@ +# ConsoleLogsTestResults + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**results** | [**List[ConsoleLogsResult]**](ConsoleLogsResult.md) | | [optional] +**test** | [**SimpleTest**](SimpleTest.md) | | [optional] +**links** | [**PaginationLinks**](PaginationLinks.md) | | [optional] + +## Example + +```python +from thousandeyes_sdk.test_results.models.console_logs_test_results import ConsoleLogsTestResults + +# TODO update the JSON string below +json = "{}" +# create an instance of ConsoleLogsTestResults from a JSON string +console_logs_test_results_instance = ConsoleLogsTestResults.from_json(json) +# print the JSON string representation of the object +print(ConsoleLogsTestResults.to_json()) + +# convert the object into a dict +console_logs_test_results_dict = console_logs_test_results_instance.to_dict() +# create an instance of ConsoleLogsTestResults from a dict +console_logs_test_results_from_dict = ConsoleLogsTestResults.from_dict(console_logs_test_results_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-test-results/docs/NetworkTestResult.md b/thousandeyes-sdk-test-results/docs/NetworkTestResult.md index 471d25ef3..bc49143e9 100644 --- a/thousandeyes-sdk-test-results/docs/NetworkTestResult.md +++ b/thousandeyes-sdk-test-results/docs/NetworkTestResult.md @@ -15,7 +15,7 @@ Name | Type | Description | Notes **bandwidth** | **float** | | [optional] [readonly] **capacity** | **float** | The capacity from the client to the server measured in Mbps. This value is not available if bandwidth testing is disabled, if no value could be calculated, or if the target is a proxy. | [optional] [readonly] **jitter** | **float** | Standard deviation of latency | [optional] [readonly] -**loss** | **float** | Percentage of packets not reaching destination | [optional] [readonly] +**loss** | **float** | Percentage of packets not reaching the destination. This field is omitted when no loss measurement is available. | [optional] [readonly] **max_latency** | **float** | Maximum RTT for packets sent to destination | [optional] [readonly] **min_latency** | **float** | Minimum RTT for packets sent to destination | [optional] [readonly] **proxy_loss** | **float** | Percentage of packets not reaching proxy. | [optional] [readonly] @@ -29,6 +29,7 @@ Name | Type | Description | Notes **server** | **str** | Target server, including port (if method used is TCP) | [optional] [readonly] **health_score** | **float** | A normalized value (0.0-1.0) representing the network connection health of the test target. Returns negative values as error codes. -1.0 indicates there was insufficient data to calculate the health score. | [optional] **direction** | [**TestDirection**](TestDirection.md) | | [optional] +**error_details** | **str** | Error details. This field is omitted when no error occurs. | [optional] [readonly] ## Example diff --git a/thousandeyes-sdk-test-results/docs/NetworkTestResultsApi.md b/thousandeyes-sdk-test-results/docs/NetworkTestResultsApi.md index 03314992a..c18ec3dd4 100644 --- a/thousandeyes-sdk-test-results/docs/NetworkTestResultsApi.md +++ b/thousandeyes-sdk-test-results/docs/NetworkTestResultsApi.md @@ -53,7 +53,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - direction = thousandeyes_sdk.test_results.TestDirection() # TestDirection | Choose the direction for the metrics you want: [`from-target`, `to-target`, `bidirectional`]. This applies when you're doing bidirectional Agent-to-Agent tests. For bidirectional data, you'll get combined results; otherwise, you'll get data for one direction. If you try to get unidirectional test data with an incorrect direction parameter, it will trigger an error response. (optional) + direction = # TestDirection | Choose the direction for the metrics you want: [`from-target`, `to-target`, `bidirectional`]. This applies when you're doing bidirectional Agent-to-Agent tests. For bidirectional data, you'll get combined results; otherwise, you'll get data for one direction. If you try to get unidirectional test data with an incorrect direction parameter, it will trigger an error response. (optional) try: # Get network test results @@ -150,7 +150,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: agent_id = '11' # str | Agent ID round_id = '1384309800' # str | Round ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - direction = thousandeyes_sdk.test_results.PathVisDirection() # PathVisDirection | Choose the direction for the metrics you want: [`from-target`, `to-target`]. This applies when you're doing bidirectional Agent-to-Agent tests. Omitting the parameter will default the results to both `from-target` and `to-target` values (bidirectional); otherwise, you'll get data for one direction. If you try to get unidirectional test data with an incorrect direction parameter, it will trigger an error response. (optional) + direction = # PathVisDirection | Choose the direction for the metrics you want: [`from-target`, `to-target`]. This applies when you're doing bidirectional Agent-to-Agent tests. Omitting the parameter will default the results to both `from-target` and `to-target` values (bidirectional); otherwise, you'll get data for one direction. If you try to get unidirectional test data with an incorrect direction parameter, it will trigger an error response. (optional) try: # Get path visualization test results by agent and round @@ -247,7 +247,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - direction = thousandeyes_sdk.test_results.PathVisDirection() # PathVisDirection | Choose the direction for the metrics you want: [`from-target`, `to-target`]. This applies when you're doing bidirectional Agent-to-Agent tests. Omitting the parameter will default the results to both `from-target` and `to-target` values (bidirectional); otherwise, you'll get data for one direction. If you try to get unidirectional test data with an incorrect direction parameter, it will trigger an error response. (optional) + direction = # PathVisDirection | Choose the direction for the metrics you want: [`from-target`, `to-target`]. This applies when you're doing bidirectional Agent-to-Agent tests. Omitting the parameter will default the results to both `from-target` and `to-target` values (bidirectional); otherwise, you'll get data for one direction. If you try to get unidirectional test data with an incorrect direction parameter, it will trigger an error response. (optional) try: # Get path visualization network test results diff --git a/thousandeyes-sdk-test-results/docs/WebHTTPServerTestResultsApi.md b/thousandeyes-sdk-test-results/docs/WebHTTPServerTestResultsApi.md index 660cab172..7f5284483 100644 --- a/thousandeyes-sdk-test-results/docs/WebHTTPServerTestResultsApi.md +++ b/thousandeyes-sdk-test-results/docs/WebHTTPServerTestResultsApi.md @@ -51,7 +51,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` 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`. (optional) end_date = '2022-07-18T22:00:54Z' # datetime | 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`. (optional) cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional) - expand = [thousandeyes_sdk.test_results.Expand()] # List[Expand] | This parameter lets you decide if you want to see more details about test results. By default, no extra information is shown unless you use the query parameter. For instance, if you want more info about the \"header,\" add ?expand=header to the query. (optional) + expand = # List[Expand] | This parameter lets you decide if you want to see more details about test results. By default, no extra information is shown unless you use the query parameter. For instance, if you want more info about the \"header,\" add ?expand=header to the query. (optional) try: # Get HTTP server test results diff --git a/thousandeyes-sdk-test-results/docs/WebTransactionsTestResultsApi.md b/thousandeyes-sdk-test-results/docs/WebTransactionsTestResultsApi.md index 2e8848c2f..6f69963ae 100644 --- a/thousandeyes-sdk-test-results/docs/WebTransactionsTestResultsApi.md +++ b/thousandeyes-sdk-test-results/docs/WebTransactionsTestResultsApi.md @@ -4,11 +4,104 @@ All URIs are relative to *https://api.thousandeyes.com/v7* Method | HTTP request | Description ------------- | ------------- | ------------- +[**get_test_console_logs_agent_round_results**](WebTransactionsTestResultsApi.md#get_test_console_logs_agent_round_results) | **GET** /test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId}/console-logs | Get console logs test results by agent and round [**get_test_web_transaction_agent_round_page_results**](WebTransactionsTestResultsApi.md#get_test_web_transaction_agent_round_page_results) | **GET** /test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId}/page/{pageId} | Get detailed web transactions test result by agent, round, and page [**get_test_web_transaction_agent_round_results**](WebTransactionsTestResultsApi.md#get_test_web_transaction_agent_round_results) | **GET** /test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId} | Get web transactions test results by agent and round [**get_test_web_transaction_results**](WebTransactionsTestResultsApi.md#get_test_web_transaction_results) | **GET** /test-results/{testId}/web-transactions | Get web transactions test results +# **get_test_console_logs_agent_round_results** +> ConsoleLogsTestResults get_test_console_logs_agent_round_results(test_id, agent_id, round_id, aid=aid) + +Get console logs test results by agent and round + +Returns console logs for the specified test, agent, and round ID. + +### Example + +* Bearer Authentication (BearerAuth): + +```python +import thousandeyes_sdk.test_results +from thousandeyes_sdk.test_results.models.console_logs_test_results import ConsoleLogsTestResults +from thousandeyes_sdk.test_results.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.thousandeyes.com/v7 +# See configuration.py for a list of all supported configuration parameters. +configuration = thousandeyes_sdk.core.Configuration( + host = "https://api.thousandeyes.com/v7" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: BearerAuth +configuration = thousandeyes_sdk.core.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with thousandeyes_sdk.core.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = thousandeyes_sdk.test_results.WebTransactionsTestResultsApi(api_client) + test_id = '202701' # str | Test ID + agent_id = '11' # str | Agent ID + round_id = '1384309800' # str | Round ID + aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) + + try: + # Get console logs test results by agent and round + api_response = api_instance.get_test_console_logs_agent_round_results(test_id, agent_id, round_id, aid=aid) + print("The response of WebTransactionsTestResultsApi->get_test_console_logs_agent_round_results:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling WebTransactionsTestResultsApi->get_test_console_logs_agent_round_results: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **test_id** | **str**| Test ID | + **agent_id** | **str**| Agent ID | + **round_id** | **str**| Round ID | + **aid** | **str**| A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. | [optional] + +### Return type + +[**ConsoleLogsTestResults**](ConsoleLogsTestResults.md) + +### Authorization + +[BearerAuth](../README.md#BearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/hal+json, application/json, application/problem+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | Bad Request | - | +**401** | Unauthorized | - | +**403** | Insufficient permissions to query endpoint | - | +**404** | Not found | - | +**429** | Exhausted rate limit for the organization | - | +**500** | Internal server error | - | +**502** | Bad Gateway | - | +**0** | An error occurred | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **get_test_web_transaction_agent_round_page_results** > WebTransactionPageDetailTestResults get_test_web_transaction_agent_round_page_results(test_id, agent_id, round_id, page_id, aid=aid) diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/__init__.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/__init__.py index f5cc57a29..3450db8d2 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/__init__.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/__init__.py @@ -43,6 +43,9 @@ from thousandeyes_sdk.test_results.models.bgp_test_results import BgpTestResults from thousandeyes_sdk.test_results.models.bgp_test_route_information_result import BgpTestRouteInformationResult from thousandeyes_sdk.test_results.models.bgp_test_route_information_results import BgpTestRouteInformationResults +from thousandeyes_sdk.test_results.models.console_logs import ConsoleLogs +from thousandeyes_sdk.test_results.models.console_logs_result import ConsoleLogsResult +from thousandeyes_sdk.test_results.models.console_logs_test_results import ConsoleLogsTestResults from thousandeyes_sdk.test_results.models.dns_measurement_protocol import DnsMeasurementProtocol from thousandeyes_sdk.test_results.models.dns_opcode import DnsOpcode from thousandeyes_sdk.test_results.models.dns_qr import DnsQr diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_transactions_test_results_api.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_transactions_test_results_api.py index 7c8e06dc6..09ed29444 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_transactions_test_results_api.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/api/web_transactions_test_results_api.py @@ -22,6 +22,7 @@ from pydantic import Field, StrictStr, field_validator from typing import Optional from typing_extensions import Annotated +from thousandeyes_sdk.test_results.models.console_logs_test_results import ConsoleLogsTestResults from thousandeyes_sdk.test_results.models.web_transaction_detail_test_results import WebTransactionDetailTestResults from thousandeyes_sdk.test_results.models.web_transaction_page_detail_test_results import WebTransactionPageDetailTestResults from thousandeyes_sdk.test_results.models.web_transaction_test_results import WebTransactionTestResults @@ -46,6 +47,336 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call + def get_test_console_logs_agent_round_results( + self, + test_id: Annotated[StrictStr, Field(description="Test ID")], + agent_id: Annotated[StrictStr, Field(description="Agent ID")], + round_id: Annotated[StrictStr, Field(description="Round ID")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ConsoleLogsTestResults: + """Get console logs test results by agent and round + + Returns console logs for the specified test, agent, and round ID. + + :param test_id: Test ID (required) + :type test_id: str + :param agent_id: Agent ID (required) + :type agent_id: str + :param round_id: Round ID (required) + :type round_id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_test_console_logs_agent_round_results_serialize( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConsoleLogsTestResults", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '429': "Error", + '500': "Error", + '502': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.test_results.models, + ).data + + + @validate_call + def get_test_console_logs_agent_round_results_with_http_info( + self, + test_id: Annotated[StrictStr, Field(description="Test ID")], + agent_id: Annotated[StrictStr, Field(description="Agent ID")], + round_id: Annotated[StrictStr, Field(description="Round ID")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ConsoleLogsTestResults]: + """Get console logs test results by agent and round + + Returns console logs for the specified test, agent, and round ID. + + :param test_id: Test ID (required) + :type test_id: str + :param agent_id: Agent ID (required) + :type agent_id: str + :param round_id: Round ID (required) + :type round_id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_test_console_logs_agent_round_results_serialize( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConsoleLogsTestResults", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '429': "Error", + '500': "Error", + '502': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + models=thousandeyes_sdk.test_results.models, + ) + + + @validate_call + def get_test_console_logs_agent_round_results_without_preload_content( + self, + test_id: Annotated[StrictStr, Field(description="Test ID")], + agent_id: Annotated[StrictStr, Field(description="Agent ID")], + round_id: Annotated[StrictStr, Field(description="Round ID")], + aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get console logs test results by agent and round + + Returns console logs for the specified test, agent, and round ID. + + :param test_id: Test ID (required) + :type test_id: str + :param agent_id: Agent ID (required) + :type agent_id: str + :param round_id: Round ID (required) + :type round_id: str + :param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. + :type aid: str + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_test_console_logs_agent_round_results_serialize( + test_id=test_id, + agent_id=agent_id, + round_id=round_id, + aid=aid, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ConsoleLogsTestResults", + '400': "ValidationError", + '401': "UnauthorizedError", + '403': "Error", + '404': "Error", + '429': "Error", + '500': "Error", + '502': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_test_console_logs_agent_round_results_serialize( + self, + test_id, + agent_id, + round_id, + aid, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if test_id is not None: + _path_params['testId'] = test_id + if agent_id is not None: + _path_params['agentId'] = agent_id + if round_id is not None: + _path_params['roundId'] = round_id + # process the query parameters + if aid is not None: + + _query_params.append(('aid', aid)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/hal+json', + 'application/json', + 'application/problem+json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'BearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId}/console-logs', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def get_test_web_transaction_agent_round_page_results( self, diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/__init__.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/__init__.py index 5faa39d9c..5c9921fc0 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/__init__.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/__init__.py @@ -27,6 +27,9 @@ from thousandeyes_sdk.test_results.models.bgp_test_results import BgpTestResults from thousandeyes_sdk.test_results.models.bgp_test_route_information_result import BgpTestRouteInformationResult from thousandeyes_sdk.test_results.models.bgp_test_route_information_results import BgpTestRouteInformationResults +from thousandeyes_sdk.test_results.models.console_logs import ConsoleLogs +from thousandeyes_sdk.test_results.models.console_logs_result import ConsoleLogsResult +from thousandeyes_sdk.test_results.models.console_logs_test_results import ConsoleLogsTestResults from thousandeyes_sdk.test_results.models.dns_measurement_protocol import DnsMeasurementProtocol from thousandeyes_sdk.test_results.models.dns_opcode import DnsOpcode from thousandeyes_sdk.test_results.models.dns_qr import DnsQr diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs.py new file mode 100644 index 000000000..aa8402a92 --- /dev/null +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs.py @@ -0,0 +1,91 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ConsoleLogs(BaseModel): + """ + Console logs captured during script execution to help troubleshoot transaction issues. + """ # noqa: E501 + level: Optional[StrictStr] = Field(default=None, description="Severity level of the log, or UNKNOWN if the log is system-generated.") + timestamp: Optional[StrictStr] = Field(default=None, description="Unix epoch time, in milliseconds, when the log entry was captured.") + value: Optional[StrictStr] = Field(default=None, description="Log message.") + __properties: ClassVar[List[str]] = ["level", "timestamp", "value"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConsoleLogs from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConsoleLogs from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "level": obj.get("level"), + "timestamp": obj.get("timestamp"), + "value": obj.get("value") + }) + return _obj + + diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs_result.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs_result.py new file mode 100644 index 000000000..6678d981e --- /dev/null +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs_result.py @@ -0,0 +1,116 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from thousandeyes_sdk.test_results.models.console_logs import ConsoleLogs +from thousandeyes_sdk.test_results.models.test_result_agent import TestResultAgent +from thousandeyes_sdk.test_results.models.test_result_app_links import TestResultAppLinks +from typing import Optional, Set +from typing_extensions import Self + +class ConsoleLogsResult(BaseModel): + """ + ConsoleLogsResult + """ # noqa: E501 + var_date: Optional[datetime] = Field(default=None, description="Data point date UTC (ISO date-time format).", alias="date") + round_id: Optional[StrictInt] = Field(default=None, description="Epoch time (seconds) indicating the start time of the round", alias="roundId") + links: Optional[TestResultAppLinks] = Field(default=None, alias="_links") + agent: Optional[TestResultAgent] = None + console_logs: Optional[List[ConsoleLogs]] = Field(default=None, alias="consoleLogs") + __properties: ClassVar[List[str]] = ["date", "roundId", "_links", "agent", "consoleLogs"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConsoleLogsResult from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. + """ + excluded_fields: Set[str] = set([ + "var_date", + "round_id", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + # override the default output from pydantic by calling `to_dict()` of agent + if self.agent: + _dict['agent'] = self.agent.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in console_logs (list) + _items = [] + if self.console_logs: + for _item in self.console_logs: + if _item: + _items.append(_item.to_dict()) + _dict['consoleLogs'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConsoleLogsResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "date": obj.get("date"), + "roundId": obj.get("roundId"), + "_links": TestResultAppLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None, + "agent": TestResultAgent.from_dict(obj["agent"]) if obj.get("agent") is not None else None, + "consoleLogs": [ConsoleLogs.from_dict(_item) for _item in obj["consoleLogs"]] if obj.get("consoleLogs") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs_test_results.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs_test_results.py new file mode 100644 index 000000000..605f9cce6 --- /dev/null +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/console_logs_test_results.py @@ -0,0 +1,107 @@ +# 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 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field +from typing import Any, ClassVar, Dict, List, Optional +from thousandeyes_sdk.test_results.models.console_logs_result import ConsoleLogsResult +from thousandeyes_sdk.test_results.models.pagination_links import PaginationLinks +from thousandeyes_sdk.test_results.models.simple_test import SimpleTest +from typing import Optional, Set +from typing_extensions import Self + +class ConsoleLogsTestResults(BaseModel): + """ + ConsoleLogsTestResults + """ # noqa: E501 + results: Optional[List[ConsoleLogsResult]] = None + test: Optional[SimpleTest] = None + links: Optional[PaginationLinks] = Field(default=None, alias="_links") + __properties: ClassVar[List[str]] = ["results", "test", "_links"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + extra="allow", + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ConsoleLogsTestResults from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in results (list) + _items = [] + if self.results: + for _item in self.results: + if _item: + _items.append(_item.to_dict()) + _dict['results'] = _items + # override the default output from pydantic by calling `to_dict()` of test + if self.test: + _dict['test'] = self.test.to_dict() + # override the default output from pydantic by calling `to_dict()` of links + if self.links: + _dict['_links'] = self.links.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ConsoleLogsTestResults from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "results": [ConsoleLogsResult.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None, + "test": SimpleTest.from_dict(obj["test"]) if obj.get("test") is not None else None, + "_links": PaginationLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None + }) + return _obj + + diff --git a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/network_test_result.py b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/network_test_result.py index 6a818d491..85e583756 100644 --- a/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/network_test_result.py +++ b/thousandeyes-sdk-test-results/src/thousandeyes_sdk/test_results/models/network_test_result.py @@ -39,7 +39,7 @@ class NetworkTestResult(BaseModel): bandwidth: Optional[Union[StrictFloat, StrictInt]] = None capacity: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="The capacity from the client to the server measured in Mbps. This value is not available if bandwidth testing is disabled, if no value could be calculated, or if the target is a proxy.") jitter: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Standard deviation of latency") - loss: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Percentage of packets not reaching destination") + loss: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Percentage of packets not reaching the destination. This field is omitted when no loss measurement is available.") max_latency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Maximum RTT for packets sent to destination", alias="maxLatency") min_latency: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Minimum RTT for packets sent to destination", alias="minLatency") proxy_loss: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Percentage of packets not reaching proxy.", alias="proxyLoss") @@ -53,7 +53,8 @@ class NetworkTestResult(BaseModel): server: Optional[StrictStr] = Field(default=None, description="Target server, including port (if method used is TCP)") health_score: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="A normalized value (0.0-1.0) representing the network connection health of the test target. Returns negative values as error codes. -1.0 indicates there was insufficient data to calculate the health score.", alias="healthScore") direction: Optional[TestDirection] = None - __properties: ClassVar[List[str]] = ["date", "roundId", "_links", "startTime", "endTime", "availableBandwidth", "avgLatency", "bandwidth", "capacity", "jitter", "loss", "maxLatency", "minLatency", "proxyLoss", "proxyAverageLatency", "proxyMinLatency", "proxyMaxLatency", "proxyJitter", "packetsBySecond", "agent", "serverIp", "server", "healthScore", "direction"] + error_details: Optional[StrictStr] = Field(default=None, description="Error details. This field is omitted when no error occurs.", alias="errorDetails") + __properties: ClassVar[List[str]] = ["date", "roundId", "_links", "startTime", "endTime", "availableBandwidth", "avgLatency", "bandwidth", "capacity", "jitter", "loss", "maxLatency", "minLatency", "proxyLoss", "proxyAverageLatency", "proxyMinLatency", "proxyMaxLatency", "proxyJitter", "packetsBySecond", "agent", "serverIp", "server", "healthScore", "direction", "errorDetails"] model_config = ConfigDict( populate_by_name=True, @@ -106,6 +107,7 @@ def to_dict(self) -> Dict[str, Any]: * OpenAPI `readOnly` fields are excluded. * OpenAPI `readOnly` fields are excluded. * OpenAPI `readOnly` fields are excluded. + * OpenAPI `readOnly` fields are excluded. """ excluded_fields: Set[str] = set([ "var_date", @@ -128,6 +130,7 @@ def to_dict(self) -> Dict[str, Any]: "packets_by_second", "server_ip", "server", + "error_details", ]) _dict = self.model_dump( @@ -176,7 +179,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "serverIp": obj.get("serverIp"), "server": obj.get("server"), "healthScore": obj.get("healthScore"), - "direction": obj.get("direction") + "direction": obj.get("direction"), + "errorDetails": obj.get("errorDetails") }) return _obj diff --git a/thousandeyes-sdk-test-results/test/conftest.py b/thousandeyes-sdk-test-results/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..27d6ab3a9 --- /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 000000000..317d4e9df --- /dev/null +++ b/thousandeyes-sdk-test-results/test/mock_manifest.py @@ -0,0 +1,6521 @@ +# 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", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "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, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "startTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target", + "availableBandwidth" : 9.100464, + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "errorDetails" : "" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.thousandeyes.com:80", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "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, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "startTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target", + "availableBandwidth" : 9.100464, + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "errorDetails" : "" + } ], + "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_console_logs_agent_round_results": OperationExpectation( + operation_id="get_test_console_logs_agent_round_results", + method="GET", + path="/test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId}/console-logs", + 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" + }, + "_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" + } + }, + "consoleLogs" : [ { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + }, { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + } ], + "roundId" : 1384309800 + }, { + "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" + } + }, + "consoleLogs" : [ { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + }, { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + } ], + "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_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 000000000..d9d14a547 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py @@ -0,0 +1,965 @@ +# 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 000000000..d813920f7 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_dns_server_test_results_api_integration.py @@ -0,0 +1,945 @@ +# 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 000000000..70345c515 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_dns_trace_test_results_api_integration.py @@ -0,0 +1,482 @@ +# 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 000000000..18e9c6702 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_dnssec_test_results_api_integration.py @@ -0,0 +1,472 @@ +# 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 000000000..562ab1b23 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_network_bgp_test_results_api_integration.py @@ -0,0 +1,853 @@ +# 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.py b/thousandeyes-sdk-test-results/test/test_network_test_results_api.py index 47142f1e0..5d6f2f332 100644 --- a/thousandeyes-sdk-test-results/test/test_network_test_results_api.py +++ b/thousandeyes-sdk-test-results/test/test_network_test_results_api.py @@ -101,7 +101,6 @@ def test_get_test_network_results_models_validation(self) -> None: "results" : [ { "date" : "2022-07-17T22:00:54Z", "server" : "www.thousandeyes.com:80", - "availableBandwidth" : 9.100464, "agent" : { "agentId" : "281474976710706", "agentName" : "thousandeyes-stg-va-254", @@ -109,8 +108,6 @@ def test_get_test_network_results_models_validation(self) -> None: "countryId" : "US" }, "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], - "avgLatency" : 167.04, - "bandwidth" : 4.3313155, "minLatency" : 167, "_links" : { "appLink" : { @@ -125,24 +122,27 @@ def test_get_test_network_results_models_validation(self) -> None: } }, "maxLatency" : 168, - "proxyJitter" : 1.2, - "proxyAverageLatency" : 45, - "proxyLoss" : 2.5, "healthScore" : 0.98, "capacity" : 210.10854, "loss" : 0, "proxyMinLatency" : 40, + "startTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target", + "availableBandwidth" : 9.100464, + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, "jitter" : 0.076808, "serverIp" : "50.18.127.223", - "startTime" : 1384309800, "endTime" : 1384309800, "proxyMaxLatency" : 50, - "roundId" : 1384309800, - "direction" : "to-target" + "errorDetails" : "" }, { "date" : "2022-07-17T22:00:54Z", "server" : "www.thousandeyes.com:80", - "availableBandwidth" : 9.100464, "agent" : { "agentId" : "281474976710706", "agentName" : "thousandeyes-stg-va-254", @@ -150,8 +150,6 @@ def test_get_test_network_results_models_validation(self) -> None: "countryId" : "US" }, "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], - "avgLatency" : 167.04, - "bandwidth" : 4.3313155, "minLatency" : 167, "_links" : { "appLink" : { @@ -166,20 +164,24 @@ def test_get_test_network_results_models_validation(self) -> None: } }, "maxLatency" : 168, - "proxyJitter" : 1.2, - "proxyAverageLatency" : 45, - "proxyLoss" : 2.5, "healthScore" : 0.98, "capacity" : 210.10854, "loss" : 0, "proxyMinLatency" : 40, + "startTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target", + "availableBandwidth" : 9.100464, + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, "jitter" : 0.076808, "serverIp" : "50.18.127.223", - "startTime" : 1384309800, "endTime" : 1384309800, "proxyMaxLatency" : 50, - "roundId" : 1384309800, - "direction" : "to-target" + "errorDetails" : "" } ], "startDate" : "2022-07-17T22:00:54Z" }""" 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 000000000..3ac1a700c --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py @@ -0,0 +1,1442 @@ +# 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' + 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", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "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, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "startTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target", + "availableBandwidth" : 9.100464, + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "errorDetails" : "" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.thousandeyes.com:80", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "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, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "startTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target", + "availableBandwidth" : 9.100464, + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "errorDetails" : "" + } ], + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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_utils.py b/thousandeyes-sdk-test-results/test/test_utils.py index 930528d9b..37913f626 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-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 000000000..7614c5e1f --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py @@ -0,0 +1,490 @@ +# 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 000000000..73ccce68a --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_voice_sip_server_test_results_api_integration.py @@ -0,0 +1,500 @@ +# 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: ;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" + } + """ + 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 000000000..a4e01896f --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_web_ftp_server_test_results_api_integration.py @@ -0,0 +1,494 @@ +# 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 000000000..7a8462896 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_web_http_server_test_results_api_integration.py @@ -0,0 +1,676 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..79b7a674c --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_web_page_load_test_results_api_integration.py @@ -0,0 +1,1307 @@ +# 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.py b/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api.py index 77da637d2..50bc96cac 100644 --- a/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api.py +++ b/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api.py @@ -28,6 +28,142 @@ def setUp(self) -> None: def tearDown(self) -> None: pass + def test_get_test_console_logs_agent_round_results_models_validation(self) -> None: + """Test case for get_test_console_logs_agent_round_results request and response models""" + + 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" + } + }, + "consoleLogs" : [ { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + }, { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + } ], + "roundId" : 1384309800 + }, { + "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" + } + }, + "consoleLogs" : [ { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + }, { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + } ], + "roundId" : 1384309800 + } ] + }""" + + response_loaded_json = json.loads(response_body_json) + response_from_json = thousandeyes_sdk.test_results.models.ConsoleLogsTestResults.from_json(response_body_json) + assert_constructed_model_matches_example_json(response_from_json, response_loaded_json) + def test_get_test_web_transaction_agent_round_page_results_models_validation(self) -> None: """Test case for get_test_web_transaction_agent_round_page_results request and response models""" 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 000000000..28045b340 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py @@ -0,0 +1,2191 @@ +# 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_console_logs_agent_round_results_happy_path(self) -> None: + """Integration test for get_test_console_logs_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" + }, + "_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" + } + }, + "consoleLogs" : [ { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + }, { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + } ], + "roundId" : 1384309800 + }, { + "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" + } + }, + "consoleLogs" : [ { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + }, { + "level" : "INFO", + "value" : "Uncaught TypeError: Cannot read property attr of undefined", + "timestamp" : "1715880042123" + } ], + "roundId" : 1384309800 + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_console_logs_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_console_logs_agent_round_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_console_logs_agent_round_results_error_400(self) -> None: + """Integration test for get_test_console_logs_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_console_logs_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_console_logs_agent_round_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_console_logs_agent_round_results_error_401(self) -> None: + """Integration test for get_test_console_logs_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_console_logs_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_console_logs_agent_round_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_console_logs_agent_round_results_error_403(self) -> None: + """Integration test for get_test_console_logs_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_console_logs_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_console_logs_agent_round_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_console_logs_agent_round_results_error_404(self) -> None: + """Integration test for get_test_console_logs_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_console_logs_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_console_logs_agent_round_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_console_logs_agent_round_results_error_429(self) -> None: + """Integration test for get_test_console_logs_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_console_logs_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_console_logs_agent_round_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_console_logs_agent_round_results_error_500(self) -> None: + """Integration test for get_test_console_logs_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_console_logs_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_console_logs_agent_round_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_console_logs_agent_round_results_error_502(self) -> None: + """Integration test for get_test_console_logs_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_console_logs_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_console_logs_agent_round_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + 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/.openapi-generator/FILES b/thousandeyes-sdk-tests/.openapi-generator/FILES index 60ca0c12d..319ead941 100644 --- a/thousandeyes-sdk-tests/.openapi-generator/FILES +++ b/thousandeyes-sdk-tests/.openapi-generator/FILES @@ -131,6 +131,7 @@ docs/SipServerTests.md docs/SipTestProtocol.md docs/TestAgentRequest.md docs/TestAuthType.md +docs/TestChromiumTrack.md docs/TestCustomHeaders.md docs/TestDirection.md docs/TestDnsServer.md @@ -332,6 +333,7 @@ src/thousandeyes_sdk/tests/models/sip_server_tests.py src/thousandeyes_sdk/tests/models/sip_test_protocol.py src/thousandeyes_sdk/tests/models/test_agent_request.py src/thousandeyes_sdk/tests/models/test_auth_type.py +src/thousandeyes_sdk/tests/models/test_chromium_track.py src/thousandeyes_sdk/tests/models/test_custom_headers.py src/thousandeyes_sdk/tests/models/test_direction.py src/thousandeyes_sdk/tests/models/test_dns_server.py @@ -394,19 +396,37 @@ src/thousandeyes_sdk/tests/models/web_transaction_test_response.py src/thousandeyes_sdk/tests/models/web_transaction_tests.py src/thousandeyes_sdk/tests/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_agent_to_agent_tests_api.py +test/test_agent_to_agent_tests_api_integration.py test/test_agent_to_server_tests_api.py +test/test_agent_to_server_tests_api_integration.py test/test_api_tests_api.py +test/test_api_tests_api_integration.py test/test_bgp_tests_api.py +test/test_bgp_tests_api_integration.py test/test_dns_server_tests_api.py +test/test_dns_server_tests_api_integration.py test/test_dns_trace_tests_api.py +test/test_dns_trace_tests_api_integration.py test/test_dnssec_tests_api.py +test/test_dnssec_tests_api_integration.py test/test_ftp_server_tests_api.py +test/test_ftp_server_tests_api_integration.py test/test_http_server_tests_api.py +test/test_http_server_tests_api_integration.py test/test_page_load_tests_api.py +test/test_page_load_tests_api_integration.py test/test_path_visualization_interface_groups_api.py +test/test_path_visualization_interface_groups_api_integration.py test/test_sip_server_tests_api.py +test/test_sip_server_tests_api_integration.py test/test_tests_api.py +test/test_tests_api_integration.py test/test_utils.py test/test_voice_tests_api.py +test/test_voice_tests_api_integration.py test/test_web_transaction_tests_api.py +test/test_web_transaction_tests_api_integration.py diff --git a/thousandeyes-sdk-tests/README.md b/thousandeyes-sdk-tests/README.md index e7c10151b..064d34a3b 100644 --- a/thousandeyes-sdk-tests/README.md +++ b/thousandeyes-sdk-tests/README.md @@ -6,7 +6,7 @@ This API allows you to list, create, edit, and delete Network and Application Sy This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -79,9 +79,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.APITestsApi(api_client) - api_test_request = thousandeyes_sdk.tests.ApiTestRequest() # ApiTestRequest | + api_test_request = # ApiTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create API test @@ -292,6 +292,7 @@ Class | Method | HTTP request | Description - [SipTestProtocol](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-tests/docs/SipTestProtocol.md) - [TestAgentRequest](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-tests/docs/TestAgentRequest.md) - [TestAuthType](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-tests/docs/TestAuthType.md) + - [TestChromiumTrack](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-tests/docs/TestChromiumTrack.md) - [TestCustomHeaders](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-tests/docs/TestCustomHeaders.md) - [TestDirection](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-tests/docs/TestDirection.md) - [TestDnsServer](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-tests/docs/TestDnsServer.md) diff --git a/thousandeyes-sdk-tests/docs/APITestsApi.md b/thousandeyes-sdk-tests/docs/APITestsApi.md index e56922e12..dcb2498db 100644 --- a/thousandeyes-sdk-tests/docs/APITestsApi.md +++ b/thousandeyes-sdk-tests/docs/APITestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.APITestsApi(api_client) - api_test_request = thousandeyes_sdk.tests.ApiTestRequest() # ApiTestRequest | + api_test_request = # ApiTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create API test @@ -228,7 +228,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get API test @@ -404,9 +404,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.APITestsApi(api_client) test_id = '202701' # str | Test ID - api_test_request = thousandeyes_sdk.tests.ApiTestRequest() # ApiTestRequest | + api_test_request = # ApiTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update API test diff --git a/thousandeyes-sdk-tests/docs/AgentToAgentTestsApi.md b/thousandeyes-sdk-tests/docs/AgentToAgentTestsApi.md index 95b5143f4..3acc21c0b 100644 --- a/thousandeyes-sdk-tests/docs/AgentToAgentTestsApi.md +++ b/thousandeyes-sdk-tests/docs/AgentToAgentTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.AgentToAgentTestsApi(api_client) - agent_to_agent_test_request = thousandeyes_sdk.tests.AgentToAgentTestRequest() # AgentToAgentTestRequest | + agent_to_agent_test_request = # AgentToAgentTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create Agent to Agent test @@ -228,7 +228,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get Agent to Agent test @@ -404,9 +404,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.AgentToAgentTestsApi(api_client) test_id = '202701' # str | Test ID - agent_to_agent_test_request = thousandeyes_sdk.tests.AgentToAgentTestRequest() # AgentToAgentTestRequest | + agent_to_agent_test_request = # AgentToAgentTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update Agent to Agent test diff --git a/thousandeyes-sdk-tests/docs/AgentToServerTestsApi.md b/thousandeyes-sdk-tests/docs/AgentToServerTestsApi.md index 0bf576ce8..067a6dde0 100644 --- a/thousandeyes-sdk-tests/docs/AgentToServerTestsApi.md +++ b/thousandeyes-sdk-tests/docs/AgentToServerTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.AgentToServerTestsApi(api_client) - agent_to_server_test_request = thousandeyes_sdk.tests.AgentToServerTestRequest() # AgentToServerTestRequest | + agent_to_server_test_request = # AgentToServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create Agent to Server test @@ -228,7 +228,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get Agent to Server test @@ -404,9 +404,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.AgentToServerTestsApi(api_client) test_id = '202701' # str | Test ID - update_agent_to_server_test_request = thousandeyes_sdk.tests.UpdateAgentToServerTestRequest() # UpdateAgentToServerTestRequest | + update_agent_to_server_test_request = # UpdateAgentToServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update Agent to Server test diff --git a/thousandeyes-sdk-tests/docs/BGPTestsApi.md b/thousandeyes-sdk-tests/docs/BGPTestsApi.md index 3e35f4d78..f804d835b 100644 --- a/thousandeyes-sdk-tests/docs/BGPTestsApi.md +++ b/thousandeyes-sdk-tests/docs/BGPTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.BGPTestsApi(api_client) - bgp_test_request = thousandeyes_sdk.tests.BgpTestRequest() # BgpTestRequest | + bgp_test_request = # BgpTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] # List[ExpandBgpTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion takes place if the query parameter is not present. To expand the `monitors` sub-resource, pass the `?expand=monitor` query. (optional) + expand = # List[ExpandBgpTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion takes place if the query parameter is not present. To expand the `monitors` sub-resource, pass the `?expand=monitor` query. (optional) try: # Create BGP test @@ -227,7 +227,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: api_instance = thousandeyes_sdk.tests.BGPTestsApi(api_client) test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] # List[ExpandBgpTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion takes place if the query parameter is not present. To expand the `monitors` sub-resource, pass the `?expand=monitor` query. (optional) + expand = # List[ExpandBgpTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion takes place if the query parameter is not present. To expand the `monitors` sub-resource, pass the `?expand=monitor` query. (optional) try: # Get BGP test @@ -402,9 +402,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.BGPTestsApi(api_client) test_id = '202701' # str | Test ID - update_bgp_test_request = thousandeyes_sdk.tests.UpdateBgpTestRequest() # UpdateBgpTestRequest | + update_bgp_test_request = # UpdateBgpTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandBgpTestOptions()] # List[ExpandBgpTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion takes place if the query parameter is not present. To expand the `monitors` sub-resource, pass the `?expand=monitor` query. (optional) + expand = # List[ExpandBgpTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion takes place if the query parameter is not present. To expand the `monitors` sub-resource, pass the `?expand=monitor` query. (optional) try: # Update BGP test diff --git a/thousandeyes-sdk-tests/docs/DNSSECTestsApi.md b/thousandeyes-sdk-tests/docs/DNSSECTestsApi.md index 2832eba6a..326cc430c 100644 --- a/thousandeyes-sdk-tests/docs/DNSSECTestsApi.md +++ b/thousandeyes-sdk-tests/docs/DNSSECTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.DNSSECTestsApi(api_client) - dns_sec_test_request = thousandeyes_sdk.tests.DnsSecTestRequest() # DnsSecTestRequest | + dns_sec_test_request = # DnsSecTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create DNSSEC test @@ -228,7 +228,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get DNSSEC test @@ -404,9 +404,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.DNSSECTestsApi(api_client) test_id = '202701' # str | Test ID - dns_sec_test_request = thousandeyes_sdk.tests.DnsSecTestRequest() # DnsSecTestRequest | + dns_sec_test_request = # DnsSecTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update DNSSEC test diff --git a/thousandeyes-sdk-tests/docs/DNSServerTestsApi.md b/thousandeyes-sdk-tests/docs/DNSServerTestsApi.md index 6a0a821a1..bbff7d895 100644 --- a/thousandeyes-sdk-tests/docs/DNSServerTestsApi.md +++ b/thousandeyes-sdk-tests/docs/DNSServerTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.DNSServerTestsApi(api_client) - dns_server_test_request = thousandeyes_sdk.tests.DnsServerTestRequest() # DnsServerTestRequest | + dns_server_test_request = # DnsServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create DNS Server test @@ -228,7 +228,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get DNS Server test @@ -404,9 +404,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.DNSServerTestsApi(api_client) test_id = '202701' # str | Test ID - dns_server_test_request = thousandeyes_sdk.tests.DnsServerTestRequest() # DnsServerTestRequest | + dns_server_test_request = # DnsServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update DNS Server test diff --git a/thousandeyes-sdk-tests/docs/DNSTraceTestsApi.md b/thousandeyes-sdk-tests/docs/DNSTraceTestsApi.md index 12e6b67e9..a7d745a2a 100644 --- a/thousandeyes-sdk-tests/docs/DNSTraceTestsApi.md +++ b/thousandeyes-sdk-tests/docs/DNSTraceTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.DNSTraceTestsApi(api_client) - dns_trace_test_request = thousandeyes_sdk.tests.DnsTraceTestRequest() # DnsTraceTestRequest | + dns_trace_test_request = # DnsTraceTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create DNS Trace test @@ -228,7 +228,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get DNS Trace test @@ -404,9 +404,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.DNSTraceTestsApi(api_client) test_id = '202701' # str | Test ID - dns_trace_test_request = thousandeyes_sdk.tests.DnsTraceTestRequest() # DnsTraceTestRequest | + dns_trace_test_request = # DnsTraceTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update DNS Trace test diff --git a/thousandeyes-sdk-tests/docs/FTPServerTestsApi.md b/thousandeyes-sdk-tests/docs/FTPServerTestsApi.md index 78611f8fb..b6180196b 100644 --- a/thousandeyes-sdk-tests/docs/FTPServerTestsApi.md +++ b/thousandeyes-sdk-tests/docs/FTPServerTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.FTPServerTestsApi(api_client) - ftp_server_test_request = thousandeyes_sdk.tests.FtpServerTestRequest() # FtpServerTestRequest | + ftp_server_test_request = # FtpServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create FTP Server test @@ -226,7 +226,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get FTP Server test @@ -402,9 +402,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.FTPServerTestsApi(api_client) test_id = '202701' # str | Test ID - ftp_server_test_request = thousandeyes_sdk.tests.FtpServerTestRequest() # FtpServerTestRequest | + ftp_server_test_request = # FtpServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update FTP Server test diff --git a/thousandeyes-sdk-tests/docs/HTTPServerTestsApi.md b/thousandeyes-sdk-tests/docs/HTTPServerTestsApi.md index 2278693bd..212afd82b 100644 --- a/thousandeyes-sdk-tests/docs/HTTPServerTestsApi.md +++ b/thousandeyes-sdk-tests/docs/HTTPServerTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.HTTPServerTestsApi(api_client) - http_server_test_request = thousandeyes_sdk.tests.HttpServerTestRequest() # HttpServerTestRequest | + http_server_test_request = # HttpServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create HTTP Server test @@ -228,7 +228,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get HTTP Server test @@ -404,9 +404,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.HTTPServerTestsApi(api_client) test_id = '202701' # str | Test ID - http_server_test_request = thousandeyes_sdk.tests.HttpServerTestRequest() # HttpServerTestRequest | + http_server_test_request = # HttpServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update HTTP Server test diff --git a/thousandeyes-sdk-tests/docs/PageLoadInstantTest.md b/thousandeyes-sdk-tests/docs/PageLoadInstantTest.md index e68f77245..3a2797117 100644 --- a/thousandeyes-sdk-tests/docs/PageLoadInstantTest.md +++ b/thousandeyes-sdk-tests/docs/PageLoadInstantTest.md @@ -65,6 +65,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-tests/docs/PageLoadProperties.md b/thousandeyes-sdk-tests/docs/PageLoadProperties.md index 5e77ae884..3dc98dc07 100644 --- a/thousandeyes-sdk-tests/docs/PageLoadProperties.md +++ b/thousandeyes-sdk-tests/docs/PageLoadProperties.md @@ -51,6 +51,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **type** | **str** | | [optional] [readonly] diff --git a/thousandeyes-sdk-tests/docs/PageLoadTest.md b/thousandeyes-sdk-tests/docs/PageLoadTest.md index f6c5cf62a..e62ee6957 100644 --- a/thousandeyes-sdk-tests/docs/PageLoadTest.md +++ b/thousandeyes-sdk-tests/docs/PageLoadTest.md @@ -69,6 +69,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-tests/docs/PageLoadTestRequest.md b/thousandeyes-sdk-tests/docs/PageLoadTestRequest.md index 64ad095c4..04e5fad84 100644 --- a/thousandeyes-sdk-tests/docs/PageLoadTestRequest.md +++ b/thousandeyes-sdk-tests/docs/PageLoadTestRequest.md @@ -65,6 +65,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-tests/docs/PageLoadTestResponse.md b/thousandeyes-sdk-tests/docs/PageLoadTestResponse.md index 17d6df1ae..21983866c 100644 --- a/thousandeyes-sdk-tests/docs/PageLoadTestResponse.md +++ b/thousandeyes-sdk-tests/docs/PageLoadTestResponse.md @@ -69,6 +69,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-tests/docs/PageLoadTestsApi.md b/thousandeyes-sdk-tests/docs/PageLoadTestsApi.md index dd1490623..94835d58b 100644 --- a/thousandeyes-sdk-tests/docs/PageLoadTestsApi.md +++ b/thousandeyes-sdk-tests/docs/PageLoadTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.PageLoadTestsApi(api_client) - page_load_test_request = thousandeyes_sdk.tests.PageLoadTestRequest() # PageLoadTestRequest | + page_load_test_request = # PageLoadTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create Page Load test @@ -228,7 +228,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get Page Load test @@ -404,9 +404,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.PageLoadTestsApi(api_client) test_id = '202701' # str | Test ID - page_load_test_request = thousandeyes_sdk.tests.PageLoadTestRequest() # PageLoadTestRequest | + page_load_test_request = # PageLoadTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update Page Load test diff --git a/thousandeyes-sdk-tests/docs/PathVisualizationInterfaceGroupsApi.md b/thousandeyes-sdk-tests/docs/PathVisualizationInterfaceGroupsApi.md index 9f85baa6a..99c63acae 100644 --- a/thousandeyes-sdk-tests/docs/PathVisualizationInterfaceGroupsApi.md +++ b/thousandeyes-sdk-tests/docs/PathVisualizationInterfaceGroupsApi.md @@ -47,7 +47,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.PathVisualizationInterfaceGroupsApi(api_client) - interface_group = thousandeyes_sdk.tests.InterfaceGroup() # InterfaceGroup | + interface_group = # InterfaceGroup | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: @@ -305,7 +305,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.PathVisualizationInterfaceGroupsApi(api_client) interface_group_id = '281474976710706' # str | ID of the network path vis interface group - interface_group = thousandeyes_sdk.tests.InterfaceGroup() # InterfaceGroup | + interface_group = # InterfaceGroup | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) try: diff --git a/thousandeyes-sdk-tests/docs/SIPServerTestsApi.md b/thousandeyes-sdk-tests/docs/SIPServerTestsApi.md index ec021d478..c800421ed 100644 --- a/thousandeyes-sdk-tests/docs/SIPServerTestsApi.md +++ b/thousandeyes-sdk-tests/docs/SIPServerTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.SIPServerTestsApi(api_client) - sip_server_test_request = thousandeyes_sdk.tests.SipServerTestRequest() # SipServerTestRequest | + sip_server_test_request = # SipServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create SIP Server test @@ -226,7 +226,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get SIP Server test @@ -402,9 +402,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.SIPServerTestsApi(api_client) test_id = '202701' # str | Test ID - sip_server_test_request = thousandeyes_sdk.tests.SipServerTestRequest() # SipServerTestRequest | + sip_server_test_request = # SipServerTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update SIP Server test diff --git a/thousandeyes-sdk-tests/docs/TestChromiumTrack.md b/thousandeyes-sdk-tests/docs/TestChromiumTrack.md new file mode 100644 index 000000000..be0647131 --- /dev/null +++ b/thousandeyes-sdk-tests/docs/TestChromiumTrack.md @@ -0,0 +1,12 @@ +# TestChromiumTrack + +* `stable`: Uses the default Chromium version. * `latest`: Uses the newest Chromium version available from ThousandEyes as soon as it is available. Performance may differ from tests using the default Chromium version. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/thousandeyes-sdk-tests/docs/UnexpandedPageLoadTest.md b/thousandeyes-sdk-tests/docs/UnexpandedPageLoadTest.md index 6c1dfab84..fbe7fde17 100644 --- a/thousandeyes-sdk-tests/docs/UnexpandedPageLoadTest.md +++ b/thousandeyes-sdk-tests/docs/UnexpandedPageLoadTest.md @@ -65,6 +65,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-tests/docs/UnexpandedWebTransactionTest.md b/thousandeyes-sdk-tests/docs/UnexpandedWebTransactionTest.md index e3f0fdfaf..5b21fa489 100644 --- a/thousandeyes-sdk-tests/docs/UnexpandedWebTransactionTest.md +++ b/thousandeyes-sdk-tests/docs/UnexpandedWebTransactionTest.md @@ -59,6 +59,7 @@ Name | Type | Description | Notes **target_time** | **int** | Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value. | [optional] [default to 10] **time_limit** | **int** | Time limit for transaction in seconds. | [optional] [default to 30] **transaction_script** | **str** | JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ). | +**flag_collect_console_logs** | **bool** | Whether to collect console logs during script execution. | [optional] [default to False] **block_domains** | **str** | Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests. | [optional] **disable_screenshot** | **bool** | Enables or disables screenshots on error. Set true to not capture | [optional] [default to False] **allow_mic_and_camera** | **bool** | Set true allow the use of a fake mic and camera in the browser. | [optional] [default to False] @@ -66,6 +67,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-tests/docs/VoiceTestsApi.md b/thousandeyes-sdk-tests/docs/VoiceTestsApi.md index 065aed3f0..87f5e5d55 100644 --- a/thousandeyes-sdk-tests/docs/VoiceTestsApi.md +++ b/thousandeyes-sdk-tests/docs/VoiceTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.VoiceTestsApi(api_client) - voice_test_request = thousandeyes_sdk.tests.VoiceTestRequest() # VoiceTestRequest | + voice_test_request = # VoiceTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create Voice test @@ -228,7 +228,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get Voice test @@ -404,9 +404,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.VoiceTestsApi(api_client) test_id = '202701' # str | Test ID - voice_test_request = thousandeyes_sdk.tests.VoiceTestRequest() # VoiceTestRequest | + voice_test_request = # VoiceTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update Voice test diff --git a/thousandeyes-sdk-tests/docs/WebTransactionInstantTest.md b/thousandeyes-sdk-tests/docs/WebTransactionInstantTest.md index 0ad3c4d92..599a9f46a 100644 --- a/thousandeyes-sdk-tests/docs/WebTransactionInstantTest.md +++ b/thousandeyes-sdk-tests/docs/WebTransactionInstantTest.md @@ -59,6 +59,7 @@ Name | Type | Description | Notes **target_time** | **int** | Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value. | [optional] [default to 10] **time_limit** | **int** | Time limit for transaction in seconds. | [optional] [default to 30] **transaction_script** | **str** | JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ). | +**flag_collect_console_logs** | **bool** | Whether to collect console logs during script execution. | [optional] [default to False] **block_domains** | **str** | Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests. | [optional] **disable_screenshot** | **bool** | Enables or disables screenshots on error. Set true to not capture | [optional] [default to False] **allow_mic_and_camera** | **bool** | Set true allow the use of a fake mic and camera in the browser. | [optional] [default to False] @@ -66,6 +67,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-tests/docs/WebTransactionProperties.md b/thousandeyes-sdk-tests/docs/WebTransactionProperties.md index 9a4b7606a..0afedf623 100644 --- a/thousandeyes-sdk-tests/docs/WebTransactionProperties.md +++ b/thousandeyes-sdk-tests/docs/WebTransactionProperties.md @@ -45,6 +45,7 @@ Name | Type | Description | Notes **target_time** | **int** | Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value. | [optional] [default to 10] **time_limit** | **int** | Time limit for transaction in seconds. | [optional] [default to 30] **transaction_script** | **str** | JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ). | +**flag_collect_console_logs** | **bool** | Whether to collect console logs during script execution. | [optional] [default to False] **block_domains** | **str** | Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests. | [optional] **disable_screenshot** | **bool** | Enables or disables screenshots on error. Set true to not capture | [optional] [default to False] **allow_mic_and_camera** | **bool** | Set true allow the use of a fake mic and camera in the browser. | [optional] [default to False] @@ -52,6 +53,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **type** | **str** | | [optional] [readonly] diff --git a/thousandeyes-sdk-tests/docs/WebTransactionTest.md b/thousandeyes-sdk-tests/docs/WebTransactionTest.md index 5fc42a676..045e776ed 100644 --- a/thousandeyes-sdk-tests/docs/WebTransactionTest.md +++ b/thousandeyes-sdk-tests/docs/WebTransactionTest.md @@ -63,6 +63,7 @@ Name | Type | Description | Notes **target_time** | **int** | Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value. | [optional] [default to 10] **time_limit** | **int** | Time limit for transaction in seconds. | [optional] [default to 30] **transaction_script** | **str** | JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ). | +**flag_collect_console_logs** | **bool** | Whether to collect console logs during script execution. | [optional] [default to False] **block_domains** | **str** | Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests. | [optional] **disable_screenshot** | **bool** | Enables or disables screenshots on error. Set true to not capture | [optional] [default to False] **allow_mic_and_camera** | **bool** | Set true allow the use of a fake mic and camera in the browser. | [optional] [default to False] @@ -70,6 +71,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-tests/docs/WebTransactionTestRequest.md b/thousandeyes-sdk-tests/docs/WebTransactionTestRequest.md index 1a3aae13c..067f76024 100644 --- a/thousandeyes-sdk-tests/docs/WebTransactionTestRequest.md +++ b/thousandeyes-sdk-tests/docs/WebTransactionTestRequest.md @@ -59,6 +59,7 @@ Name | Type | Description | Notes **target_time** | **int** | Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value. | [optional] [default to 10] **time_limit** | **int** | Time limit for transaction in seconds. | [optional] [default to 30] **transaction_script** | **str** | JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ). | +**flag_collect_console_logs** | **bool** | Whether to collect console logs during script execution. | [optional] [default to False] **block_domains** | **str** | Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests. | [optional] **disable_screenshot** | **bool** | Enables or disables screenshots on error. Set true to not capture | [optional] [default to False] **allow_mic_and_camera** | **bool** | Set true allow the use of a fake mic and camera in the browser. | [optional] [default to False] @@ -66,6 +67,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-tests/docs/WebTransactionTestResponse.md b/thousandeyes-sdk-tests/docs/WebTransactionTestResponse.md index d2c4b967e..49fd191f8 100644 --- a/thousandeyes-sdk-tests/docs/WebTransactionTestResponse.md +++ b/thousandeyes-sdk-tests/docs/WebTransactionTestResponse.md @@ -63,6 +63,7 @@ Name | Type | Description | Notes **target_time** | **int** | Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value. | [optional] [default to 10] **time_limit** | **int** | Time limit for transaction in seconds. | [optional] [default to 30] **transaction_script** | **str** | JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ). | +**flag_collect_console_logs** | **bool** | Whether to collect console logs during script execution. | [optional] [default to False] **block_domains** | **str** | Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests. | [optional] **disable_screenshot** | **bool** | Enables or disables screenshots on error. Set true to not capture | [optional] [default to False] **allow_mic_and_camera** | **bool** | Set true allow the use of a fake mic and camera in the browser. | [optional] [default to False] @@ -70,6 +71,7 @@ Name | Type | Description | Notes **browser_language** | **str** | Set one of the available browser language that you want to use to configure the browser. | [optional] **chrome_options** | **str** | Command-line options passed to Chrome when running the test. | [optional] [default to ''] **chrome_policies** | **str** | JSON string of Chrome policy settings to apply. | [optional] [default to '{}'] +**chromium_track** | [**TestChromiumTrack**](TestChromiumTrack.md) | | [optional] **page_loading_strategy** | [**TestPageLoadingStrategy**](TestPageLoadingStrategy.md) | | [optional] **randomized_start_time** | **bool** | Indicates whether agents should randomize the start time in each test round. | [optional] [default to False] **identify_agent_traffic_with_user_agent** | **bool** | Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). | [optional] [default to False] diff --git a/thousandeyes-sdk-tests/docs/WebTransactionTestsApi.md b/thousandeyes-sdk-tests/docs/WebTransactionTestsApi.md index 34f8d4b82..394c1c2d7 100644 --- a/thousandeyes-sdk-tests/docs/WebTransactionTestsApi.md +++ b/thousandeyes-sdk-tests/docs/WebTransactionTestsApi.md @@ -50,9 +50,9 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.WebTransactionTestsApi(api_client) - web_transaction_test_request = thousandeyes_sdk.tests.WebTransactionTestRequest() # WebTransactionTestRequest | + web_transaction_test_request = # WebTransactionTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Create Web Transactions test @@ -228,7 +228,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: test_id = '202701' # str | Test ID aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) version_id = '1234' # str | The unique identifier for a specific version of the test settings. If provided, returns the test configuration as it existed at that version. To retrieve available version IDs, use the `/tests/{testId}/history` endpoint. If not specified, the current version of the test settings is returned. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Get Web Transactions test @@ -404,9 +404,9 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.tests.WebTransactionTestsApi(api_client) test_id = '202701' # str | Test ID - web_transaction_test_request = thousandeyes_sdk.tests.WebTransactionTestRequest() # WebTransactionTestRequest | + web_transaction_test_request = # WebTransactionTestRequest | aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.tests.ExpandTestOptions()] # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) + expand = # List[ExpandTestOptions] | Optional parameter on whether or not to expand the test sub-resources. By default no expansion is going to take place if the query parameter is not present. If the user wishes to expand the `agents` sub-resource, they need to pass the `?expand=agent` query. (optional) try: # Update Web Transactions test diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/__init__.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/__init__.py index cd19aaece..3f295c904 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/__init__.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/__init__.py @@ -150,6 +150,7 @@ from thousandeyes_sdk.tests.models.sip_test_protocol import SipTestProtocol from thousandeyes_sdk.tests.models.test_agent_request import TestAgentRequest from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_direction import TestDirection from thousandeyes_sdk.tests.models.test_dns_server import TestDnsServer diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/__init__.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/__init__.py index c0a693ed1..c42f213a6 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/__init__.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/__init__.py @@ -131,6 +131,7 @@ from thousandeyes_sdk.tests.models.sip_test_protocol import SipTestProtocol from thousandeyes_sdk.tests.models.test_agent_request import TestAgentRequest from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_direction import TestDirection from thousandeyes_sdk.tests.models.test_dns_server import TestDnsServer diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_instant_test.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_instant_test.py index 14cdcb863..9d6e5fbf2 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_instant_test.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_instant_test.py @@ -24,6 +24,7 @@ from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.shared_with_account import SharedWithAccount from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_label import TestLabel from thousandeyes_sdk.tests.models.test_links import TestLinks @@ -101,10 +102,11 @@ class PageLoadInstantTest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") - __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent"] + __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent"] model_config = ConfigDict( populate_by_name=True, @@ -282,6 +284,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_properties.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_properties.py index a16d81894..a8456426b 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_properties.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_properties.py @@ -22,6 +22,7 @@ from thousandeyes_sdk.tests.models.agent_interfaces import AgentInterfaces from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_page_loading_strategy import TestPageLoadingStrategy from thousandeyes_sdk.tests.models.test_path_trace_mode import TestPathTraceMode @@ -82,11 +83,12 @@ class PageLoadProperties(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") type: Optional[StrictStr] = None identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") - __properties: ClassVar[List[str]] = ["authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "type", "identifyAgentTrafficWithUserAgent"] + __properties: ClassVar[List[str]] = ["authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "type", "identifyAgentTrafficWithUserAgent"] model_config = ConfigDict( populate_by_name=True, @@ -206,6 +208,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "type": obj.get("type"), diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test.py index dfc11b638..2ce31fcf2 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test.py @@ -26,6 +26,7 @@ from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.shared_with_account import SharedWithAccount from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_http_interval import TestHttpInterval from thousandeyes_sdk.tests.models.test_interval import TestInterval @@ -110,6 +111,7 @@ class PageLoadTest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") @@ -118,7 +120,7 @@ class PageLoadTest(BaseModel): monitors: Optional[List[Monitor]] = Field(default=None, description="Contains list of enabled BGP monitors.") http_interval: Optional[TestHttpInterval] = Field(default=None, alias="httpInterval") subinterval: Optional[TestSubInterval] = None - __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "alertRules", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "bgpMeasurements", "usePublicBgp", "monitors", "httpInterval", "subinterval"] + __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "alertRules", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "bgpMeasurements", "usePublicBgp", "monitors", "httpInterval", "subinterval"] model_config = ConfigDict( populate_by_name=True, @@ -316,6 +318,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test_request.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test_request.py index 08134992a..5aaf2b54a 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test_request.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test_request.py @@ -24,6 +24,7 @@ from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.test_agent_request import TestAgentRequest from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_http_interval import TestHttpInterval from thousandeyes_sdk.tests.models.test_interval import TestInterval @@ -102,6 +103,7 @@ class PageLoadTestRequest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") @@ -115,7 +117,7 @@ class PageLoadTestRequest(BaseModel): alert_rules: Optional[List[StrictStr]] = Field(default=None, description="List of alert rules IDs to apply to the test (get `ruleId` from `/alerts/rules` endpoint. If `alertsEnabled` is set to `true` and `alertRules` is not included on test creation or update, applicable user default alert rules will be used)", alias="alertRules") agents: List[TestAgentRequest] = Field(description="Contains list of Agent IDs (get `agentId` from `/agents` endpoint).") monitors: Optional[List[StrictStr]] = Field(default=None, description="Contains list of BGP monitor IDs (get `monitorId` from `/monitors` endpoint)") - __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "httpInterval", "subinterval", "bgpMeasurements", "usePublicBgp", "labels", "tags", "sharedWithAccounts", "alertRules", "agents", "monitors"] + __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "httpInterval", "subinterval", "bgpMeasurements", "usePublicBgp", "labels", "tags", "sharedWithAccounts", "alertRules", "agents", "monitors"] model_config = ConfigDict( populate_by_name=True, @@ -273,6 +275,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test_response.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test_response.py index 1e39ed269..99db258c5 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test_response.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/page_load_test_response.py @@ -27,6 +27,7 @@ from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.shared_with_account import SharedWithAccount from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_http_interval import TestHttpInterval from thousandeyes_sdk.tests.models.test_interval import TestInterval @@ -111,6 +112,7 @@ class PageLoadTestResponse(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") @@ -120,7 +122,7 @@ class PageLoadTestResponse(BaseModel): http_interval: Optional[TestHttpInterval] = Field(default=None, alias="httpInterval") subinterval: Optional[TestSubInterval] = None agents: Optional[List[AgentResponse]] = Field(default=None, description="Contains list of agents.") - __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "alertRules", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "bgpMeasurements", "usePublicBgp", "monitors", "httpInterval", "subinterval", "agents"] + __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "alertRules", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "bgpMeasurements", "usePublicBgp", "monitors", "httpInterval", "subinterval", "agents"] model_config = ConfigDict( populate_by_name=True, @@ -325,6 +327,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/test_chromium_track.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/test_chromium_track.py new file mode 100644 index 000000000..c9dbccebe --- /dev/null +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/test_chromium_track.py @@ -0,0 +1,41 @@ +# 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 + + +from __future__ import annotations +import json +from enum import Enum +from typing_extensions import Self + + +class TestChromiumTrack(str, Enum): + """ + * `stable`: Uses the default Chromium version. * `latest`: Uses the newest Chromium version available from ThousandEyes as soon as it is available. Performance may differ from tests using the default Chromium version. + """ + + """ + allowed enum values + """ + STABLE = 'stable' + LATEST = 'latest' + UNKNOWN = 'unknown' + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of TestChromiumTrack from a JSON string""" + return cls(json.loads(json_str)) + + @classmethod + def _missing_(cls, value): + """Handle unknown values""" + return cls.UNKNOWN + diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/unexpanded_page_load_test.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/unexpanded_page_load_test.py index a1cbd813f..0be8cb8c9 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/unexpanded_page_load_test.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/unexpanded_page_load_test.py @@ -23,6 +23,7 @@ from thousandeyes_sdk.tests.models.agent_interfaces import AgentInterfaces from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_http_interval import TestHttpInterval from thousandeyes_sdk.tests.models.test_interval import TestInterval @@ -101,6 +102,7 @@ class UnexpandedPageLoadTest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") @@ -108,7 +110,7 @@ class UnexpandedPageLoadTest(BaseModel): subinterval: Optional[TestSubInterval] = None bgp_measurements: Optional[StrictBool] = Field(default=True, description="Set to `true` to enable bgp measurements.", alias="bgpMeasurements") use_public_bgp: Optional[StrictBool] = Field(default=True, description="Indicate if all available public BGP monitors should be used, when ommited defaults to `bgpMeasurements` value.", alias="usePublicBgp") - __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "httpInterval", "subinterval", "bgpMeasurements", "usePublicBgp"] + __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "pageLoadTargetTime", "pageLoadTimeLimit", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "httpInterval", "subinterval", "bgpMeasurements", "usePublicBgp"] model_config = ConfigDict( populate_by_name=True, @@ -259,6 +261,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/unexpanded_web_transaction_test.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/unexpanded_web_transaction_test.py index 7a2b3c5ef..5ab97ee86 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/unexpanded_web_transaction_test.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/unexpanded_web_transaction_test.py @@ -23,6 +23,7 @@ from thousandeyes_sdk.tests.models.agent_interfaces import AgentInterfaces from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_interval import TestInterval from thousandeyes_sdk.tests.models.test_links import TestLinks @@ -94,6 +95,7 @@ class UnexpandedWebTransactionTest(BaseModel): target_time: Optional[Annotated[int, Field(le=180, strict=True, ge=1)]] = Field(default=10, description="Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value.", alias="targetTime") time_limit: Optional[Annotated[int, Field(le=180, strict=True, ge=5)]] = Field(default=30, description="Time limit for transaction in seconds.", alias="timeLimit") transaction_script: StrictStr = Field(description="JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ).", alias="transactionScript") + flag_collect_console_logs: Optional[StrictBool] = Field(default=False, description="Whether to collect console logs during script execution.", alias="flagCollectConsoleLogs") block_domains: Optional[StrictStr] = Field(default=None, description="Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests.", alias="blockDomains") disable_screenshot: Optional[StrictBool] = Field(default=False, description="Enables or disables screenshots on error. Set true to not capture", alias="disableScreenshot") allow_mic_and_camera: Optional[StrictBool] = Field(default=False, description="Set true allow the use of a fake mic and camera in the browser.", alias="allowMicAndCamera") @@ -101,13 +103,14 @@ class UnexpandedWebTransactionTest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") subinterval: Optional[TestSubInterval] = None bgp_measurements: Optional[StrictBool] = Field(default=True, description="Set to `true` to enable bgp measurements.", alias="bgpMeasurements") use_public_bgp: Optional[StrictBool] = Field(default=True, description="Indicate if all available public BGP monitors should be used, when ommited defaults to `bgpMeasurements` value.", alias="usePublicBgp") - __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "subinterval", "bgpMeasurements", "usePublicBgp"] + __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "flagCollectConsoleLogs", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "subinterval", "bgpMeasurements", "usePublicBgp"] model_config = ConfigDict( populate_by_name=True, @@ -252,6 +255,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "targetTime": obj.get("targetTime") if obj.get("targetTime") is not None else 10, "timeLimit": obj.get("timeLimit") if obj.get("timeLimit") is not None else 30, "transactionScript": obj.get("transactionScript"), + "flagCollectConsoleLogs": obj.get("flagCollectConsoleLogs") if obj.get("flagCollectConsoleLogs") is not None else False, "blockDomains": obj.get("blockDomains"), "disableScreenshot": obj.get("disableScreenshot") if obj.get("disableScreenshot") is not None else False, "allowMicAndCamera": obj.get("allowMicAndCamera") if obj.get("allowMicAndCamera") is not None else False, @@ -259,6 +263,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_instant_test.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_instant_test.py index cd69e26b4..3f101ba13 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_instant_test.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_instant_test.py @@ -24,6 +24,7 @@ from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.shared_with_account import SharedWithAccount from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_label import TestLabel from thousandeyes_sdk.tests.models.test_links import TestLinks @@ -95,6 +96,7 @@ class WebTransactionInstantTest(BaseModel): target_time: Optional[Annotated[int, Field(le=180, strict=True, ge=1)]] = Field(default=10, description="Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value.", alias="targetTime") time_limit: Optional[Annotated[int, Field(le=180, strict=True, ge=5)]] = Field(default=30, description="Time limit for transaction in seconds.", alias="timeLimit") transaction_script: StrictStr = Field(description="JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ).", alias="transactionScript") + flag_collect_console_logs: Optional[StrictBool] = Field(default=False, description="Whether to collect console logs during script execution.", alias="flagCollectConsoleLogs") block_domains: Optional[StrictStr] = Field(default=None, description="Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests.", alias="blockDomains") disable_screenshot: Optional[StrictBool] = Field(default=False, description="Enables or disables screenshots on error. Set true to not capture", alias="disableScreenshot") allow_mic_and_camera: Optional[StrictBool] = Field(default=False, description="Set true allow the use of a fake mic and camera in the browser.", alias="allowMicAndCamera") @@ -102,11 +104,12 @@ class WebTransactionInstantTest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") credentials: Optional[List[StrictStr]] = Field(default=None, description="Contains a list of credential IDs (get `credentialId` from `/credentials` endpoint).") - __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "credentials"] + __properties: ClassVar[List[str]] = ["createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "flagCollectConsoleLogs", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "credentials"] model_config = ConfigDict( populate_by_name=True, @@ -278,6 +281,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "targetTime": obj.get("targetTime") if obj.get("targetTime") is not None else 10, "timeLimit": obj.get("timeLimit") if obj.get("timeLimit") is not None else 30, "transactionScript": obj.get("transactionScript"), + "flagCollectConsoleLogs": obj.get("flagCollectConsoleLogs") if obj.get("flagCollectConsoleLogs") is not None else False, "blockDomains": obj.get("blockDomains"), "disableScreenshot": obj.get("disableScreenshot") if obj.get("disableScreenshot") is not None else False, "allowMicAndCamera": obj.get("allowMicAndCamera") if obj.get("allowMicAndCamera") is not None else False, @@ -285,6 +289,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_properties.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_properties.py index 64b891f2e..eace4618c 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_properties.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_properties.py @@ -22,6 +22,7 @@ from thousandeyes_sdk.tests.models.agent_interfaces import AgentInterfaces from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_page_loading_strategy import TestPageLoadingStrategy from thousandeyes_sdk.tests.models.test_path_trace_mode import TestPathTraceMode @@ -76,6 +77,7 @@ class WebTransactionProperties(BaseModel): target_time: Optional[Annotated[int, Field(le=180, strict=True, ge=1)]] = Field(default=10, description="Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value.", alias="targetTime") time_limit: Optional[Annotated[int, Field(le=180, strict=True, ge=5)]] = Field(default=30, description="Time limit for transaction in seconds.", alias="timeLimit") transaction_script: StrictStr = Field(description="JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ).", alias="transactionScript") + flag_collect_console_logs: Optional[StrictBool] = Field(default=False, description="Whether to collect console logs during script execution.", alias="flagCollectConsoleLogs") block_domains: Optional[StrictStr] = Field(default=None, description="Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests.", alias="blockDomains") disable_screenshot: Optional[StrictBool] = Field(default=False, description="Enables or disables screenshots on error. Set true to not capture", alias="disableScreenshot") allow_mic_and_camera: Optional[StrictBool] = Field(default=False, description="Set true allow the use of a fake mic and camera in the browser.", alias="allowMicAndCamera") @@ -83,11 +85,12 @@ class WebTransactionProperties(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") type: Optional[StrictStr] = None identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") - __properties: ClassVar[List[str]] = ["authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "type", "identifyAgentTrafficWithUserAgent"] + __properties: ClassVar[List[str]] = ["authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "flagCollectConsoleLogs", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "type", "identifyAgentTrafficWithUserAgent"] model_config = ConfigDict( populate_by_name=True, @@ -201,6 +204,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "targetTime": obj.get("targetTime") if obj.get("targetTime") is not None else 10, "timeLimit": obj.get("timeLimit") if obj.get("timeLimit") is not None else 30, "transactionScript": obj.get("transactionScript"), + "flagCollectConsoleLogs": obj.get("flagCollectConsoleLogs") if obj.get("flagCollectConsoleLogs") is not None else False, "blockDomains": obj.get("blockDomains"), "disableScreenshot": obj.get("disableScreenshot") if obj.get("disableScreenshot") is not None else False, "allowMicAndCamera": obj.get("allowMicAndCamera") if obj.get("allowMicAndCamera") is not None else False, @@ -208,6 +212,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "type": obj.get("type"), diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test.py index 967c8ccac..a81c8b4e6 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test.py @@ -26,6 +26,7 @@ from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.shared_with_account import SharedWithAccount from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_interval import TestInterval from thousandeyes_sdk.tests.models.test_label import TestLabel @@ -103,6 +104,7 @@ class WebTransactionTest(BaseModel): target_time: Optional[Annotated[int, Field(le=180, strict=True, ge=1)]] = Field(default=10, description="Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value.", alias="targetTime") time_limit: Optional[Annotated[int, Field(le=180, strict=True, ge=5)]] = Field(default=30, description="Time limit for transaction in seconds.", alias="timeLimit") transaction_script: StrictStr = Field(description="JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ).", alias="transactionScript") + flag_collect_console_logs: Optional[StrictBool] = Field(default=False, description="Whether to collect console logs during script execution.", alias="flagCollectConsoleLogs") block_domains: Optional[StrictStr] = Field(default=None, description="Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests.", alias="blockDomains") disable_screenshot: Optional[StrictBool] = Field(default=False, description="Enables or disables screenshots on error. Set true to not capture", alias="disableScreenshot") allow_mic_and_camera: Optional[StrictBool] = Field(default=False, description="Set true allow the use of a fake mic and camera in the browser.", alias="allowMicAndCamera") @@ -110,6 +112,7 @@ class WebTransactionTest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") @@ -118,7 +121,7 @@ class WebTransactionTest(BaseModel): use_public_bgp: Optional[StrictBool] = Field(default=True, description="Indicate if all available public BGP monitors should be used, when ommited defaults to `bgpMeasurements` value.", alias="usePublicBgp") monitors: Optional[List[Monitor]] = Field(default=None, description="Contains list of enabled BGP monitors.") subinterval: Optional[TestSubInterval] = None - __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "alertRules", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "credentials", "bgpMeasurements", "usePublicBgp", "monitors", "subinterval"] + __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "alertRules", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "flagCollectConsoleLogs", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "credentials", "bgpMeasurements", "usePublicBgp", "monitors", "subinterval"] model_config = ConfigDict( populate_by_name=True, @@ -310,6 +313,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "targetTime": obj.get("targetTime") if obj.get("targetTime") is not None else 10, "timeLimit": obj.get("timeLimit") if obj.get("timeLimit") is not None else 30, "transactionScript": obj.get("transactionScript"), + "flagCollectConsoleLogs": obj.get("flagCollectConsoleLogs") if obj.get("flagCollectConsoleLogs") is not None else False, "blockDomains": obj.get("blockDomains"), "disableScreenshot": obj.get("disableScreenshot") if obj.get("disableScreenshot") is not None else False, "allowMicAndCamera": obj.get("allowMicAndCamera") if obj.get("allowMicAndCamera") is not None else False, @@ -317,6 +321,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test_request.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test_request.py index acac5fd4f..0b23175e1 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test_request.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test_request.py @@ -24,6 +24,7 @@ from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.test_agent_request import TestAgentRequest from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_interval import TestInterval from thousandeyes_sdk.tests.models.test_links import TestLinks @@ -95,6 +96,7 @@ class WebTransactionTestRequest(BaseModel): target_time: Optional[Annotated[int, Field(le=180, strict=True, ge=1)]] = Field(default=10, description="Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value.", alias="targetTime") time_limit: Optional[Annotated[int, Field(le=180, strict=True, ge=5)]] = Field(default=30, description="Time limit for transaction in seconds.", alias="timeLimit") transaction_script: StrictStr = Field(description="JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ).", alias="transactionScript") + flag_collect_console_logs: Optional[StrictBool] = Field(default=False, description="Whether to collect console logs during script execution.", alias="flagCollectConsoleLogs") block_domains: Optional[StrictStr] = Field(default=None, description="Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests.", alias="blockDomains") disable_screenshot: Optional[StrictBool] = Field(default=False, description="Enables or disables screenshots on error. Set true to not capture", alias="disableScreenshot") allow_mic_and_camera: Optional[StrictBool] = Field(default=False, description="Set true allow the use of a fake mic and camera in the browser.", alias="allowMicAndCamera") @@ -102,6 +104,7 @@ class WebTransactionTestRequest(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") @@ -115,7 +118,7 @@ class WebTransactionTestRequest(BaseModel): agents: List[TestAgentRequest] = Field(description="Contains list of Agent IDs (get `agentId` from `/agents` endpoint).") monitors: Optional[List[StrictStr]] = Field(default=None, description="Contains list of BGP monitor IDs (get `monitorId` from `/monitors` endpoint)") credentials: Optional[List[StrictStr]] = Field(default=None, description="Contains a list of credential IDs (get `credentialId` from `/credentials` endpoint).") - __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "subinterval", "bgpMeasurements", "usePublicBgp", "labels", "tags", "sharedWithAccounts", "alertRules", "agents", "monitors", "credentials"] + __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "flagCollectConsoleLogs", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "subinterval", "bgpMeasurements", "usePublicBgp", "labels", "tags", "sharedWithAccounts", "alertRules", "agents", "monitors", "credentials"] model_config = ConfigDict( populate_by_name=True, @@ -267,6 +270,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "targetTime": obj.get("targetTime") if obj.get("targetTime") is not None else 10, "timeLimit": obj.get("timeLimit") if obj.get("timeLimit") is not None else 30, "transactionScript": obj.get("transactionScript"), + "flagCollectConsoleLogs": obj.get("flagCollectConsoleLogs") if obj.get("flagCollectConsoleLogs") is not None else False, "blockDomains": obj.get("blockDomains"), "disableScreenshot": obj.get("disableScreenshot") if obj.get("disableScreenshot") is not None else False, "allowMicAndCamera": obj.get("allowMicAndCamera") if obj.get("allowMicAndCamera") is not None else False, @@ -274,6 +278,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test_response.py b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test_response.py index 27528d0c5..7308a38ab 100644 --- a/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test_response.py +++ b/thousandeyes-sdk-tests/src/thousandeyes_sdk/tests/models/web_transaction_test_response.py @@ -27,6 +27,7 @@ from thousandeyes_sdk.tests.models.o_auth import OAuth from thousandeyes_sdk.tests.models.shared_with_account import SharedWithAccount from thousandeyes_sdk.tests.models.test_auth_type import TestAuthType +from thousandeyes_sdk.tests.models.test_chromium_track import TestChromiumTrack from thousandeyes_sdk.tests.models.test_custom_headers import TestCustomHeaders from thousandeyes_sdk.tests.models.test_interval import TestInterval from thousandeyes_sdk.tests.models.test_label import TestLabel @@ -104,6 +105,7 @@ class WebTransactionTestResponse(BaseModel): target_time: Optional[Annotated[int, Field(le=180, strict=True, ge=1)]] = Field(default=10, description="Target completion time, in seconds. Defaults to 10. Cannot exceed the `timeLimit` value.", alias="targetTime") time_limit: Optional[Annotated[int, Field(le=180, strict=True, ge=5)]] = Field(default=30, description="Time limit for transaction in seconds.", alias="timeLimit") transaction_script: StrictStr = Field(description="JavaScript of a web transaction test. Quotes must be escaped (precede \" characters with \\ ).", alias="transactionScript") + flag_collect_console_logs: Optional[StrictBool] = Field(default=False, description="Whether to collect console logs during script execution.", alias="flagCollectConsoleLogs") block_domains: Optional[StrictStr] = Field(default=None, description="Domains or full object URLs to be excluded from metrics and waterfall data for transaction tests.", alias="blockDomains") disable_screenshot: Optional[StrictBool] = Field(default=False, description="Enables or disables screenshots on error. Set true to not capture", alias="disableScreenshot") allow_mic_and_camera: Optional[StrictBool] = Field(default=False, description="Set true allow the use of a fake mic and camera in the browser.", alias="allowMicAndCamera") @@ -111,6 +113,7 @@ class WebTransactionTestResponse(BaseModel): browser_language: Optional[StrictStr] = Field(default=None, description="Set one of the available browser language that you want to use to configure the browser.", alias="browserLanguage") chrome_options: Optional[StrictStr] = Field(default='', description="Command-line options passed to Chrome when running the test.", alias="chromeOptions") chrome_policies: Optional[StrictStr] = Field(default='{}', description="JSON string of Chrome policy settings to apply.", alias="chromePolicies") + chromium_track: Optional[TestChromiumTrack] = Field(default=None, alias="chromiumTrack") page_loading_strategy: Optional[TestPageLoadingStrategy] = Field(default=None, alias="pageLoadingStrategy") randomized_start_time: Optional[StrictBool] = Field(default=False, description="Indicates whether agents should randomize the start time in each test round.", alias="randomizedStartTime") identify_agent_traffic_with_user_agent: Optional[StrictBool] = Field(default=False, description="Determines how agent traffic is identified: * `false`: Adds the `x-thousandeyes-agent: yes` header. * `true`: Appends `(ThousandEyes Agent)` to the `user-agent` header. For more information, see [Notes on Agent ID Strategy](https://docs.thousandeyes.com/product-documentation/browser-synthetics/test-settings-page-load-transaction#notes-on-agent-id-strategy). ", alias="identifyAgentTrafficWithUserAgent") @@ -120,7 +123,7 @@ class WebTransactionTestResponse(BaseModel): monitors: Optional[List[Monitor]] = Field(default=None, description="Contains list of enabled BGP monitors.") subinterval: Optional[TestSubInterval] = None agents: Optional[List[AgentResponse]] = Field(default=None, description="Contains list of agents.") - __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "alertRules", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "credentials", "bgpMeasurements", "usePublicBgp", "monitors", "subinterval", "agents"] + __properties: ClassVar[List[str]] = ["interval", "alertsEnabled", "enabled", "alertRules", "createdBy", "createdDate", "description", "liveShare", "modifiedBy", "modifiedDate", "savedEvent", "testId", "testName", "type", "_links", "labels", "tags", "sharedWithAccounts", "authType", "agentInterfaces", "bandwidthMeasurements", "clientCertificate", "contentRegex", "customHeaders", "desiredStatusCode", "distributedTracing", "downloadLimit", "dnsOverride", "httpTargetTime", "httpTimeLimit", "httpVersion", "includeHeaders", "mtuMeasurements", "networkMeasurements", "numPathTraces", "oAuth", "password", "pathTraceMode", "probeMode", "protocol", "sslVersion", "sslVersionId", "url", "useNtlm", "userAgent", "username", "verifyCertificate", "allowUnsafeLegacyRenegotiation", "followRedirects", "fixedPacketRate", "overrideAgentProxy", "overrideProxyId", "collectProxyNetworkData", "vaultCredentials", "emulatedDeviceId", "targetTime", "timeLimit", "transactionScript", "flagCollectConsoleLogs", "blockDomains", "disableScreenshot", "allowMicAndCamera", "allowGeolocation", "browserLanguage", "chromeOptions", "chromePolicies", "chromiumTrack", "pageLoadingStrategy", "randomizedStartTime", "identifyAgentTrafficWithUserAgent", "credentials", "bgpMeasurements", "usePublicBgp", "monitors", "subinterval", "agents"] model_config = ConfigDict( populate_by_name=True, @@ -319,6 +322,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "targetTime": obj.get("targetTime") if obj.get("targetTime") is not None else 10, "timeLimit": obj.get("timeLimit") if obj.get("timeLimit") is not None else 30, "transactionScript": obj.get("transactionScript"), + "flagCollectConsoleLogs": obj.get("flagCollectConsoleLogs") if obj.get("flagCollectConsoleLogs") is not None else False, "blockDomains": obj.get("blockDomains"), "disableScreenshot": obj.get("disableScreenshot") if obj.get("disableScreenshot") is not None else False, "allowMicAndCamera": obj.get("allowMicAndCamera") if obj.get("allowMicAndCamera") is not None else False, @@ -326,6 +330,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "browserLanguage": obj.get("browserLanguage"), "chromeOptions": obj.get("chromeOptions") if obj.get("chromeOptions") is not None else '', "chromePolicies": obj.get("chromePolicies") if obj.get("chromePolicies") is not None else '{}', + "chromiumTrack": obj.get("chromiumTrack"), "pageLoadingStrategy": obj.get("pageLoadingStrategy"), "randomizedStartTime": obj.get("randomizedStartTime") if obj.get("randomizedStartTime") is not None else False, "identifyAgentTrafficWithUserAgent": obj.get("identifyAgentTrafficWithUserAgent") if obj.get("identifyAgentTrafficWithUserAgent") is not None else False, diff --git a/thousandeyes-sdk-tests/test/conftest.py b/thousandeyes-sdk-tests/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..3375a6fd5 --- /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 000000000..1921b44dc --- /dev/null +++ b/thousandeyes-sdk-tests/test/mock_manifest.py @@ -0,0 +1,18334 @@ +# 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, + "chromiumTrack" : "stable", + "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, + "chromiumTrack" : "stable", + "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, + "chromiumTrack" : "stable", + "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, + "chromiumTrack" : "stable", + "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, + "chromiumTrack" : "stable", + "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, + "chromiumTrack" : "stable", + "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, + "chromiumTrack" : "stable", + "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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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 000000000..84a945e82 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py @@ -0,0 +1,2669 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..47c8025aa --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_agent_to_server_tests_api_integration.py @@ -0,0 +1,2506 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..2ff5379d1 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_api_tests_api_integration.py @@ -0,0 +1,4753 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..a77fddd45 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_bgp_tests_api_integration.py @@ -0,0 +1,2105 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..78862b4e7 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_dns_server_tests_api_integration.py @@ -0,0 +1,2720 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..6640de031 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_dns_trace_tests_api_integration.py @@ -0,0 +1,2356 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..814db7270 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_dnssec_tests_api_integration.py @@ -0,0 +1,2335 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..d9f18b08a --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_ftp_server_tests_api_integration.py @@ -0,0 +1,2746 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..ea6d9e2a0 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_http_server_tests_api_integration.py @@ -0,0 +1,3845 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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.py b/thousandeyes-sdk-tests/test/test_page_load_tests_api.py index a31afdd43..48ef7f444 100644 --- a/thousandeyes-sdk-tests/test/test_page_load_tests_api.py +++ b/thousandeyes-sdk-tests/test/test_page_load_tests_api.py @@ -94,6 +94,7 @@ def test_create_page_load_test_models_validation(self) -> None: "sslVersion" : "Auto", "useNtlm" : false, "downloadLimit" : 2048, + "chromiumTrack" : "stable", "alertRules" : [ "344753", "212697" ], "description" : "ThousandEyes Test", "httpTimeLimit" : 5, @@ -263,6 +264,7 @@ def test_create_page_load_test_models_validation(self) -> None: "sslVersion" : "Auto", "useNtlm" : false, "downloadLimit" : 2048, + "chromiumTrack" : "stable", "alertRules" : [ { "severity" : "major", "expression" : "((hops((hopDelay >= 100 ms))))", @@ -502,6 +504,7 @@ def test_get_page_load_test_models_validation(self) -> None: "sslVersion" : "Auto", "useNtlm" : false, "downloadLimit" : 2048, + "chromiumTrack" : "stable", "alertRules" : [ { "severity" : "major", "expression" : "((hops((hopDelay >= 100 ms))))", @@ -698,6 +701,7 @@ def test_get_page_load_tests_models_validation(self) -> None: "sslVersion" : "Auto", "useNtlm" : false, "downloadLimit" : 2048, + "chromiumTrack" : "stable", "description" : "ThousandEyes Test", "httpTimeLimit" : 5, "blockDomains" : "domain.com/", @@ -811,6 +815,7 @@ def test_get_page_load_tests_models_validation(self) -> None: "sslVersion" : "Auto", "useNtlm" : false, "downloadLimit" : 2048, + "chromiumTrack" : "stable", "description" : "ThousandEyes Test", "httpTimeLimit" : 5, "blockDomains" : "domain.com/", @@ -950,6 +955,7 @@ def test_update_page_load_test_models_validation(self) -> None: "sslVersion" : "Auto", "useNtlm" : false, "downloadLimit" : 2048, + "chromiumTrack" : "stable", "alertRules" : [ "344753", "212697" ], "description" : "ThousandEyes Test", "httpTimeLimit" : 5, @@ -1119,6 +1125,7 @@ def test_update_page_load_test_models_validation(self) -> None: "sslVersion" : "Auto", "useNtlm" : false, "downloadLimit" : 2048, + "chromiumTrack" : "stable", "alertRules" : [ { "severity" : "major", "expression" : "((hops((hopDelay >= 100 ms))))", 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 000000000..a50c7ff7e --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py @@ -0,0 +1,4076 @@ +# 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, + "chromiumTrack" : "stable", + "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' + 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, + "chromiumTrack" : "stable", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + 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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + "chromiumTrack" : "stable", + "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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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, + "chromiumTrack" : "stable", + "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, + "chromiumTrack" : "stable", + "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' + 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, + "chromiumTrack" : "stable", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + 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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..71f3d7869 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_path_visualization_interface_groups_api_integration.py @@ -0,0 +1,1067 @@ +# 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 000000000..37366e486 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_sip_server_tests_api_integration.py @@ -0,0 +1,2757 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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 000000000..c06af4e5c --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_tests_api_integration.py @@ -0,0 +1,445 @@ +# 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_utils.py b/thousandeyes-sdk-tests/test/test_utils.py index 930528d9b..37913f626 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-tests/test/test_voice_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py new file mode 100644 index 000000000..1642afbc3 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py @@ -0,0 +1,2585 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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.py b/thousandeyes-sdk-tests/test/test_web_transaction_tests_api.py index 9cd1d7ef9..25f0c20b6 100644 --- a/thousandeyes-sdk-tests/test/test_web_transaction_tests_api.py +++ b/thousandeyes-sdk-tests/test/test_web_transaction_tests_api.py @@ -94,6 +94,7 @@ def test_create_web_transactions_test_models_validation(self) -> None: "useNtlm" : false, "credentials" : [ "3247", "1051" ], "downloadLimit" : 2048, + "chromiumTrack" : "stable", "alertRules" : [ "344753", "212697" ], "description" : "ThousandEyes Test", "httpTimeLimit" : 5, @@ -149,6 +150,7 @@ def test_create_web_transactions_test_models_validation(self) -> None: "createdDate" : "2022-07-17T22:00:54Z", "disableScreenshot" : false, "createdBy" : "user@user.com", + "flagCollectConsoleLogs" : false, "testId" : "281474976710706", "subinterval" : 60, "chromeOptions" : "--disable-gpu", @@ -264,6 +266,7 @@ def test_create_web_transactions_test_models_validation(self) -> None: "useNtlm" : false, "credentials" : [ "3247", "1051" ], "downloadLimit" : 2048, + "chromiumTrack" : "stable", "alertRules" : [ { "severity" : "major", "expression" : "((hops((hopDelay >= 100 ms))))", @@ -383,6 +386,7 @@ def test_create_web_transactions_test_models_validation(self) -> None: "createdDate" : "2022-07-17T22:00:54Z", "disableScreenshot" : false, "createdBy" : "user@user.com", + "flagCollectConsoleLogs" : false, "testId" : "281474976710706", "subinterval" : 60, "chromeOptions" : "--disable-gpu", @@ -504,6 +508,7 @@ def test_get_web_transactions_test_models_validation(self) -> None: "useNtlm" : false, "credentials" : [ "3247", "1051" ], "downloadLimit" : 2048, + "chromiumTrack" : "stable", "alertRules" : [ { "severity" : "major", "expression" : "((hops((hopDelay >= 100 ms))))", @@ -623,6 +628,7 @@ def test_get_web_transactions_test_models_validation(self) -> None: "createdDate" : "2022-07-17T22:00:54Z", "disableScreenshot" : false, "createdBy" : "user@user.com", + "flagCollectConsoleLogs" : false, "testId" : "281474976710706", "subinterval" : 60, "chromeOptions" : "--disable-gpu", @@ -700,6 +706,7 @@ def test_get_web_transactions_tests_models_validation(self) -> None: "sslVersion" : "Auto", "useNtlm" : false, "downloadLimit" : 2048, + "chromiumTrack" : "stable", "description" : "ThousandEyes Test", "httpTimeLimit" : 5, "blockDomains" : "domain.com/", @@ -747,6 +754,7 @@ def test_get_web_transactions_tests_models_validation(self) -> None: "createdDate" : "2022-07-17T22:00:54Z", "disableScreenshot" : false, "createdBy" : "user@user.com", + "flagCollectConsoleLogs" : false, "testId" : "281474976710706", "subinterval" : 60, "chromeOptions" : "--disable-gpu", @@ -813,6 +821,7 @@ def test_get_web_transactions_tests_models_validation(self) -> None: "sslVersion" : "Auto", "useNtlm" : false, "downloadLimit" : 2048, + "chromiumTrack" : "stable", "description" : "ThousandEyes Test", "httpTimeLimit" : 5, "blockDomains" : "domain.com/", @@ -860,6 +869,7 @@ def test_get_web_transactions_tests_models_validation(self) -> None: "createdDate" : "2022-07-17T22:00:54Z", "disableScreenshot" : false, "createdBy" : "user@user.com", + "flagCollectConsoleLogs" : false, "testId" : "281474976710706", "subinterval" : 60, "chromeOptions" : "--disable-gpu", @@ -953,6 +963,7 @@ def test_update_web_transactions_test_models_validation(self) -> None: "useNtlm" : false, "credentials" : [ "3247", "1051" ], "downloadLimit" : 2048, + "chromiumTrack" : "stable", "alertRules" : [ "344753", "212697" ], "description" : "ThousandEyes Test", "httpTimeLimit" : 5, @@ -1008,6 +1019,7 @@ def test_update_web_transactions_test_models_validation(self) -> None: "createdDate" : "2022-07-17T22:00:54Z", "disableScreenshot" : false, "createdBy" : "user@user.com", + "flagCollectConsoleLogs" : false, "testId" : "281474976710706", "subinterval" : 60, "chromeOptions" : "--disable-gpu", @@ -1123,6 +1135,7 @@ def test_update_web_transactions_test_models_validation(self) -> None: "useNtlm" : false, "credentials" : [ "3247", "1051" ], "downloadLimit" : 2048, + "chromiumTrack" : "stable", "alertRules" : [ { "severity" : "major", "expression" : "((hops((hopDelay >= 100 ms))))", @@ -1242,6 +1255,7 @@ def test_update_web_transactions_test_models_validation(self) -> None: "createdDate" : "2022-07-17T22:00:54Z", "disableScreenshot" : false, "createdBy" : "user@user.com", + "flagCollectConsoleLogs" : false, "testId" : "281474976710706", "subinterval" : 60, "chromeOptions" : "--disable-gpu", 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 000000000..fef652be6 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py @@ -0,0 +1,4116 @@ +# 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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + 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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + 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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + 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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + 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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + 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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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, + "chromiumTrack" : "stable", + "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", + "flagCollectConsoleLogs" : false, + "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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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/.openapi-generator/FILES b/thousandeyes-sdk-usage/.openapi-generator/FILES index 9a1faf478..16f65af95 100644 --- a/thousandeyes-sdk-usage/.openapi-generator/FILES +++ b/thousandeyes-sdk-usage/.openapi-generator/FILES @@ -80,6 +80,11 @@ src/thousandeyes_sdk/usage/models/validation_error.py src/thousandeyes_sdk/usage/models/validation_error_item.py src/thousandeyes_sdk/usage/py.typed test/__init__.py +test/conftest.py +test/integration_test_utils.py +test/mock_manifest.py test/test_quotas_api.py +test/test_quotas_api_integration.py test/test_usage_api.py +test/test_usage_api_integration.py test/test_utils.py diff --git a/thousandeyes-sdk-usage/README.md b/thousandeyes-sdk-usage/README.md index 4509c5fd1..13223ac1a 100644 --- a/thousandeyes-sdk-usage/README.md +++ b/thousandeyes-sdk-usage/README.md @@ -17,7 +17,7 @@ Refer to the Usage API operations for detailed usage instructions and optional p This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 7.0.96 +- API version: 7.0.99 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -90,7 +90,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.usage.QuotasApi(api_client) - organizations_quotas_assign = thousandeyes_sdk.usage.OrganizationsQuotasAssign() # OrganizationsQuotasAssign | (optional) + organizations_quotas_assign = # OrganizationsQuotasAssign | (optional) try: # Create or update accout group quotas diff --git a/thousandeyes-sdk-usage/docs/QuotasApi.md b/thousandeyes-sdk-usage/docs/QuotasApi.md index a5959f9ba..c927549d9 100644 --- a/thousandeyes-sdk-usage/docs/QuotasApi.md +++ b/thousandeyes-sdk-usage/docs/QuotasApi.md @@ -48,7 +48,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.usage.QuotasApi(api_client) - organizations_quotas_assign = thousandeyes_sdk.usage.OrganizationsQuotasAssign() # OrganizationsQuotasAssign | (optional) + organizations_quotas_assign = # OrganizationsQuotasAssign | (optional) try: # Create or update accout group quotas @@ -133,7 +133,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.usage.QuotasApi(api_client) - quotas_assign_request = thousandeyes_sdk.usage.QuotasAssignRequest() # QuotasAssignRequest | (optional) + quotas_assign_request = # QuotasAssignRequest | (optional) try: # Create or update organizations quotas @@ -297,7 +297,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.usage.QuotasApi(api_client) - organizations_quotas_unassign = thousandeyes_sdk.usage.OrganizationsQuotasUnassign() # OrganizationsQuotasUnassign | (optional) + organizations_quotas_unassign = # OrganizationsQuotasUnassign | (optional) try: # Remove account group quotas from organizations @@ -379,7 +379,7 @@ configuration = thousandeyes_sdk.core.Configuration( with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.usage.QuotasApi(api_client) - quotas_unassign = thousandeyes_sdk.usage.QuotasUnassign() # QuotasUnassign | (optional) + quotas_unassign = # QuotasUnassign | (optional) try: # Remove organization quotas diff --git a/thousandeyes-sdk-usage/docs/UsageApi.md b/thousandeyes-sdk-usage/docs/UsageApi.md index 654c231ab..c2d36dbc9 100644 --- a/thousandeyes-sdk-usage/docs/UsageApi.md +++ b/thousandeyes-sdk-usage/docs/UsageApi.md @@ -226,7 +226,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = thousandeyes_sdk.usage.UsageApi(api_client) aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional) - expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] # List[ExpandUsageOptions] | Expands the available resources. By default, no expansion takes place if the `expand` query parameter is not passed. For example, to expand the \"tests\" resource, pass the query '?expand=test'. (optional) + expand = # List[ExpandUsageOptions] | Expands the available resources. By default, no expansion takes place if the `expand` query parameter is not passed. For example, to expand the \"tests\" resource, pass the query '?expand=test'. (optional) try: # Get usage information for the last month diff --git a/thousandeyes-sdk-usage/test/conftest.py b/thousandeyes-sdk-usage/test/conftest.py new file mode 100644 index 000000000..2edba7b32 --- /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 000000000..21833c988 --- /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 000000000..4ce9a01cb --- /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 000000000..49a00ba43 --- /dev/null +++ b/thousandeyes-sdk-usage/test/test_quotas_api_integration.py @@ -0,0 +1,1343 @@ +# 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 000000000..dc8357479 --- /dev/null +++ b/thousandeyes-sdk-usage/test/test_usage_api_integration.py @@ -0,0 +1,878 @@ +# 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' + 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, + + _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' + 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, + + _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' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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' + error_body_json = """ + { + "instance" : "instance", + "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, + + _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() diff --git a/thousandeyes-sdk-usage/test/test_utils.py b/thousandeyes-sdk-usage/test/test_utils.py index 930528d9b..37913f626 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)