From d7d35cd734a8ff4891af596b03be6c13866230cc Mon Sep 17 00:00:00 2001 From: API Team Date: Thu, 30 Jul 2026 15:38:56 +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 | 8 + thousandeyes-sdk-connectors/README.md | 4 +- .../docs/CredentialVaultOperationsApi.md | 4 +- .../docs/CyberArkConjurConnectorsApi.md | 4 +- .../docs/GenericConnectorsApi.md | 4 +- .../docs/WebhookOperationsApi.md | 4 +- thousandeyes-sdk-connectors/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 3021 +++ ...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_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 | 6 + thousandeyes-sdk-dashboards/README.md | 4 +- .../docs/DashboardSnapshotsApi.md | 4 +- .../docs/DashboardsApi.md | 6 +- .../docs/DashboardsFiltersApi.md | 4 +- thousandeyes-sdk-dashboards/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 5061 +++++ ...est_dashboard_snapshots_api_integration.py | 2610 +++ .../test/test_dashboards_api_integration.py | 5101 +++++ ...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/EndpointAgentsApi.md | 20 +- .../docs/EndpointAgentsTransferApi.md | 4 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 2514 +++ ...ndpoint_agent_log_items_api_integration.py | 421 + .../test_endpoint_agents_api_integration.py | 2874 +++ ...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 +- ...TPServerEndpointScheduledTestResultsApi.md | 10 +- .../LocalNetworkEndpointTestResultsApi.md | 6 +- .../NetworkDynamicEndpointTestResultsApi.md | 4 +- .../NetworkEndpointScheduledTestResultsApi.md | 8 +- .../docs/RealUserEndpointTestResultsApi.md | 6 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 7512 +++++++ ..._scheduled_test_results_api_integration.py | 2386 ++ ...k_endpoint_test_results_api_integration.py | 1903 ++ ...c_endpoint_test_results_api_integration.py | 2293 ++ ..._scheduled_test_results_api_integration.py | 2959 +++ ...r_endpoint_test_results_api_integration.py | 2771 +++ .../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 | 16 + thousandeyes-sdk-instant-tests/README.md | 6 +- .../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/SIPServerInstantTestsApi.md | 4 +- .../docs/VoiceInstantTestsApi.md | 4 +- .../docs/WebTransactionInstantTestsApi.md | 4 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 3980 ++++ ..._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 + ...page_load_instant_tests_api_integration.py | 1400 ++ ...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 + ...ansaction_instant_tests_api_integration.py | 1418 ++ .../.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 | 4 + thousandeyes-sdk-streaming/README.md | 4 +- .../docs/StreamingApi.md | 8 +- thousandeyes-sdk-streaming/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 759 + .../test/test_streaming_api_integration.py | 1404 ++ thousandeyes-sdk-streaming/test/test_utils.py | 23 +- .../.openapi-generator/FILES | 5 + thousandeyes-sdk-tags/README.md | 4 +- .../docs/TagAssignmentApi.md | 8 +- thousandeyes-sdk-tags/docs/TagsApi.md | 10 +- 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 | 15 + thousandeyes-sdk-test-results/README.md | 2 +- .../docs/NetworkTestResultsApi.md | 6 +- .../docs/WebHTTPServerTestResultsApi.md | 2 +- .../test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + .../test/mock_manifest.py | 6272 ++++++ .../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 + ...st_network_test_results_api_integration.py | 1440 ++ .../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 ++ ...ansactions_test_results_api_integration.py | 1794 ++ .../.openapi-generator/FILES | 18 + thousandeyes-sdk-tests/README.md | 6 +- 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/PageLoadTestsApi.md | 10 +- .../PathVisualizationInterfaceGroupsApi.md | 4 +- .../docs/SIPServerTestsApi.md | 10 +- thousandeyes-sdk-tests/docs/VoiceTestsApi.md | 10 +- .../docs/WebTransactionTestsApi.md | 10 +- thousandeyes-sdk-tests/test/conftest.py | 7 + .../test/integration_test_utils.py | 37 + thousandeyes-sdk-tests/test/mock_manifest.py | 18313 ++++++++++++++++ ...st_agent_to_agent_tests_api_integration.py | 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_page_load_tests_api_integration.py | 4055 ++++ ...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 +++ ...t_web_transaction_tests_api_integration.py | 4074 ++++ .../.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 +- 369 files changed, 200347 insertions(+), 345 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/test/conftest.py create mode 100644 thousandeyes-sdk-connectors/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-connectors/test/mock_manifest.py create mode 100644 thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py create mode 100644 thousandeyes-sdk-connectors/test/test_cyber_ark_conjur_connectors_api_integration.py create mode 100644 thousandeyes-sdk-connectors/test/test_generic_connectors_api_integration.py create mode 100644 thousandeyes-sdk-connectors/test/test_operation_connectors_api_integration.py create mode 100644 thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py create mode 100644 thousandeyes-sdk-credentials/test/conftest.py create mode 100644 thousandeyes-sdk-credentials/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-credentials/test/mock_manifest.py create mode 100644 thousandeyes-sdk-credentials/test/test_credentials_api_integration.py create mode 100644 thousandeyes-sdk-dashboards/test/conftest.py create mode 100644 thousandeyes-sdk-dashboards/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-dashboards/test/mock_manifest.py create mode 100644 thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py create mode 100644 thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py create mode 100644 thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py create mode 100644 thousandeyes-sdk-emulation/test/conftest.py create mode 100644 thousandeyes-sdk-emulation/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-emulation/test/mock_manifest.py create mode 100644 thousandeyes-sdk-emulation/test/test_emulation_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/conftest.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/mock_manifest.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_transfer_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-agents/test/test_endpoint_proxies_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/conftest.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/mock_manifest.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/test_http_server_endpoint_instant_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-instant-tests/test/test_run_endpoint_instant_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-labels/test/conftest.py create mode 100644 thousandeyes-sdk-endpoint-labels/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-endpoint-labels/test/mock_manifest.py create mode 100644 thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/conftest.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/mock_manifest.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/conftest.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/mock_manifest.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/test_endpoint_real_user_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/test_endpoint_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-endpoint-tests/test/test_http_server_endpoint_scheduled_tests_api_integration.py create mode 100644 thousandeyes-sdk-event-detection/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/test/conftest.py create mode 100644 thousandeyes-sdk-instant-tests/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-instant-tests/test/mock_manifest.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_agent_to_server_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_api_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_dns_server_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_dns_trace_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_dnssec_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_ftp_server_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_http_server_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py create mode 100644 thousandeyes-sdk-internet-insights/test/conftest.py create mode 100644 thousandeyes-sdk-internet-insights/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-internet-insights/test/mock_manifest.py create mode 100644 thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py create mode 100644 thousandeyes-sdk-internet-insights/test/test_internet_insights_outages_api_integration.py create mode 100644 thousandeyes-sdk-snapshots/test/conftest.py create mode 100644 thousandeyes-sdk-snapshots/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-snapshots/test/mock_manifest.py create mode 100644 thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py create mode 100644 thousandeyes-sdk-streaming/test/conftest.py create mode 100644 thousandeyes-sdk-streaming/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-streaming/test/mock_manifest.py create mode 100644 thousandeyes-sdk-streaming/test/test_streaming_api_integration.py create mode 100644 thousandeyes-sdk-tags/test/conftest.py create mode 100644 thousandeyes-sdk-tags/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-tags/test/mock_manifest.py create mode 100644 thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py create mode 100644 thousandeyes-sdk-tags/test/test_tags_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/conftest.py create mode 100644 thousandeyes-sdk-test-results/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-test-results/test/mock_manifest.py create mode 100644 thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_dns_server_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_dns_trace_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_dnssec_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_network_bgp_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_voice_sip_server_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_web_ftp_server_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_web_http_server_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_web_page_load_test_results_api_integration.py create mode 100644 thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/conftest.py create mode 100644 thousandeyes-sdk-tests/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-tests/test/mock_manifest.py create mode 100644 thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_agent_to_server_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_api_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_bgp_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_dns_server_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_dns_trace_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_dnssec_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_ftp_server_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_http_server_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_path_visualization_interface_groups_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_sip_server_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py create mode 100644 thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py create mode 100644 thousandeyes-sdk-usage/test/conftest.py create mode 100644 thousandeyes-sdk-usage/test/integration_test_utils.py create mode 100644 thousandeyes-sdk-usage/test/mock_manifest.py create mode 100644 thousandeyes-sdk-usage/test/test_quotas_api_integration.py create mode 100644 thousandeyes-sdk-usage/test/test_usage_api_integration.py diff --git a/thousandeyes-sdk-administrative/.openapi-generator/FILES b/thousandeyes-sdk-administrative/.openapi-generator/FILES index d763288d..b42cabca 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 5507d080..8db34e40 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.97 - 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 96232776..196aa8a2 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 9a09bae9..90ce1fc3 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 7b8ea38a..7060b3a5 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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-administrative/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-administrative/test/integration_test_utils.py b/thousandeyes-sdk-administrative/test/integration_test_utils.py new file mode 100644 index 00000000..34cbcff5 --- /dev/null +++ b/thousandeyes-sdk-administrative/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Administrative API + + Manage users, accounts, and account groups in the ThousandEyes platform using the Administrative API. This API provides the following operations to manage your organization: * `/account-groups`: Account groups are used to divide an organization into different sections. These operations can be used to create, retrieve, update and delete account groups. * `/users`: Create, retrieve, update and delete users within an organization. * `/roles`: Create, retrieve and update roles for the current user. * `/permissions`: Retrieve all assignable permissions. Used in the context of modifying roles. * `/audit-user-events`: Retrieve all activity log events. For more information about the administrative models, see [Account Management](https://docs.thousandeyes.com/product-documentation/user-management). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-administrative/test/mock_manifest.py b/thousandeyes-sdk-administrative/test/mock_manifest.py new file mode 100644 index 00000000..bfb0cf8e --- /dev/null +++ b/thousandeyes-sdk-administrative/test/mock_manifest.py @@ -0,0 +1,3252 @@ +# coding: utf-8 + +""" + Administrative API + + Manage users, accounts, and account groups in the ThousandEyes platform using the Administrative API. This API provides the following operations to manage your organization: * `/account-groups`: Account groups are used to divide an organization into different sections. These operations can be used to create, retrieve, update and delete account groups. * `/users`: Create, retrieve, update and delete users within an organization. * `/roles`: Create, retrieve and update roles for the current user. * `/permissions`: Retrieve all assignable permissions. Used in the context of modifying roles. * `/audit-user-events`: Retrieve all activity log events. For more information about the administrative models, see [Account Management](https://docs.thousandeyes.com/product-documentation/user-management). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_account_group": OperationExpectation( + operation_id="create_account_group", + method="POST", + path="/account-groups", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + }, { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_account_group": OperationExpectation( + operation_id="delete_account_group", + method="DELETE", + path="/account-groups/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_account_group": OperationExpectation( + operation_id="get_account_group", + method="GET", + path="/account-groups/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=200, + success_body=json.loads(""" + + { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "accountToken" : "accountToken", + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + }, { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_account_groups": OperationExpectation( + operation_id="get_account_groups", + method="GET", + path="/account-groups", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "accountGroups" : [ { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345" + }, { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "aid" : "1234", + "orgId" : "12345" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_account_group": OperationExpectation( + operation_id="update_account_group", + method="PUT", + path="/account-groups/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=200, + success_body=json.loads(""" + + { + "isCurrentAccountGroup" : true, + "organizationName" : "organizationName", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "accountGroupName" : "Account A", + "isDefaultAccountGroup" : true, + "accountToken" : "accountToken", + "aid" : "1234", + "orgId" : "12345", + "users" : [ { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + }, { + "uid" : "235", + "lastLogin" : "2022-07-17T22:00:54Z", + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2022-07-17T22:00:54Z" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "ipv6Policy" : "force-ipv4", + "prefix" : "99.128.0.0/11", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "hostname" : "thousandeyes.com", + "keepBrowserCache" : true, + "agentState" : "online", + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/24" ], + "serialNumber" : "FOC2218ABCD", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "utilization" : 25, + "testIds" : [ 281474976710706 ], + "clusterMembers" : [ { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + }, { + "lastSeen" : "2022-07-17T22:00:54Z", + "serialNumber" : "FOC2218ABCD", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "agentState" : "online", + "targetForTests" : "1.1.1.1", + "name" : "Cluster member name", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "utilization" : 25, + "network" : "AT&T Services, Inc. (AS 7018)", + "memberId" : "10", + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "lastSeen" : "2022-07-17T22:00:54Z", + "createdDate" : "2022-07-17T22:00:54Z", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "interfaceIpMapping" : [ { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + }, { + "ipAddresses" : [ "73.252.207.219", "2601:646:300:3ae0::b977" ], + "interfaceName" : "wlp4s0" + } ], + "targetForTests" : "1.1.1.1", + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "accountGroups" : [ { + "accountGroupName" : "Account A", + "aid" : "1234" + }, { + "accountGroupName" : "Account A", + "aid" : "1234" + } ], + "verifySslCertificates" : true, + "errorDetails" : [ { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + }, { + "code" : "agent-version-outdated", + "description" : "Agent Version 0.1.1 (latest: 1.0.0)" + } ] + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "accountGroupName" : "My testing account group", + "agents" : [ "105", "719" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_permissions": OperationExpectation( + operation_id="get_permissions", + method="GET", + path="/permissions", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" + }, { + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_role": OperationExpectation( + operation_id="create_role", + method="POST", + path="/roles", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" + }, { + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" + } ], + "name" : "Organization Admin", + "isBuiltin" : true + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_role": OperationExpectation( + operation_id="delete_role", + method="DELETE", + path="/roles/{id}", + path_param_examples={ + "id": '23', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_role": OperationExpectation( + operation_id="get_role", + method="GET", + path="/roles/{id}", + path_param_examples={ + "id": '23', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" + }, { + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" + } ], + "name" : "Organization Admin", + "isBuiltin" : true + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_roles": OperationExpectation( + operation_id="get_roles", + method="GET", + path="/roles", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_role": OperationExpectation( + operation_id="update_role", + method="PUT", + path="/roles/{id}", + path_param_examples={ + "id": '23', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "roleId" : "35", + "permissions" : [ { + "label" : "View reports", + "permissionId" : "1", + "isManagementPermission" : true, + "permission" : "REPORT_READ" + }, { + "label" : "View snapshots", + "permissionId" : "51", + "isManagementPermission" : false, + "permission" : "REPORT_SNAPSHOTS_READ" + } ], + "name" : "Organization Admin", + "isBuiltin" : true + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "permissions" : [ "56", "315" ], + "name" : "Organization Admin" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_user_events": OperationExpectation( + operation_id="get_user_events", + method="GET", + path="/audit-user-events", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "auditEvents" : [ { + "accountGroupName" : "API Sandbox", + "aid" : "1234", + "date" : "2020-07-17T21:54:54Z", + "event" : "Report created.", + "ipAddress" : "99.128.0.0/11", + "uid" : "1234", + "user" : "API Sandbox User (noreply@thousandeyes.com)", + "resources" : [ { + "name" : "My New report", + "type" : "reportTitle" + }, { + "name" : "Other Report", + "type" : "testName" + } ] + }, { + "accountGroupName" : "API Sandbox", + "aid" : "1234", + "date" : "2020-07-17T22:00:54Z", + "event" : "Login failed.", + "ipAddress" : "99.128.0.0/11", + "uid" : "1234", + "user" : "API Sandbox User (noreply@thousandeyes.com)" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_user": OperationExpectation( + operation_id="create_user", + method="POST", + path="/users", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_user": OperationExpectation( + operation_id="delete_user", + method="DELETE", + path="/users/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_current_user": OperationExpectation( + operation_id="get_current_user", + method="GET", + path="/users/current", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_user": OperationExpectation( + operation_id="get_user", + method="GET", + path="/users/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=200, + success_body=json.loads(""" + + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_users": OperationExpectation( + operation_id="get_users", + method="GET", + path="/users", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "users" : [ { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + }, { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_user": OperationExpectation( + operation_id="update_user", + method="PUT", + path="/users/{id}", + path_param_examples={ + "id": '1234', + }, + success_status=200, + success_body=json.loads(""" + + { + "loginAccountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + }, + "uid" : "245", + "lastLogin" : "2022-07-17T22:00:54Z", + "allAccountGroupRoles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "accountGroupRoles" : [ { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + }, { + "roles" : [ { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + }, { + "roleId" : "35", + "name" : "Organization Admin", + "isBuiltin" : true, + "hasManagementPermissions" : true + } ], + "accountGroup" : { + "accountGroupName" : "Account A", + "aid" : "1234" + } + } ], + "name" : "User X", + "email" : "userx@thousandeyes.com", + "dateRegistered" : "2020-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "loginAccountGroupId" : "691", + "accountGroupRoles" : [ { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + }, { + "roleIds" : [ "57", "1140" ], + "accountGroupId" : "315" + } ], + "name" : "User X", + "allAccountGroupRoleIds" : [ "57", "1140" ], + "email" : "userx@thousandeyes.com" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-administrative/test/test_account_groups_api_integration.py b/thousandeyes-sdk-administrative/test/test_account_groups_api_integration.py new file mode 100644 index 00000000..f30b9f77 --- /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 00000000..cb461ad6 --- /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 00000000..f79e5a8d --- /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 00000000..908d363f --- /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 00000000..c1a0b9d2 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-administrative/test/test_utils.py +++ b/thousandeyes-sdk-administrative/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-agents/.openapi-generator/FILES b/thousandeyes-sdk-agents/.openapi-generator/FILES index 9bf3aa4f..fd34b61d 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 6b20ca10..47dbb0a2 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.97 - 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 49cdb23a..3a16da86 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 c7e5c60b..1d1c04db 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 9822e88f..5a54094f 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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-agents/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-agents/test/integration_test_utils.py b/thousandeyes-sdk-agents/test/integration_test_utils.py new file mode 100644 index 00000000..7813e966 --- /dev/null +++ b/thousandeyes-sdk-agents/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Agents API + + ## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-agents/test/mock_manifest.py b/thousandeyes-sdk-agents/test/mock_manifest.py new file mode 100644 index 00000000..2007d92e --- /dev/null +++ b/thousandeyes-sdk-agents/test/mock_manifest.py @@ -0,0 +1,2459 @@ +# coding: utf-8 + +""" + Agents API + + ## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "get_agents_proxies": OperationExpectation( + operation_id="get_agents_proxies", + method="GET", + path="/agents/proxies", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "agentProxies" : [ { + "password" : "**********", + "isLocalConfigured" : true, + "name" : "Test Proxy - Auth Type - BASIC", + "location" : "proxy.thousandeyes.com:3128", + "lastModified" : "2022-07-17T22:00:54Z", + "authType" : "basic", + "type" : "static", + "aid" : "1234", + "bypassList" : [ "10.0.0.0/16", "*.thousandeyes.com" ], + "user" : "user1", + "proxyId" : "281474976710706" + }, { + "password" : "**********", + "isLocalConfigured" : true, + "name" : "Test Proxy - Auth Type - BASIC", + "location" : "proxy.thousandeyes.com:3128", + "lastModified" : "2022-07-17T22:00:54Z", + "authType" : "basic", + "type" : "static", + "aid" : "1234", + "bypassList" : [ "10.0.0.0/16", "*.thousandeyes.com" ], + "user" : "user1", + "proxyId" : "281474976710706" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agents_notification_rule": OperationExpectation( + operation_id="get_agents_notification_rule", + method="GET", + path="/agents/notification-rules/{notificationRuleId}", + path_param_examples={ + "notificationRuleId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "isDefault" : false, + "expression" : "((lastContact >= 30 min))", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "ruleName" : "Default Agent Offline Notification", + "ruleId" : "281474976710706", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationName" : "integrationSlack1", + "authToken" : "0VqDYEpidpHVAK397x8PBsmZ", + "channel" : "#slackChannel", + "integrationId" : "wb-78", + "authMethod" : "Basic", + "authUser" : "user123", + "target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ" + }, { + "integrationType" : "slack", + "integrationName" : "integrationSlack1", + "authToken" : "0VqDYEpidpHVAK397x8PBsmZ", + "channel" : "#slackChannel", + "integrationId" : "wb-78", + "authMethod" : "Basic", + "authUser" : "user123", + "target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ" + } ], + "webhook" : [ { + "integrationType" : "slack", + "integrationName" : "integrationSlack1", + "authToken" : "0VqDYEpidpHVAK397x8PBsmZ", + "channel" : "#slackChannel", + "integrationId" : "wb-78", + "authMethod" : "Basic", + "authUser" : "user123", + "target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ" + }, { + "integrationType" : "slack", + "integrationName" : "integrationSlack1", + "authToken" : "0VqDYEpidpHVAK397x8PBsmZ", + "channel" : "#slackChannel", + "integrationId" : "wb-78", + "authMethod" : "Basic", + "authUser" : "user123", + "target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ" + } ], + "email" : { + "recipients" : [ "user1@thousandeyes.com", "user2@cisco.com" ], + "message" : "This test is failing, check as soon as possible." + } + }, + "notifyOnClear" : true, + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agents_notification_rules": OperationExpectation( + operation_id="get_agents_notification_rules", + method="GET", + path="/agents/notification-rules", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "agentAlertRules" : [ { + "ruleId" : "281474976710706", + "ruleName" : "Default Agent Offline Notification", + "expression" : "((lastContact >= 30 min))", + "notifyOnClear" : true, + "isDefault" : false + }, { + "ruleId" : "281474976710709", + "ruleName" : "Test Rule", + "expression" : "((lastContact >= 40 min))", + "notifyOnClear" : true, + "isDefault" : true + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_agent": OperationExpectation( + operation_id="delete_agent", + method="DELETE", + path="/agents/{agentId}", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent": OperationExpectation( + operation_id="get_agent", + method="GET", + path="/agents/{agentId}", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "agentId" : "281474976710706", + "agentType" : "cloud", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" + }, { + "labelId" : "11", + "name" : "Label name" + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agents": OperationExpectation( + operation_id="get_agents", + method="GET", + path="/agents", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_agent": OperationExpectation( + operation_id="update_agent", + method="PUT", + path="/agents/{agentId}", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "agentId" : "281474976710706", + "agentType" : "cloud", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" + }, { + "labelId" : "11", + "name" : "Label name" + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/25" ], + "tests" : [ "12313145", "12345" ], + "ipv6Policy" : "force-ipv4", + "keepBrowserCache" : true, + "targetForTests" : "1.1.1.1", + "agentName" : "thousandeyes-stg-va-254", + "enabled" : true, + "accountGroups" : [ "1234", "1" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "assign_agent_to_cluster": OperationExpectation( + operation_id="assign_agent_to_cluster", + method="POST", + path="/agents/{agentId}/cluster/assign", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "agentId" : "281474976710706", + "agentType" : "cloud", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" + }, { + "labelId" : "11", + "name" : "Label name" + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "agents" : [ "281474976710706" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "unassign_agent_from_cluster": OperationExpectation( + operation_id="unassign_agent_from_cluster", + method="POST", + path="/agents/{agentId}/cluster/unassign", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "members" : [ "281474976710706" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agents_local_problems": OperationExpectation( + operation_id="get_agents_local_problems", + method="GET", + path="/agents/local-problems", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "localProblems" : [ { + "duration" : 480, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "endDate" : "2026-05-18T03:22:00Z", + "active" : false, + "startDate" : "2026-05-18T03:14:00Z" + }, { + "duration" : 480, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "endDate" : "2026-05-18T03:22:00Z", + "active" : false, + "startDate" : "2026-05-18T03:14:00Z" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "assign_tests": OperationExpectation( + operation_id="assign_tests", + method="POST", + path="/agents/{agentId}/tests/assign", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "agentId" : "281474976710706", + "agentType" : "cloud", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" + }, { + "labelId" : "11", + "name" : "Label name" + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "testIds" : [ "281474976710706" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "overwrite_tests": OperationExpectation( + operation_id="overwrite_tests", + method="POST", + path="/agents/{agentId}/tests/override", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "agentId" : "281474976710706", + "agentType" : "cloud", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" + }, { + "labelId" : "11", + "name" : "Label name" + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "testIds" : [ "281474976710706" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "unassign_tests": OperationExpectation( + operation_id="unassign_tests", + method="POST", + path="/agents/{agentId}/tests/unassign", + path_param_examples={ + "agentId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "agentId" : "281474976710706", + "agentType" : "cloud", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "labels" : [ { + "labelId" : "11", + "name" : "Label name" + }, { + "labelId" : "11", + "name" : "Label name" + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "testIds" : [ "281474976710706" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-agents/test/test_agent_proxies_api_integration.py b/thousandeyes-sdk-agents/test/test_agent_proxies_api_integration.py new file mode 100644 index 00000000..c49fe42e --- /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 00000000..f3e5a4a0 --- /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 00000000..92c940db --- /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 00000000..b734cdc2 --- /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 00000000..bd908a0b --- /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 00000000..d6898248 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-agents/test/test_utils.py +++ b/thousandeyes-sdk-agents/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-alerts/.openapi-generator/FILES b/thousandeyes-sdk-alerts/.openapi-generator/FILES index eeb9f4a7..ec14360c 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 fc581807..45ded233 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.97 - 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 69b6ec0c..01bcd601 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 e99134df..90020032 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 846f80db..99df3923 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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-alerts/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-alerts/test/integration_test_utils.py b/thousandeyes-sdk-alerts/test/integration_test_utils.py new file mode 100644 index 00000000..24b37d08 --- /dev/null +++ b/thousandeyes-sdk-alerts/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Alerts API + + **Note:** API operations for the creation or retrieval of API, Page Load, or Web-Transaction alert rules are not available for ThousandEyes for Government instance. You can manage the following alert functionalities on the ThousandEyes platform using the Alerts API: * **Alerts**: Retrieve alert details. Alerts are assigned to tests through alert rules. * **Alert Rules**: Conditions that you configure in order to highlight or be notified of events of interest in your ThousandEyes tests. When an alert rule’s conditions are met, the associated alert is triggered and the alert becomes active. It remains active until the alert is cleared. Alert rules are reusable across multiple tests.. * **Alert Suppression Windows**: Suppress alerts for tests during periods such as planned maintenance. Windows can be one-time events or recurring events to handle periodic occurrences such as monthly downtime for maintenance. For more information about the alerts, see [Alerts](https://docs.thousandeyes.com/product-documentation/alerts). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-alerts/test/mock_manifest.py b/thousandeyes-sdk-alerts/test/mock_manifest.py new file mode 100644 index 00000000..b1d811c7 --- /dev/null +++ b/thousandeyes-sdk-alerts/test/mock_manifest.py @@ -0,0 +1,2247 @@ +# coding: utf-8 + +""" + Alerts API + + **Note:** API operations for the creation or retrieval of API, Page Load, or Web-Transaction alert rules are not available for ThousandEyes for Government instance. You can manage the following alert functionalities on the ThousandEyes platform using the Alerts API: * **Alerts**: Retrieve alert details. Alerts are assigned to tests through alert rules. * **Alert Rules**: Conditions that you configure in order to highlight or be notified of events of interest in your ThousandEyes tests. When an alert rule’s conditions are met, the associated alert is triggered and the alert becomes active. It remains active until the alert is cleared. Alert rules are reusable across multiple tests.. * **Alert Suppression Windows**: Suppress alerts for tests during periods such as planned maintenance. Windows can be one-time events or recurring events to handle periodic occurrences such as monthly downtime for maintenance. For more information about the alerts, see [Alerts](https://docs.thousandeyes.com/product-documentation/alerts). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_alert_rule": OperationExpectation( + operation_id="create_alert_rule", + method="POST", + path="/alerts/rules", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_alert_rule": OperationExpectation( + operation_id="delete_alert_rule", + method="DELETE", + path="/alerts/rules/{ruleId}", + path_param_examples={ + "ruleId": '127094', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_alert_rule": OperationExpectation( + operation_id="get_alert_rule", + method="GET", + path="/alerts/rules/{ruleId}", + path_param_examples={ + "ruleId": '127094', + }, + success_status=200, + success_body=json.loads(""" + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_alerts_rules": OperationExpectation( + operation_id="get_alerts_rules", + method="GET", + path="/alerts/rules", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_alert_rule": OperationExpectation( + operation_id="update_alert_rule", + method="PUT", + path="/alerts/rules/{ruleId}", + path_param_examples={ + "ruleId": '127094', + }, + success_status=200, + success_body=json.loads(""" + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "includeCoveredPrefixes" : true, + "visitedSitesFilter" : [ "app.thousandeyes.com" ], + "description" : "A rule description string", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "alertGroupType" : "endpoint", + "notifyOnClear" : true, + "testIds" : [ "281474976710706", "271659" ], + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "endpointAgentIds" : [ "281474976710706", "281474976710706" ], + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "endpointLabelIds" : [ "123456", "123456" ], + "minimumSources" : 10, + "ruleId" : "127094", + "notifications" : { + "thirdParty" : [ { + "integrationType" : "slack", + "integrationId" : "sl-101" + }, { + "integrationType" : "slack", + "integrationId" : "sl-101" + } ], + "webhook" : [ { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "webhook", + "integrationName" : "My webhook", + "integrationId" : "wb-201", + "target" : "https://example.com/test/webhooks/notifications" + } ], + "email" : { + "recipients" : [ "noreply@thousandeyes.com" ], + "message" : "Notification message" + }, + "customWebhook" : [ { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + }, { + "integrationType" : "custom-webhook", + "integrationName" : "My webhook", + "integrationId" : "6e069ae9-8537-4120-b988-61bf8e0d8b87", + "target" : "https://example.com/test/webhooks/notifications" + } ] + }, + "direction" : "to-target" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_alert_suppression_window": OperationExpectation( + operation_id="create_alert_suppression_window", + method="POST", + path="/alert-suppression-windows", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_alert_suppression_window": OperationExpectation( + operation_id="delete_alert_suppression_window", + method="DELETE", + path="/alert-suppression-windows/{windowId}", + path_param_examples={ + "windowId": '2411', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_alert_suppression_window": OperationExpectation( + operation_id="get_alert_suppression_window", + method="GET", + path="/alert-suppression-windows/{windowId}", + path_param_examples={ + "windowId": '2411', + }, + success_status=200, + success_body=json.loads(""" + + { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_alert_suppression_windows": OperationExpectation( + operation_id="get_alert_suppression_windows", + method="GET", + path="/alert-suppression-windows", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertSuppressionWindows" : [ { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + }, { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_alert_suppression_window": OperationExpectation( + operation_id="update_alert_suppression_window", + method="PUT", + path="/alert-suppression-windows/{windowId}", + path_param_examples={ + "windowId": '2411', + }, + success_status=200, + success_body=json.loads(""" + + { + "duration" : 0, + "alertSuppressionWindowId" : "2411", + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "duration" : 0, + "testIds" : [ "71687", "71687" ], + "alertSuppressionWindowId" : "2411", + "isEnabled" : false, + "repeat" : { + "intervalType" : "day", + "intervalLength" : 2, + "type" : "week", + "daysOfWeek" : [ "sun", "sun" ] + }, + "endRepeat" : { + "date" : "2017-07-01", + "count" : 3, + "type" : "never" + }, + "name" : "Monthly maintenance", + "startDate" : "2017-07-01T05:00:00Z", + "status" : "ended" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_alert": OperationExpectation( + operation_id="get_alert", + method="GET", + path="/alerts/{alertId}", + path_param_examples={ + "alertId": 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569', + }, + success_status=200, + success_body=json.loads(""" + + { + "severity" : "major", + "alertType" : "http-server", + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "test" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "rule" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertSeverity" : "major", + "duration" : 60, + "violationCount" : 2, + "_embedded" : { + "asn" : { + "name" : "Cisco Webex LLC", + "id" : "13445", + "type" : "asn" + } + }, + "meta" : { + "version" : 1 + }, + "details" : [ { + "name" : "Bucharest, Romania", + "start" : { + "metrics" : "metrics" + }, + "end" : { + "metrics" : "metrics" + }, + "id" : "3379", + "state" : "trigger", + "type" : "cea_agent" + }, { + "name" : "Bucharest, Romania", + "start" : { + "metrics" : "metrics" + }, + "end" : { + "metrics" : "metrics" + }, + "id" : "3379", + "state" : "trigger", + "type" : "cea_agent" + } ], + "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", + "suppressed" : false, + "state" : "trigger", + "alertState" : "trigger", + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_alerts": OperationExpectation( + operation_id="get_alerts", + method="GET", + path="/alerts", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "alerts" : [ { + "severity" : "MAJOR", + "alertType" : "http-server", + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "test" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "rule" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "apiLinks" : [ { + "key" : "" + }, { + "key" : "" + } ], + "alertSeverity" : "major", + "dateEnd" : "2020-04-23 13:43:16", + "duration" : 60, + "violationCount" : 2, + "dateStart" : "2020-04-23 13:43:16", + "meta" : { + "version" : 1 + }, + "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", + "suppressed" : false, + "alertId" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", + "state" : "ACTIVE", + "ruleId" : 127094, + "permalink" : "https://app.thousandeyes.com/alerts/list?__a=75&alertId=2783&agentId=12", + "alertState" : "trigger", + "startDate" : "2022-07-17T22:00:54Z", + "alertRuleId" : "127094" + }, { + "severity" : "MAJOR", + "alertType" : "http-server", + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "test" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "rule" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "apiLinks" : [ { + "key" : "" + }, { + "key" : "" + } ], + "alertSeverity" : "major", + "dateEnd" : "2020-04-23 13:43:16", + "duration" : 60, + "violationCount" : 2, + "dateStart" : "2020-04-23 13:43:16", + "meta" : { + "version" : 1 + }, + "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", + "suppressed" : false, + "alertId" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", + "state" : "ACTIVE", + "ruleId" : 127094, + "permalink" : "https://app.thousandeyes.com/alerts/list?__a=75&alertId=2783&agentId=12", + "alertState" : "trigger", + "startDate" : "2022-07-17T22:00:54Z", + "alertRuleId" : "127094" + } ], + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py b/thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py new file mode 100644 index 00000000..5e96180d --- /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 00000000..382665c5 --- /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 00000000..7d0bc39d --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-alerts/test/test_utils.py +++ b/thousandeyes-sdk-alerts/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-bgp-monitors/.openapi-generator/FILES b/thousandeyes-sdk-bgp-monitors/.openapi-generator/FILES index 51ff2ec6..a75b55a7 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 17438bcf..f1117e58 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.97 - 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 00000000..2edba7b3 --- /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 00000000..d3f74d52 --- /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 00000000..e65165d8 --- /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 00000000..fd563ee0 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-bgp-monitors/test/test_utils.py +++ b/thousandeyes-sdk-bgp-monitors/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-connectors/.openapi-generator/FILES b/thousandeyes-sdk-connectors/.openapi-generator/FILES index 21439952..8b24a2ae 100644 --- a/thousandeyes-sdk-connectors/.openapi-generator/FILES +++ b/thousandeyes-sdk-connectors/.openapi-generator/FILES @@ -76,9 +76,17 @@ 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_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 cdb5c54f..ed96bddf 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.97 - 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: diff --git a/thousandeyes-sdk-connectors/docs/CredentialVaultOperationsApi.md b/thousandeyes-sdk-connectors/docs/CredentialVaultOperationsApi.md index 23d3c176..e1340717 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 73947579..8b1b168a 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 b94234f9..e66269c3 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/WebhookOperationsApi.md b/thousandeyes-sdk-connectors/docs/WebhookOperationsApi.md index c5c151e2..033f7ec2 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/test/conftest.py b/thousandeyes-sdk-connectors/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-connectors/test/integration_test_utils.py b/thousandeyes-sdk-connectors/test/integration_test_utils.py new file mode 100644 index 00000000..c05e4aa3 --- /dev/null +++ b/thousandeyes-sdk-connectors/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Integrations API + + **Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-connectors/test/mock_manifest.py b/thousandeyes-sdk-connectors/test/mock_manifest.py new file mode 100644 index 00000000..8ed9fbdb --- /dev/null +++ b/thousandeyes-sdk-connectors/test/mock_manifest.py @@ -0,0 +1,3021 @@ +# coding: utf-8 + +""" + Integrations API + + **Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_credential_vault_operation": OperationExpectation( + operation_id="create_credential_vault_operation", + method="POST", + path="/operations/credential-vault", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_credential_vault_operation": OperationExpectation( + operation_id="delete_credential_vault_operation", + method="DELETE", + path="/operations/credential-vault/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_credential_vault_operation": OperationExpectation( + operation_id="get_credential_vault_operation", + method="GET", + path="/operations/credential-vault/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_credential_vault_operations": OperationExpectation( + operation_id="get_credential_vault_operations", + method="GET", + path="/operations/credential-vault", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "items" : [ { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + }, { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_credential_vault_operation": OperationExpectation( + operation_id="update_credential_vault_operation", + method="PUT", + path="/operations/credential-vault/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "webhook", + "secrets" : [ { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + }, { + "secretKey" : "secret/key", + "name" : "secret_name", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf" + } ], + "status" : "pending" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_conjur_connector": OperationExpectation( + operation_id="create_conjur_connector", + method="POST", + path="/connectors/conjur", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_conjur_connector": OperationExpectation( + operation_id="delete_conjur_connector", + method="DELETE", + path="/connectors/conjur/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_conjur_connector": OperationExpectation( + operation_id="get_conjur_connector", + method="GET", + path="/connectors/conjur/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_conjur_connector_operations": OperationExpectation( + operation_id="get_conjur_connector_operations", + method="GET", + path="/connectors/conjur/{id}/operations", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_conjur_connectors": OperationExpectation( + operation_id="get_conjur_connectors", + method="GET", + path="/connectors/conjur", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "items" : [ { + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + }, { + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_conjur_connector": OperationExpectation( + operation_id="update_conjur_connector", + method="PUT", + path="/connectors/conjur/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "account" : "My CyberArk Account", + "target" : "https://eval.conjur.org/secrets", + "authentication" : { + "apiKey" : "abc123", + "hostId" : "host1", + "type" : "basic" + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_generic_connector": OperationExpectation( + operation_id="create_generic_connector", + method="POST", + path="/connectors/generic", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_generic_connector": OperationExpectation( + operation_id="delete_generic_connector", + method="DELETE", + path="/connectors/generic/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_generic_connector": OperationExpectation( + operation_id="get_generic_connector", + method="GET", + path="/connectors/generic/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_generic_connectors": OperationExpectation( + operation_id="get_generic_connectors", + method="GET", + path="/connectors/generic", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "items" : [ { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + }, { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "list_generic_connector_operations": OperationExpectation( + operation_id="list_generic_connector_operations", + method="GET", + path="/connectors/generic/{id}/operations", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_generic_connector": OperationExpectation( + operation_id="update_generic_connector", + method="PUT", + path="/connectors/generic/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "lastModifiedDate" : 1770293655756, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Cisco Slack", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "type" : "generic", + "target" : "https://hooks.slack.com/services/abc/xyz", + "authentication" : { + "password" : "abc123", + "type" : "basic", + "username" : "user1" + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_operation_connectors": OperationExpectation( + operation_id="get_operation_connectors", + method="GET", + path="/operations/{type}/{id}/connectors", + path_param_examples={ + "type": 'webhooks', + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_webhook_operation": OperationExpectation( + operation_id="create_webhook_operation", + method="POST", + path="/operations/webhooks", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_webhook_operation": OperationExpectation( + operation_id="delete_webhook_operation", + method="DELETE", + path="/operations/webhooks/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_webhook_operation": OperationExpectation( + operation_id="get_webhook_operation", + method="GET", + path="/operations/webhooks/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_webhook_operations": OperationExpectation( + operation_id="get_webhook_operations", + method="GET", + path="/operations/webhooks", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "items" : [ { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + }, { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_webhook_operation": OperationExpectation( + operation_id="update_webhook_operation", + method="PUT", + path="/operations/webhooks/{id}", + path_param_examples={ + "id": 'cb1b8033-ea2d-4e9b-a920-fe87850693cf', + }, + success_status=200, + success_body=json.loads(""" + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "path" : "/custom/path", + "headers" : [ { + "name" : "Content-Type", + "value" : "application/json" + }, { + "name" : "Content-Type", + "value" : "application/json" + } ], + "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}", + "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "My operation", + "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf", + "category" : "alerts", + "type" : "webhook", + "enabled" : true, + "status" : "pending" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py b/thousandeyes-sdk-connectors/test/test_credential_vault_operations_api_integration.py new file mode 100644 index 00000000..c487bb72 --- /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 04625f7a..927fcdcb 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 @@ class TestCyberArkConjurConnectorsApi(unittest.TestCase): 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 00000000..fd05aef0 --- /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 b6596925..df453bad 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 @@ class TestGenericConnectorsApi(unittest.TestCase): 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 00000000..77671948 --- /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 9b516f05..e50b4582 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 @@ class TestOperationConnectorsApi(unittest.TestCase): 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 00000000..3a3e2f1a --- /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_utils.py b/thousandeyes-sdk-connectors/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-connectors/test/test_utils.py +++ b/thousandeyes-sdk-connectors/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py b/thousandeyes-sdk-connectors/test/test_webhook_operations_api_integration.py new file mode 100644 index 00000000..4233aae4 --- /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 90a5cd8c..4569e030 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 c9163505..dfae7b66 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.97 - 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 70b8eecb..0435a9aa 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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-credentials/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-credentials/test/integration_test_utils.py b/thousandeyes-sdk-credentials/test/integration_test_utils.py new file mode 100644 index 00000000..68f51d3e --- /dev/null +++ b/thousandeyes-sdk-credentials/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Credentials API + + Manage credentials for transaction tests using the Credentials API. The following permissions are required to access Credentials API operations: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations. * `View sensitive data in web transaction scripts` to view the encrypted value property of credentials. * `Settings Tests Create Transaction (Tx) Tests` to create credentials. For more information about credentials, see [Working With Secure Credentials](https://docs.thousandeyes.com/product-documentation/browser-synthetics/transaction-tests/getting-started/working-with-secure-credentials). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-credentials/test/mock_manifest.py b/thousandeyes-sdk-credentials/test/mock_manifest.py new file mode 100644 index 00000000..60292339 --- /dev/null +++ b/thousandeyes-sdk-credentials/test/mock_manifest.py @@ -0,0 +1,604 @@ +# coding: utf-8 + +""" + Credentials API + + Manage credentials for transaction tests using the Credentials API. The following permissions are required to access Credentials API operations: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations. * `View sensitive data in web transaction scripts` to view the encrypted value property of credentials. * `Settings Tests Create Transaction (Tx) Tests` to create credentials. For more information about credentials, see [Working With Secure Credentials](https://docs.thousandeyes.com/product-documentation/browser-synthetics/transaction-tests/getting-started/working-with-secure-credentials). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_credential": OperationExpectation( + operation_id="create_credential", + method="POST", + path="/credentials", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Example Credential", + "id" : "3247" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_credential": OperationExpectation( + operation_id="delete_credential", + method="DELETE", + path="/credentials/{id}", + path_param_examples={ + "id": '3247', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_credential": OperationExpectation( + operation_id="get_credential", + method="GET", + path="/credentials/{id}", + path_param_examples={ + "id": '3247', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Example Credential", + "id" : "3247", + "value" : "rwhR12uDm1Im47p5IVXgzz4ORgC7m48ajzzeWVUt" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_credentials": OperationExpectation( + operation_id="get_credentials", + method="GET", + path="/credentials", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "credentials" : [ { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Example Credential", + "id" : "3247", + "value" : "rwhR12uDm1Im47p5IVXgzz4ORgC7m48ajzzeWVUt" + }, { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Example Credential", + "id" : "3247", + "value" : "rwhR12uDm1Im47p5IVXgzz4ORgC7m48ajzzeWVUt" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_credential": OperationExpectation( + operation_id="update_credential", + method="PUT", + path="/credentials/{id}", + path_param_examples={ + "id": '3247', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Example Credential", + "id" : "3247" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "name" : "Example Credential 1", + "value" : "Example Credential 1 Password" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-credentials/test/test_credentials_api_integration.py b/thousandeyes-sdk-credentials/test/test_credentials_api_integration.py new file mode 100644 index 00000000..2642639c --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-credentials/test/test_utils.py +++ b/thousandeyes-sdk-credentials/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-dashboards/.openapi-generator/FILES b/thousandeyes-sdk-dashboards/.openapi-generator/FILES index 1eb8c311..53b719a4 100644 --- a/thousandeyes-sdk-dashboards/.openapi-generator/FILES +++ b/thousandeyes-sdk-dashboards/.openapi-generator/FILES @@ -246,7 +246,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 13099c89..db1e954d 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.97 - 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: diff --git a/thousandeyes-sdk-dashboards/docs/DashboardSnapshotsApi.md b/thousandeyes-sdk-dashboards/docs/DashboardSnapshotsApi.md index dd32ce74..00ec1f3d 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 5b1feeaf..8e9187ef 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 976245ad..bd7b2620 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/test/conftest.py b/thousandeyes-sdk-dashboards/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-dashboards/test/integration_test_utils.py b/thousandeyes-sdk-dashboards/test/integration_test_utils.py new file mode 100644 index 00000000..752c1c5d --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Dashboards API + + Manage ThousandEyes Dashboards. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-dashboards/test/mock_manifest.py b/thousandeyes-sdk-dashboards/test/mock_manifest.py new file mode 100644 index 00000000..bf980ccd --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/mock_manifest.py @@ -0,0 +1,5061 @@ +# coding: utf-8 + +""" + Dashboards API + + Manage ThousandEyes Dashboards. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_dashboard_snapshot": OperationExpectation( + operation_id="create_dashboard_snapshot", + method="POST", + path="/dashboard-snapshots", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_dashboard_snapshot": OperationExpectation( + operation_id="delete_dashboard_snapshot", + method="DELETE", + path="/dashboard-snapshots/{snapshotId}", + path_param_examples={ + "snapshotId": 'd28bb71f-5a47-4783-8f12-d4b115e61b0c', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dashboard_snapshot": OperationExpectation( + operation_id="get_dashboard_snapshot", + method="GET", + path="/dashboard-snapshots/{snapshotId}", + path_param_examples={ + "snapshotId": 'd28bb71f-5a47-4783-8f12-d4b115e61b0c', + }, + success_status=200, + success_body=json.loads(""" + + { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "apiLinks" : [ { + "key" : "" + }, { + "key" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dashboard_snapshot_widget_data": OperationExpectation( + operation_id="get_dashboard_snapshot_widget_data", + method="GET", + path="/dashboard-snapshots/{snapshotId}/widgets/{widgetId}", + path_param_examples={ + "snapshotId": 'd28bb71f-5a47-4783-8f12-d4b115e61b0c', + "widgetId": 'unpmg', + }, + success_status=200, + success_body=json.loads(""" + + { + "groupLabels" : [ { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + }, { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + } ], + "data" : { + "alerts" : [ { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + }, { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + } ], + "summary" : { + "offline" : 2, + "online" : 10, + "disabled" : 3 + }, + "totalAlerts" : 500, + "cards" : [ { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + }, { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + } ], + "tests" : [ { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + }, { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + } ], + "columns" : [ { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + }, { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + } ], + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "activeAlerts" : 483, + "startRound" : 1384309800, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "agents" : [ { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + }, { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + } ], + "status" : "No data" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "binSize" : 3600, + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dashboard_snapshots": OperationExpectation( + operation_id="get_dashboard_snapshots", + method="GET", + path="/dashboard-snapshots", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "pages" : { + "key" : "" + }, + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dashboardSnapshots" : [ { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "apiLinks" : [ { + "key" : "" + }, { + "key" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + }, { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "apiLinks" : [ { + "key" : "" + }, { + "key" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_dashboard_snapshot_expiration_date": OperationExpectation( + operation_id="update_dashboard_snapshot_expiration_date", + method="PATCH", + path="/dashboard-snapshots/{snapshotId}", + path_param_examples={ + "snapshotId": 'd28bb71f-5a47-4783-8f12-d4b115e61b0c', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=json.loads(""" + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dashboard": OperationExpectation( + operation_id="create_dashboard", + method="POST", + path="/dashboards", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_dashboard": OperationExpectation( + operation_id="delete_dashboard", + method="DELETE", + path="/dashboards/{dashboardId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dashboard": OperationExpectation( + operation_id="get_dashboard", + method="GET", + path="/dashboards/{dashboardId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + }, + success_status=200, + success_body=json.loads(""" + + { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dashboard_widget_data": OperationExpectation( + operation_id="get_dashboard_widget_data", + method="GET", + path="/dashboards/{dashboardId}/widgets/{widgetId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + "widgetId": 'unpmg', + }, + success_status=200, + success_body=json.loads(""" + + { + "groupLabels" : [ { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + }, { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + } ], + "data" : { + "alerts" : [ { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + }, { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + } ], + "summary" : { + "offline" : 2, + "online" : 10, + "disabled" : 3 + }, + "totalAlerts" : 500, + "cards" : [ { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + }, { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + } ], + "tests" : [ { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + }, { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + } ], + "columns" : [ { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + }, { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + } ], + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "activeAlerts" : 483, + "startRound" : 1384309800, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "agents" : [ { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + }, { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + } ], + "status" : "No data" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "binSize" : 3600, + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dashboards": OperationExpectation( + operation_id="get_dashboards", + method="GET", + path="/dashboards", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + [ { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + } ] + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_individual_card_data": OperationExpectation( + operation_id="get_individual_card_data", + method="GET", + path="/dashboards/{dashboardId}/widgets/{widgetId}/cards/{cardId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + "widgetId": 'unpmg', + "cardId": 'rvwgs', + }, + success_status=200, + success_body=json.loads(""" + + { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_individual_column_data": OperationExpectation( + operation_id="get_individual_column_data", + method="GET", + path="/dashboards/{dashboardId}/widgets/{widgetId}/columns/{columnId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + "widgetId": 'unpmg', + "columnId": 'col123', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_dashboard": OperationExpectation( + operation_id="update_dashboard", + method="PUT", + path="/dashboards/{dashboardId}", + path_param_examples={ + "dashboardId": '646f4d2ce3c99b0536c3821e', + }, + success_status=200, + success_body=json.loads(""" + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dashboard_filter": OperationExpectation( + operation_id="create_dashboard_filter", + method="POST", + path="/dashboards/filters", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_dashboard_filter": OperationExpectation( + operation_id="delete_dashboard_filter", + method="DELETE", + path="/dashboards/filters/{id}", + path_param_examples={ + "id": '65bc18e8f2073a4a469cd958', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dashboard_filter": OperationExpectation( + operation_id="get_dashboard_filter", + method="GET", + path="/dashboards/filters/{id}", + path_param_examples={ + "id": '65bc18e8f2073a4a469cd958', + }, + success_status=200, + success_body=json.loads(""" + + { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dashboards_filters": OperationExpectation( + operation_id="get_dashboards_filters", + method="GET", + path="/dashboards/filters", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "dashboardFilters" : [ { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + }, { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_dashboard_filter": OperationExpectation( + operation_id="update_dashboard_filter", + method="PUT", + path="/dashboards/filters/{id}", + path_param_examples={ + "id": '65bc18e8f2073a4a469cd958', + }, + success_status=200, + success_body=json.loads(""" + + { + "createdDate" : "2024-02-01T22:19:19Z", + "createdBy" : { + "uid" : "1", + "name" : "Test User" + }, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "modifiedDate" : "2024-02-01T22:19:19Z", + "description" : "Global filter for CEA widgets", + "modifiedBy" : { + "uid" : "1", + "name" : "Test User" + }, + "id" : "65bc18e8f2073a4a469cd958", + "aid" : "11" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "context" : [ { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + }, { + "dataSourceId" : "VIRTUAL_AGENT", + "filters" : [ { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + }, { + "filterId" : "TEST_LABEL", + "metricIds" : [ "WEB_PAGE_LOAD_COMPLETION_RATE", "WEB_TTFB", "WEB_AVAILABILITY" ], + "values" : [ "45862", "59749" ] + } ] + } ], + "name" : "cea-filter", + "description" : "Global filter for CEA widgets" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py b/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py new file mode 100644 index 00000000..6ae79e8c --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py @@ -0,0 +1,2610 @@ +# coding: utf-8 + +""" + Dashboards API + + Manage ThousandEyes Dashboards. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.dashboards.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.dashboards.api.dashboard_snapshots_api import DashboardSnapshotsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestDashboardSnapshotsApiIntegration(IntegrationTestBase): + """DashboardSnapshotsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = DashboardSnapshotsApi(self.api_client) + + + def test_create_dashboard_snapshot_happy_path(self) -> None: + """Integration test for create_dashboard_snapshot success path""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_dashboard_snapshot( + + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + + aid=aid, + + _headers=self.te_headers("create_dashboard_snapshot"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_dashboard_snapshot_error_400(self) -> None: + """Integration test for create_dashboard_snapshot error path (HTTP 400)""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.create_dashboard_snapshot( + + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + + aid=aid, + + _headers=self.te_headers("create_dashboard_snapshot", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_snapshot_error_401(self) -> None: + """Integration test for create_dashboard_snapshot error path (HTTP 401)""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.create_dashboard_snapshot( + + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + + aid=aid, + + _headers=self.te_headers("create_dashboard_snapshot", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_snapshot_error_403(self) -> None: + """Integration test for create_dashboard_snapshot error path (HTTP 403)""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.create_dashboard_snapshot( + + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + + aid=aid, + + _headers=self.te_headers("create_dashboard_snapshot", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_snapshot_error_404(self) -> None: + """Integration test for create_dashboard_snapshot error path (HTTP 404)""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.create_dashboard_snapshot( + + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + + aid=aid, + + _headers=self.te_headers("create_dashboard_snapshot", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_snapshot_error_500(self) -> None: + """Integration test for create_dashboard_snapshot error path (HTTP 500)""" + request_body_json = """ + + { + "endDate" : "2023-05-16T10:14:28Z", + "dashboardId" : "646f4d2ce3c99b0536c3821e", + "displayName" : "snapshot from API", + "anonymizeData" : true, + "timezone" : "PST", + "startDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16T10:14:28Z" + } + + """ + generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.create_dashboard_snapshot( + + generate_dashboard_snapshot_request=generate_dashboard_snapshot_request, + + aid=aid, + + _headers=self.te_headers("create_dashboard_snapshot", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_dashboard_snapshot_happy_path(self) -> None: + """Integration test for delete_dashboard_snapshot success path""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + response = self.api.delete_dashboard_snapshot_with_http_info( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard_snapshot"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_dashboard_snapshot_error_400(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 400)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.delete_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard_snapshot", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_snapshot_error_401(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 401)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.delete_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard_snapshot", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_snapshot_error_403(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 403)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.delete_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard_snapshot", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_snapshot_error_404(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 404)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.delete_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard_snapshot", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_snapshot_error_429(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 429)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.delete_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard_snapshot", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_snapshot_error_500(self) -> None: + """Integration test for delete_dashboard_snapshot error path (HTTP 500)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.delete_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard_snapshot", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboard_snapshot_happy_path(self) -> None: + """Integration test for get_dashboard_snapshot success path""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + response_body_json = """ + { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "apiLinks" : [ { + "key" : "" + }, { + "key" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboard_snapshot_error_400(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 400)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.get_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_error_401(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 401)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.get_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_error_403(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 403)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_error_404(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 404)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_error_429(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 429)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_error_500(self) -> None: + """Integration test for get_dashboard_snapshot error path (HTTP 500)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_dashboard_snapshot( + + snapshot_id=snapshot_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboard_snapshot_widget_data_happy_path(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data success path""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + aid = '1234' + response_body_json = """ + { + "groupLabels" : [ { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + }, { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + } ], + "data" : { + "alerts" : [ { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + }, { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + } ], + "summary" : { + "offline" : 2, + "online" : 10, + "disabled" : 3 + }, + "totalAlerts" : 500, + "cards" : [ { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + }, { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + } ], + "tests" : [ { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + }, { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + } ], + "columns" : [ { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + }, { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + } ], + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "activeAlerts" : 483, + "startRound" : 1384309800, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "agents" : [ { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + }, { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + } ], + "status" : "No data" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "binSize" : 3600, + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboard_snapshot_widget_data( + + snapshot_id=snapshot_id, + + widget_id=widget_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot_widget_data"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboard_snapshot_widget_data_error_400(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 400)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.get_dashboard_snapshot_widget_data( + + snapshot_id=snapshot_id, + + widget_id=widget_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_widget_data_error_401(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 401)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.get_dashboard_snapshot_widget_data( + + snapshot_id=snapshot_id, + + widget_id=widget_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_widget_data_error_403(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 403)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_dashboard_snapshot_widget_data( + + snapshot_id=snapshot_id, + + widget_id=widget_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_widget_data_error_404(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 404)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_dashboard_snapshot_widget_data( + + snapshot_id=snapshot_id, + + widget_id=widget_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_widget_data_error_429(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 429)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_dashboard_snapshot_widget_data( + + snapshot_id=snapshot_id, + + widget_id=widget_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshot_widget_data_error_500(self) -> None: + """Integration test for get_dashboard_snapshot_widget_data error path (HTTP 500)""" + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + widget_id = 'unpmg' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_dashboard_snapshot_widget_data( + + snapshot_id=snapshot_id, + + widget_id=widget_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboard_snapshots_happy_path(self) -> None: + """Integration test for get_dashboard_snapshots success path""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + cursor = 'cursor_example' + response_body_json = """ + { + "pages" : { + "key" : "" + }, + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dashboardSnapshots" : [ { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "apiLinks" : [ { + "key" : "" + }, { + "key" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + }, { + "snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "apiLinks" : [ { + "key" : "" + }, { + "key" : "" + } ], + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "isScheduled" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "accountId" : 1234, + "createdDate" : "2023-05-16 10:14:28", + "snapshotName" : "HTTP Server Dashboard Snapshot", + "timeSpan" : { + "duration" : 60, + "start" : "2023-05-16T10:14:28Z", + "startDate" : "2023-05-16 10:14:28" + }, + "permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c", + "aid" : "1234", + "snapshotCreatedDate" : "2023-05-16T10:14:28Z", + "isShared" : true, + "dashboard" : { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, + "expirationDate" : "2023-05-16 10:14:28" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboard_snapshots( + + aid=aid, + + dashboard_id=dashboard_id, + + cursor=cursor, + + _headers=self.te_headers("get_dashboard_snapshots"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboard_snapshots_error_400(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 400)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.get_dashboard_snapshots( + + aid=aid, + + dashboard_id=dashboard_id, + + cursor=cursor, + + _headers=self.te_headers("get_dashboard_snapshots", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshots_error_401(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 401)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + cursor = 'cursor_example' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.get_dashboard_snapshots( + + aid=aid, + + dashboard_id=dashboard_id, + + cursor=cursor, + + _headers=self.te_headers("get_dashboard_snapshots", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshots_error_403(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 403)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_dashboard_snapshots( + + aid=aid, + + dashboard_id=dashboard_id, + + cursor=cursor, + + _headers=self.te_headers("get_dashboard_snapshots", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshots_error_404(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 404)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_dashboard_snapshots( + + aid=aid, + + dashboard_id=dashboard_id, + + cursor=cursor, + + _headers=self.te_headers("get_dashboard_snapshots", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshots_error_429(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 429)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_dashboard_snapshots( + + aid=aid, + + dashboard_id=dashboard_id, + + cursor=cursor, + + _headers=self.te_headers("get_dashboard_snapshots", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_snapshots_error_500(self) -> None: + """Integration test for get_dashboard_snapshots error path (HTTP 500)""" + aid = '1234' + dashboard_id = '646f4d2ce3c99b0536c3821e' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_dashboard_snapshots( + + aid=aid, + + dashboard_id=dashboard_id, + + cursor=cursor, + + _headers=self.te_headers("get_dashboard_snapshots", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_dashboard_snapshot_expiration_date_happy_path(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date success path""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + response = self.api.update_dashboard_snapshot_expiration_date_with_http_info( + + snapshot_id=snapshot_id, + + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + + aid=aid, + + _headers=self.te_headers("update_dashboard_snapshot_expiration_date"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_update_dashboard_snapshot_expiration_date_error_400(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 400)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.update_dashboard_snapshot_expiration_date( + + snapshot_id=snapshot_id, + + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + + aid=aid, + + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_snapshot_expiration_date_error_401(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 401)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.update_dashboard_snapshot_expiration_date( + + snapshot_id=snapshot_id, + + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + + aid=aid, + + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_snapshot_expiration_date_error_403(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 403)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.update_dashboard_snapshot_expiration_date( + + snapshot_id=snapshot_id, + + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + + aid=aid, + + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_snapshot_expiration_date_error_404(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 404)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.update_dashboard_snapshot_expiration_date( + + snapshot_id=snapshot_id, + + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + + aid=aid, + + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_snapshot_expiration_date_error_429(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 429)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.update_dashboard_snapshot_expiration_date( + + snapshot_id=snapshot_id, + + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + + aid=aid, + + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_snapshot_expiration_date_error_500(self) -> None: + """Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 500)""" + request_body_json = """ + + { + "snapshotExpirationDate" : "2023-05-16T10:14:28Z", + "expirationDate" : "2023-05-16 10:14:28" + } + + """ + update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json) + snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.update_dashboard_snapshot_expiration_date( + + snapshot_id=snapshot_id, + + update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request, + + aid=aid, + + _headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py b/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py new file mode 100644 index 00000000..c2ff1ea4 --- /dev/null +++ b/thousandeyes-sdk-dashboards/test/test_dashboards_api_integration.py @@ -0,0 +1,5101 @@ +# coding: utf-8 + +""" + Dashboards API + + Manage ThousandEyes Dashboards. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.dashboards.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.dashboards.api.dashboards_api import DashboardsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestDashboardsApiIntegration(IntegrationTestBase): + """DashboardsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = DashboardsApi(self.api_client) + + + def test_create_dashboard_happy_path(self) -> None: + """Integration test for create_dashboard success path""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_dashboard( + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("create_dashboard"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_dashboard_error_400(self) -> None: + """Integration test for create_dashboard error path (HTTP 400)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.create_dashboard( + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("create_dashboard", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_error_401(self) -> None: + """Integration test for create_dashboard error path (HTTP 401)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.create_dashboard( + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("create_dashboard", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_error_403(self) -> None: + """Integration test for create_dashboard error path (HTTP 403)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.create_dashboard( + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("create_dashboard", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_error_404(self) -> None: + """Integration test for create_dashboard error path (HTTP 404)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.create_dashboard( + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("create_dashboard", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_error_429(self) -> None: + """Integration test for create_dashboard error path (HTTP 429)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.create_dashboard( + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("create_dashboard", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_dashboard_error_500(self) -> None: + """Integration test for create_dashboard error path (HTTP 500)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.create_dashboard( + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("create_dashboard", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_dashboard_happy_path(self) -> None: + """Integration test for delete_dashboard success path""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + response = self.api.delete_dashboard_with_http_info( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_dashboard_error_400(self) -> None: + """Integration test for delete_dashboard error path (HTTP 400)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.delete_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_error_401(self) -> None: + """Integration test for delete_dashboard error path (HTTP 401)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.delete_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_error_403(self) -> None: + """Integration test for delete_dashboard error path (HTTP 403)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.delete_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_error_404(self) -> None: + """Integration test for delete_dashboard error path (HTTP 404)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.delete_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_error_429(self) -> None: + """Integration test for delete_dashboard error path (HTTP 429)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.delete_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_dashboard_error_500(self) -> None: + """Integration test for delete_dashboard error path (HTTP 500)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.delete_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("delete_dashboard", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboard_happy_path(self) -> None: + """Integration test for get_dashboard success path""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + response_body_json = """ + { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_dashboard_error_400(self) -> None: + """Integration test for get_dashboard error path (HTTP 400)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.get_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_error_401(self) -> None: + """Integration test for get_dashboard error path (HTTP 401)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.get_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_error_403(self) -> None: + """Integration test for get_dashboard error path (HTTP 403)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_error_404(self) -> None: + """Integration test for get_dashboard error path (HTTP 404)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_error_429(self) -> None: + """Integration test for get_dashboard error path (HTTP 429)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_dashboard_error_500(self) -> None: + """Integration test for get_dashboard error path (HTTP 500)""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_dashboard( + + dashboard_id=dashboard_id, + + aid=aid, + + _headers=self.te_headers("get_dashboard", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_dashboard_widget_data_happy_path(self) -> None: + """Integration test for get_dashboard_widget_data success path""" + dashboard_id = '646f4d2ce3c99b0536c3821e' + widget_id = 'unpmg' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 10 + cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' + sort = 'alertStatus' + response_body_json = """ + { + "groupLabels" : [ { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + }, { + "groupProperty" : "AGENT", + "groupLabels" : [ { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + }, { + "groupId" : "2565", + "groupLabel" : "San Francisco, CA" + } ] + } ], + "data" : { + "alerts" : [ { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + }, { + "alertType" : "network-end-to-end-server", + "durationInSeconds" : 25, + "alertSource" : "Http Test", + "active" : true, + "testId" : "56512", + "startTime" : "2023-06-02T08:54:00Z", + "alertId" : "2004945", + "ruleId" : "281724", + "alertRule" : "Http Test Rule" + } ], + "summary" : { + "offline" : 2, + "online" : 10, + "disabled" : 3 + }, + "totalAlerts" : 500, + "cards" : [ { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + }, { + "numberOfDataPoints" : 24192, + "cardName" : "Card Name", + "endDate" : "2023-05-16T10:14:28Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "cardId" : "lrxxr", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "previousValue" : 500, + "value" : 100, + "startDate" : "2023-05-16T10:14:28Z", + "timestamp" : 1567620000, + "status" : "No data" + } ], + "tests" : [ { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + }, { + "graphlets" : [ { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + }, { + "metric" : "Availability", + "testId" : "68257", + "points" : [ { + "x" : 1580403900, + "y" : 128.249 + }, { + "x" : 1580403900, + "y" : 128.249 + } ] + } ], + "alertCount" : 398, + "testType" : "Web - HTTP Server", + "testId" : "68256", + "isShared" : true, + "testName" : "Http Test Name", + "target" : "www.google.com" + } ], + "columns" : [ { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + }, { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "columnId" : "938to", + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "binSize" : 3600, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "status" : "No data" + } ], + "alertSuppressionWindows" : [ { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + }, { + "testIds" : [ "281474976710661" ], + "repeatUnit" : "week", + "durationInSeconds" : 7200, + "repeat" : "custom", + "name" : "Test dashboards", + "repeatEvery" : 5, + "id" : "281474976710662", + "startTimes" : [ "2023-05-16T10:14:28Z" ] + } ], + "activeAlerts" : 483, + "startRound" : 1384309800, + "points" : [ { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + }, { + "numberOfDataPoints" : 23304, + "groups" : [ { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + }, { + "groupProperty" : "COUNTRY", + "groupValue" : "US" + } ], + "value" : 100, + "timestamp" : 1567620000 + } ], + "agents" : [ { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + }, { + "agentId" : "6522", + "agentName" : "0c3898000117", + "location" : { + "locationName" : "San Francisco, California, US", + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "ipInfo" : { + "ipv6" : "ipv6", + "privateIp" : "172.58.92.31", + "operativeSystemVersion" : "operativeSystemVersion", + "publicIp" : "172.58.92.31" + }, + "status" : "online" + } ], + "status" : "No data" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "binSize" : 3600, + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboard_widget_data( + + dashboard_id=dashboard_id, + + widget_id=widget_id, + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + max=max, + + cursor=cursor, + + sort=sort, + + _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", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + }, { + "isMigratedReport" : false, + "dashboardCreatedBy" : "1", + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "modifiedBy" : 1, + "dashboardModifiedBy" : "1", + "migratedReport" : false, + "isDefaultForAccount" : false, + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "accountId" : 1234, + "apiLink" : [ { + "key" : "" + }, { + "key" : "" + } ], + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : 1, + "globalOverride" : true, + "modifiedDate" : "2023-05-16 10:14:28", + "isGlobalOverride" : true, + "aid" : "1234", + "dashboardModifiedDate" : "2023-05-16T10:14:28Z" + } ] + """ + expected_response = json.loads(response_body_json) + response = self.api.get_dashboards( + + aid=aid, + + _headers=self.te_headers("get_dashboards"), + ) + 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", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + response_body_json = """ + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_dashboard( + + dashboard_id=dashboard_id, + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("update_dashboard"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_dashboard_error_400(self) -> None: + """Integration test for update_dashboard error path (HTTP 400)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.update_dashboard( + + dashboard_id=dashboard_id, + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("update_dashboard", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_error_401(self) -> None: + """Integration test for update_dashboard error path (HTTP 401)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.update_dashboard( + + dashboard_id=dashboard_id, + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("update_dashboard", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_error_403(self) -> None: + """Integration test for update_dashboard error path (HTTP 403)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.update_dashboard( + + dashboard_id=dashboard_id, + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("update_dashboard", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_error_404(self) -> None: + """Integration test for update_dashboard error path (HTTP 404)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.update_dashboard( + + dashboard_id=dashboard_id, + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("update_dashboard", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_error_429(self) -> None: + """Integration test for update_dashboard error path (HTTP 429)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.update_dashboard( + + dashboard_id=dashboard_id, + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("update_dashboard", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_dashboard_error_500(self) -> None: + """Integration test for update_dashboard error path (HTTP 500)""" + request_body_json = """ + + { + "isMigratedReport" : false, + "_links" : { + "snapshots" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isDefaultForAccount" : false, + "isDefaultForUser" : true, + "description" : "HTTP Server Widgets", + "isPrivate" : true, + "title" : "HTTP Server Widgets", + "isBuiltIn" : true, + "widgets" : [ { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + }, { + "embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f", + "shouldExcludeAlertSuppressionWindows" : true, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "visualMode" : "Full", + "filters" : { + "TEST" : [ 5187, 5227 ], + "ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ] + }, + "title" : "Widget Title", + "type" : "Agent Status", + "metricGroup" : "BGP", + "measure" : { + "percentileValue" : 95, + "type" : "MEAN" + }, + "apiLink" : "apiLink", + "metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT", + "isEmbedded" : true, + "id" : "1234", + "fixedTimespan" : { + "unit" : "Days", + "value" : 10 + }, + "dataSource" : "ENDPOINT_AGENTS", + "direction" : "FROM_TARGET" + } ], + "defaultTimespan" : { + "duration" : 7200, + "timespanDuration" : 7200, + "start" : "2023-05-16T10:14:28Z", + "end" : "2023-05-16T11:14:28Z", + "timespanStart" : "2023-05-16 10:14:28", + "timespanEnd" : "2023-05-16 11:14:28" + }, + "layout" : { + "layoutId" : "grid-layout-1", + "type" : "grid", + "details" : { + "widgetPositioning" : [ { + "x" : 0, + "y" : 0, + "w" : 9, + "h" : 5, + "id" : "widgetId-71lbb" + } ] + } + }, + "globalFilterId" : "65babd9bb90bf55b17c96c8d", + "dashboardId" : "5e1f7a99143ae6004fdc3bb4", + "createdBy" : "1", + "modifiedDate" : "2023-05-16T10:14:28Z", + "modifiedBy" : "1", + "isGlobalOverride" : true, + "aid" : "1234" + } + + """ + dashboard = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json) + dashboard_id = '646f4d2ce3c99b0536c3821e' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.update_dashboard( + + dashboard_id=dashboard_id, + + dashboard=dashboard, + + aid=aid, + + _headers=self.te_headers("update_dashboard", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py b/thousandeyes-sdk-dashboards/test/test_dashboards_filters_api_integration.py new file mode 100644 index 00000000..eb0562ad --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-dashboards/test/test_utils.py +++ b/thousandeyes-sdk-dashboards/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-emulation/.openapi-generator/FILES b/thousandeyes-sdk-emulation/.openapi-generator/FILES index 90ceb9ec..1eff3689 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 5ff2780f..fa471a9b 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.97 - 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 c490779b..66ddbaf0 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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-emulation/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-emulation/test/integration_test_utils.py b/thousandeyes-sdk-emulation/test/integration_test_utils.py new file mode 100644 index 00000000..4b2b0465 --- /dev/null +++ b/thousandeyes-sdk-emulation/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Emulation API + + **Note:** All Emulation APIs are not available for ThousandEyes for Government instance. The Emulation API facilitates the retrieval of user-agent strings for HTTP, pageload, and transaction tests. It also enables the retrieval and addition of emulated devices for pageload and transaction tests. To access Emulation API operations, the following permissions are required: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-emulation/test/mock_manifest.py b/thousandeyes-sdk-emulation/test/mock_manifest.py new file mode 100644 index 00000000..395e0ebb --- /dev/null +++ b/thousandeyes-sdk-emulation/test/mock_manifest.py @@ -0,0 +1,340 @@ +# coding: utf-8 + +""" + Emulation API + + **Note:** All Emulation APIs are not available for ThousandEyes for Government instance. The Emulation API facilitates the retrieval of user-agent strings for HTTP, pageload, and transaction tests. It also enables the retrieval and addition of emulated devices for pageload and transaction tests. To access Emulation API operations, the following permissions are required: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_emulated_device": OperationExpectation( + operation_id="create_emulated_device", + method="POST", + path="/emulated-devices", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ], + "width" : 1024, + "name" : "iPad Pro 12.9-in", + "codeName" : "IPAD_PRO_12_9", + "id" : "11", + "category" : "desktop", + "defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0", + "height" : 768 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "width" : 1024, + "category" : "desktop", + "height" : 768 + } + + """), + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_emulated_devices": OperationExpectation( + operation_id="get_emulated_devices", + method="GET", + path="/emulated-devices", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "emulatedDevices" : [ { + "availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ], + "width" : 1024, + "name" : "iPad Pro 12.9-in", + "codeName" : "IPAD_PRO_12_9", + "id" : "11", + "category" : "desktop", + "defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0", + "height" : 768 + }, { + "availableUserAgents" : [ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36" ], + "width" : 1024, + "name" : "iPad Pro 12.9-in", + "codeName" : "IPAD_PRO_12_9", + "id" : "11", + "category" : "desktop", + "defaultUserAgentTemplate" : "Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0", + "height" : 768 + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_user_agents": OperationExpectation( + operation_id="get_user_agents", + method="GET", + path="/user-agents", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "userAgents" : [ { + "os" : "Windows", + "browser" : "Firefox", + "value" : "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36" + }, { + "os" : "Windows", + "browser" : "Firefox", + "value" : "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Mobile Safari/537.36" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-emulation/test/test_emulation_api_integration.py b/thousandeyes-sdk-emulation/test/test_emulation_api_integration.py new file mode 100644 index 00000000..4dee7203 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-emulation/test/test_utils.py +++ b/thousandeyes-sdk-emulation/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-endpoint-agents/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-agents/.openapi-generator/FILES index 5ca2c26f..4fc8376d 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 a0de7de6..3e3f31b3 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.97 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator diff --git a/thousandeyes-sdk-endpoint-agents/docs/EndpointAgentsApi.md b/thousandeyes-sdk-endpoint-agents/docs/EndpointAgentsApi.md index 288c8d11..e4c20a38 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 563ad6b8..2fd3fdd8 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/test/conftest.py b/thousandeyes-sdk-endpoint-agents/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-endpoint-agents/test/integration_test_utils.py b/thousandeyes-sdk-endpoint-agents/test/integration_test_utils.py new file mode 100644 index 00000000..494f9642 --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Endpoint Agents API + + **Note:** The Endpoint Agents Transfer APIs are not available for ThousandEyes for Government instance. Manage ThousandEyes Endpoint Agents using this API. For more information about Endpoint Agents, see [Endpoint Agents](https://docs.thousandeyes.com/product-documentation/global-vantage-points/endpoint-agents). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-endpoint-agents/test/mock_manifest.py b/thousandeyes-sdk-endpoint-agents/test/mock_manifest.py new file mode 100644 index 00000000..6ddba81c --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/mock_manifest.py @@ -0,0 +1,2514 @@ +# coding: utf-8 + +""" + Endpoint Agents API + + **Note:** The Endpoint Agents Transfer APIs are not available for ThousandEyes for Government instance. Manage ThousandEyes Endpoint Agents using this API. For more information about Endpoint Agents, see [Endpoint Agents](https://docs.thousandeyes.com/product-documentation/global-vantage-points/endpoint-agents). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "get_endpoint_agent_log_items": OperationExpectation( + operation_id="get_endpoint_agent_log_items", + method="GET", + path="/endpoint/agents/{agentId}/logs", + path_param_examples={ + "agentId": 'agent_id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "logs" : [ { + "wifiLogItem" : { + "bssidFrom" : "00:11:22:33:44:54", + "bssid" : "00:11:22:33:44:55", + "failure" : { + "code" : 4, + "context" : "WPA authentication failed", + "type" : "auth" + }, + "logItemType" : "wifi-connect", + "channel" : "36", + "physicalMode" : "802.11ac", + "physicalModeFrom" : "802.11n", + "ssid" : "CorpWiFi", + "channelFrom" : "11" + }, + "agentLogItemType" : "wifi", + "onlineOfflineLogItem" : { + "logItemType" : "online" + }, + "id" : "8d23f1b7-74ef-4e0c-925c-58601fc0662d", + "vpnLogItem" : { + "logItemType" : "vpn-connect", + "vpnServerName" : "vpn-us-west", + "vpnType" : "cisco-anyconnect", + "vpnServerAddress" : "192.0.2.10" + }, + "stateChangesLogItem" : { + "logItemType" : "enabled" + }, + "timestampMs" : 1709240000000 + }, { + "wifiLogItem" : { + "bssidFrom" : "00:11:22:33:44:54", + "bssid" : "00:11:22:33:44:55", + "failure" : { + "code" : 4, + "context" : "WPA authentication failed", + "type" : "auth" + }, + "logItemType" : "wifi-connect", + "channel" : "36", + "physicalMode" : "802.11ac", + "physicalModeFrom" : "802.11n", + "ssid" : "CorpWiFi", + "channelFrom" : "11" + }, + "agentLogItemType" : "wifi", + "onlineOfflineLogItem" : { + "logItemType" : "online" + }, + "id" : "8d23f1b7-74ef-4e0c-925c-58601fc0662d", + "vpnLogItem" : { + "logItemType" : "vpn-connect", + "vpnServerName" : "vpn-us-west", + "vpnType" : "cisco-anyconnect", + "vpnServerAddress" : "192.0.2.10" + }, + "stateChangesLogItem" : { + "logItemType" : "enabled" + }, + "timestampMs" : 1709240000000 + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_endpoint_agent": OperationExpectation( + operation_id="delete_endpoint_agent", + method="DELETE", + path="/endpoint/agents/{agentId}", + path_param_examples={ + "agentId": 'agent_id_example', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "disable_endpoint_agent": OperationExpectation( + operation_id="disable_endpoint_agent", + method="POST", + path="/endpoint/agents/{agentId}/disable", + path_param_examples={ + "agentId": 'agent_id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "enable_endpoint_agent": OperationExpectation( + operation_id="enable_endpoint_agent", + method="POST", + path="/endpoint/agents/{agentId}/enable", + path_param_examples={ + "agentId": 'agent_id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_endpoint_agents": OperationExpectation( + operation_id="filter_endpoint_agents", + method="POST", + path="/endpoint/agents/filter", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "totalAgents" : 1, + "agents" : [ { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + }, { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "platform", + "order" : "desc" + }, { + "sort" : "platform", + "order" : "desc" + } ], + "searchFilters" : { + "serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ], + "anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ], + "agentName" : [ "myagent-1234", "myagent-1234" ], + "locationSubdivision1Code" : [ "ENG", "ENG" ], + "platform" : [ "mac", "mac" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_endpoint_agent": OperationExpectation( + operation_id="get_endpoint_agent", + method="GET", + path="/endpoint/agents/{agentId}", + path_param_examples={ + "agentId": 'agent_id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_endpoint_agents": OperationExpectation( + operation_id="get_endpoint_agents", + method="GET", + path="/endpoint/agents", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "totalAgents" : 1, + "agents" : [ { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + }, { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_endpoint_agents_connection_string": OperationExpectation( + operation_id="get_endpoint_agents_connection_string", + method="GET", + path="/endpoint/agents/connection-string", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "connectionString" : "D2xZSLlqo64Xe2EnYisklA==", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_endpoint_agent": OperationExpectation( + operation_id="update_endpoint_agent", + method="PATCH", + path="/endpoint/agents/{agentId}", + path_param_examples={ + "agentId": 'agent_id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "npcapVersion" : "npcapVersion", + "asnDetails" : { + "asName" : "Virgin Media Limited", + "asNumber" : 5089 + }, + "clients" : [ { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + }, { + "browserExtensions" : [ { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + }, { + "browser" : "edge", + "profile" : "Profile 1", + "active" : true, + "error" : "", + "version" : "0.123.0", + "enabled" : true + } ], + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + } + } ], + "agentType" : "endpoint", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "publicIP" : "88.45.2.123", + "tcpDriverAvailable" : true, + "platform" : "mac", + "manufacturer" : "Apple, Inc.", + "targetVersion" : "0.123.4", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "nicModel" : "Intel(R) Wi-Fi 6 AX200 160MHz", + "createdAt" : "2022-05-26T23:37:16Z", + "numberOfClients" : 3, + "licenseType" : "essentials", + "osVersion" : "Version 10.15.2 (Build 19C57)", + "computerName" : "DESKJET-123", + "freeDiskSpaceNormalized" : 0.41, + "model" : "MacBookAir7,2", + "id" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "nicDriverVersion" : "22.250.0.9", + "serialNumber" : "xaab2ba4-d40f-4e80-9363-7e4826556055", + "externalMetadata" : [ { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + }, { + "key" : "anyConnectDeviceId", + "value" : "DF434343D" + } ], + "version" : "0.123.4", + "vpnProfiles" : [ { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + }, { + "vpnClientNetworkRange" : [ "10.100.0.0/22" ], + "vpnGatewayAddress" : "vpnGatewayAddress", + "vpnType" : "cisco-anyconnect", + "interfaceName" : "interfaceName", + "vpnClientAddresses" : [ "10.100.0.10" ] + } ], + "lastSeen" : "2022-05-26T23:37:16Z", + "deleted" : true, + "totalMemory" : "16384 MB", + "kernelVersion" : "Darwin 19.2.0", + "name" : "Office Printer", + "location" : { + "locationName" : "London", + "latitude" : 51.51279, + "longitude" : -0.09184 + }, + "aid" : "", + "status" : "enabled", + "networkInterfaceProfiles" : [ { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + }, { + "ethernetProfile" : { + "linkSpeed" : 0 + }, + "hardwareType" : "wireless", + "interfaceName" : "en0", + "addressProfiles" : [ { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + }, { + "prefixLength" : 24, + "addressType" : "unique-local", + "ipAddress" : "2001:db8:3333:4444:5555:6666:7777:8888", + "routerHardwareAddress" : "5c:b1:3e:46:1c:84", + "gateway" : "192.168.0.254" + } ], + "wirelessProfile" : { + "rssi" : -36, + "bssid" : "00:11:22:aa:bb:cc", + "channel" : 48, + "phyMode" : "802.11ac", + "ssid" : "GuestWiFi" + } + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "licenseType" : "essentials", + "name" : "Office Printer" + } + + """), + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "transfer_endpoint_agents": OperationExpectation( + operation_id="transfer_endpoint_agents", + method="POST", + path="/endpoint/agents/transfer/bulk", + path_param_examples={ + }, + success_status=207, + success_body=json.loads(""" + + { + "items" : [ { + "status" : 200, + "detail" : "Initiated", + "request" : { + "agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba", + "fromAid" : "1234", + "toAid" : "12345" + } + }, { + "status" : 400, + "detail" : "Missing from-account id", + "request" : { + "agentId" : "5d0764ac-7e42-4ec8-a0d5-39fc53ed1234", + "fromAid" : "xxx", + "toAid" : "12345" + } + }, { + "status" : 403, + "detail" : "User does not have permission on 'to' aid", + "request" : { + "agentId" : "5d0764ac-7e42-4ec8-a0d5-39fc53ed7890", + "fromAid" : "1234", + "toAid" : "12345" + } + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "transfers" : [ { + "agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba", + "fromAid" : "1234", + "toAid" : "12345" + }, { + "agentId" : "5d0764ac-7e42-4ec8-a0d4-39fc53edccba", + "fromAid" : "1234", + "toAid" : "12345" + } ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_endpoint_proxies": OperationExpectation( + operation_id="get_endpoint_proxies", + method="GET", + path="/endpoint/proxies", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "proxies" : [ { + "testIds" : [ "9923667", "9923667" ], + "agentIds" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "pac" : "https://example.com/proxy.pac", + "port" : 8080, + "name" : "Local Mitmproxy", + "host" : "localhost", + "type" : "static", + "userName" : "endpoint-proxy-user", + "authType" : "none", + "bypassList" : "localhost,127.0.0.1", + "proxyId" : "101498" + }, { + "testIds" : [ "9923667", "9923667" ], + "agentIds" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "pac" : "https://example.com/proxy.pac", + "port" : 8080, + "name" : "Local Mitmproxy", + "host" : "localhost", + "type" : "static", + "userName" : "endpoint-proxy-user", + "authType" : "none", + "bypassList" : "localhost,127.0.0.1", + "proxyId" : "101498" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agent_log_items_api_integration.py new file mode 100644 index 00000000..d48de450 --- /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_integration.py b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py new file mode 100644 index 00000000..9fa0ce7c --- /dev/null +++ b/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_api_integration.py @@ -0,0 +1,2874 @@ +# 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" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """ + agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json) + max = 5 + cursor = 'cursor_example' + aid = '1234' + 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" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """ + agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json) + max = 5 + cursor = 'cursor_example' + aid = '1234' + 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" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """ + agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json) + max = 5 + cursor = 'cursor_example' + aid = '1234' + 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" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """ + agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json) + max = 5 + cursor = 'cursor_example' + aid = '1234' + 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" ], + "licenseType" : [ "essentials", "essentials" ], + "osVersion" : [ "Version 10.15.2", "Version 10.15.2" ], + "computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ], + "locationCountryISO" : [ "FR", "FR" ], + "id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ], + "userPrincipalName" : [ "picard@c.com" ], + "locationCity" : [ "Paris", "Paris" ], + "username" : [ "picard" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + }, { + "name" : "last-seen-ms", + "value" : 0.8008281904610115, + "operator" : "gte" + } ] + } + } + + """ + agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json) + max = 5 + cursor = 'cursor_example' + aid = '1234' + 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 00000000..7203b700 --- /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 00000000..b1afd0b0 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-endpoint-agents/test/test_utils.py +++ b/thousandeyes-sdk-endpoint-agents/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-endpoint-instant-tests/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-instant-tests/.openapi-generator/FILES index 16b3c390..128c9d24 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 3319bba8..35f8bc06 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.97 - 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 05378949..cecacb9b 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 bb3ce1aa..a733568b 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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/integration_test_utils.py b/thousandeyes-sdk-endpoint-instant-tests/test/integration_test_utils.py new file mode 100644 index 00000000..fe6515fb --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Endpoint Instant Scheduled Tests API + + You can create and execute a new endpoint instant scheduled test within ThousandEyes using this API. The test parameters are specified in the `POST` data. The following applies to the Endpoint Instant Scheduled Tests API: * To initiate the creation and execution of an instant scheduled test, the user must possess the `Edit endpoint tests` permission. * Upon successful creation of an instant scheduled test, the API responds with an HTTP/201 CREATED status code and return the test definition. * It's important to note that the response does not include the results of the instant scheduled test. To retrieve test results, users can utilize the Endpoint Test Data endpoints. The URLs for these API test data endpoints are provided within the test definition output when an instant scheduled test is created. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/mock_manifest.py b/thousandeyes-sdk-endpoint-instant-tests/test/mock_manifest.py new file mode 100644 index 00000000..dffd1438 --- /dev/null +++ b/thousandeyes-sdk-endpoint-instant-tests/test/mock_manifest.py @@ -0,0 +1,499 @@ +# coding: utf-8 + +""" + Endpoint Instant Scheduled Tests API + + You can create and execute a new endpoint instant scheduled test within ThousandEyes using this API. The test parameters are specified in the `POST` data. The following applies to the Endpoint Instant Scheduled Tests API: * To initiate the creation and execution of an instant scheduled test, the user must possess the `Edit endpoint tests` permission. * Upon successful creation of an instant scheduled test, the API responds with an HTTP/201 CREATED status code and return the test definition. * It's important to note that the response does not include the results of the instant scheduled test. To retrieve test results, users can utilize the Endpoint Test Data endpoints. The URLs for these API test data endpoints are provided within the test definition output when an instant scheduled test is created. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_agent_to_server_scheduled_instant_test": OperationExpectation( + operation_id="create_agent_to_server_scheduled_instant_test", + method="POST", + path="/endpoint/tests/scheduled-tests/agent-to-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "server" : "www.example.com", + "isSavedEvent" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "type" : "agent-to-server", + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "server" : "www.example.com", + "ipVersion" : "V4_ONLY", + "port" : 443, + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "serverName" : "www.example.com", + "endpointAgentLabels" : [ "567", "214" ], + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "testName" : "Test name" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_http_server_scheduled_instant_test": OperationExpectation( + operation_id="create_http_server_scheduled_instant_test", + method="POST", + path="/endpoint/tests/scheduled-tests/http-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "server" : "www.example.com", + "isSavedEvent" : false, + "sslVersion" : "Auto", + "useNtlm" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "httpTimeLimit" : 5000, + "type" : "http-server", + "protocol" : "icmp", + "httpVersion" : 2, + "followRedirects" : true, + "authType" : "none", + "testName" : "Test name", + "verifyCertificate" : true, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "verifyCertificate" : true, + "hasPing" : true, + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "httpTimeLimit" : 5000, + "networkMeasurements" : true, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "password" : "password", + "ipVersion" : "V4_ONLY", + "hasTraceroute" : true, + "targetResponseTime" : 1000, + "authType" : "none", + "hasPathTraceInSession" : true, + "testName" : "Test name", + "username" : "username", + "sslVersionId" : "0" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "run_endpoint_scheduled_instant_test": OperationExpectation( + operation_id="run_endpoint_scheduled_instant_test", + method="POST", + path="/endpoint/tests/scheduled-tests/{testId}/run", + path_param_examples={ + "testId": '765231567', + }, + success_status=200, + success_body=json.loads(""" + + { + "message" : "Successfully reran the instant scheduled test with testId=765231567" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py b/thousandeyes-sdk-endpoint-instant-tests/test/test_agent_to_server_endpoint_instant_scheduled_tests_api_integration.py new file mode 100644 index 00000000..9f16a4ce --- /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 00000000..5a328fba --- /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 00000000..afb8fb88 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-endpoint-instant-tests/test/test_utils.py +++ b/thousandeyes-sdk-endpoint-instant-tests/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-endpoint-labels/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-labels/.openapi-generator/FILES index f52a61d0..91c48b73 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 7db048ab..06356d8b 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.97 - 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 0b1da4da..0711e149 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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-endpoint-labels/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-endpoint-labels/test/integration_test_utils.py b/thousandeyes-sdk-endpoint-labels/test/integration_test_utils.py new file mode 100644 index 00000000..19d6418c --- /dev/null +++ b/thousandeyes-sdk-endpoint-labels/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Endpoint Agent Labels API + + Manage labels applied to endpoint agents using this API. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-endpoint-labels/test/mock_manifest.py b/thousandeyes-sdk-endpoint-labels/test/mock_manifest.py new file mode 100644 index 00000000..0174c17a --- /dev/null +++ b/thousandeyes-sdk-endpoint-labels/test/mock_manifest.py @@ -0,0 +1,575 @@ +# coding: utf-8 + +""" + Endpoint Agent Labels API + + Manage labels applied to endpoint agents using this API. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_endpoint_label": OperationExpectation( + operation_id="create_endpoint_label", + method="POST", + path="/endpoint/labels", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "color" : "#ff3333", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "name" : "Head office meeting rooms", + "id" : "abc-123-def", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "color" : "#ff3333", + "matchType" : "and", + "name" : "Head office meeting rooms", + "id" : "abc-123-def", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + } ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_endpoint_label": OperationExpectation( + operation_id="delete_endpoint_label", + method="DELETE", + path="/endpoint/labels/{id}", + path_param_examples={ + "id": 'id_example', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_endpoint_label": OperationExpectation( + operation_id="get_endpoint_label", + method="GET", + path="/endpoint/labels/{id}", + path_param_examples={ + "id": 'id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "color" : "#ff3333", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "name" : "Head office meeting rooms", + "id" : "abc-123-def", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_endpoint_labels": OperationExpectation( + operation_id="get_endpoint_labels", + method="GET", + path="/endpoint/labels", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "labels" : [ { + "color" : "#ff3333", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "name" : "Head office meeting rooms", + "id" : "abc-123-def", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + } ] + }, { + "color" : "#ff3333", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "name" : "Head office meeting rooms", + "id" : "abc-123-def", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + } ] + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_endpoint_label": OperationExpectation( + operation_id="update_endpoint_label", + method="PATCH", + path="/endpoint/labels/{id}", + path_param_examples={ + "id": 'id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "color" : "#ff3333", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "name" : "Head office meeting rooms", + "id" : "abc-123-def", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "color" : "#ff3333", + "matchType" : "and", + "name" : "Head office meeting rooms", + "id" : "abc-123-def", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "key" : "vpn-client-network" + } ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py b/thousandeyes-sdk-endpoint-labels/test/test_endpoint_agent_labels_api_integration.py new file mode 100644 index 00000000..ed40b1b1 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-endpoint-labels/test/test_utils.py +++ b/thousandeyes-sdk-endpoint-labels/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-endpoint-test-results/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-test-results/.openapi-generator/FILES index 7dc3f49d..1f08e383 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 9295d428..0e2f5003 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.97 - 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/HTTPServerEndpointScheduledTestResultsApi.md b/thousandeyes-sdk-endpoint-test-results/docs/HTTPServerEndpointScheduledTestResultsApi.md index 7bfe8d68..25cd6375 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/LocalNetworkEndpointTestResultsApi.md b/thousandeyes-sdk-endpoint-test-results/docs/LocalNetworkEndpointTestResultsApi.md index e323333f..ef8171df 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/NetworkDynamicEndpointTestResultsApi.md b/thousandeyes-sdk-endpoint-test-results/docs/NetworkDynamicEndpointTestResultsApi.md index 5aeb2256..be13b54a 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 9757346b..39165745 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/RealUserEndpointTestResultsApi.md b/thousandeyes-sdk-endpoint-test-results/docs/RealUserEndpointTestResultsApi.md index 40c3c3ee..3f2d526d 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/test/conftest.py b/thousandeyes-sdk-endpoint-test-results/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-endpoint-test-results/test/integration_test_utils.py b/thousandeyes-sdk-endpoint-test-results/test/integration_test_utils.py new file mode 100644 index 00000000..5565044a --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Endpoint Test Results API + + Retrieve results for scheduled and dynamic tests on endpoint agents. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-endpoint-test-results/test/mock_manifest.py b/thousandeyes-sdk-endpoint-test-results/test/mock_manifest.py new file mode 100644 index 00000000..e8e13b7f --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/mock_manifest.py @@ -0,0 +1,7512 @@ +# coding: utf-8 + +""" + Endpoint Test Results API + + Retrieve results for scheduled and dynamic tests on endpoint agents. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "get_http_server_scheduled_test_results": OperationExpectation( + operation_id="get_http_server_scheduled_test_results", + method="GET", + path="/endpoint/test-results/scheduled-tests/{testId}/http-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "server" : "www.example.com", + "isSavedEvent" : false, + "sslVersion" : "Auto", + "useNtlm" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "httpTimeLimit" : 5000, + "type" : "http-server", + "protocol" : "icmp", + "httpVersion" : 2, + "followRedirects" : true, + "authType" : "none", + "testName" : "Test name", + "verifyCertificate" : true, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" + }, + "totalHits" : 12, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_multi_test_filtered_http_server_scheduled_test_results": OperationExpectation( + operation_id="get_multi_test_filtered_http_server_scheduled_test_results", + method="POST", + path="/endpoint/test-results/scheduled-tests/http-server/filter", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "totalHits" : 12, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_single_test_filtered_http_server_scheduled_test_results": OperationExpectation( + operation_id="get_single_test_filtered_http_server_scheduled_test_results", + method="POST", + path="/endpoint/test-results/scheduled-tests/{testId}/http-server/filter", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "totalHits" : 12, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "numRedirects" : 0, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "errorType" : "connect", + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "responseCode" : 200, + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "connectTime" : 2, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "throughput" : 190, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "redirectTime" : 10, + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "testId" : "584739201", + "sslTime" : 9, + "aid" : "1234", + "waitTime" : 3, + "errorDetails" : "errorDetails", + "wireSize" : 9993 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_local_networks_test_results_topologies": OperationExpectation( + operation_id="filter_local_networks_test_results_topologies", + method="POST", + path="/endpoint/test-results/local-networks/topologies/filter", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "target" : "10.0.2.2", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49", + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + } + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "target" : "10.0.2.2", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49", + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + } + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_local_networks_test_results": OperationExpectation( + operation_id="get_local_networks_test_results", + method="GET", + path="/endpoint/test-results/local-networks", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "localNetworks" : [ { + "publicIpRange" : "178.216.56.0-178.216.63.255", + "networkName" : "10.5.51.0 (in 178.216.56.0/21)", + "networkId" : "006c4fa7a054", + "localPrefix" : "10.5.51.0" + }, { + "publicIpRange" : "178.216.56.0-178.216.63.255", + "networkName" : "10.5.51.0 (in 178.216.56.0/21)", + "networkId" : "006c4fa7a054", + "localPrefix" : "10.5.51.0" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_local_networks_test_results_topology": OperationExpectation( + operation_id="get_local_networks_test_results_topology", + method="GET", + path="/endpoint/test-results/local-networks/topologies/{networkTopologyId}", + path_param_examples={ + "networkTopologyId": '00160:39c518560de9:1491651900:236e6f18', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "icmpTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "icmpTraceroutes" : [ { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + } ], + "target" : "10.0.2.2", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49" + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "dnsServerTest" : { + "resolutionTime" : 3 + }, + "vpnScore" : { + "score" : 100, + "quality" : "great" + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "type" : "vpn", + "targetPort" : 80, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "icmpTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "roundId" : 1384309800, + "agentScore" : { + "score" : 100, + "quality" : "great" + }, + "isIcmpBlocked" : true, + "gatewayScore" : { + "score" : 100, + "quality" : "great" + }, + "tcpConnect" : { + "rtt" : 77.777, + "errorCode" : "ERR_TIMED_OUT", + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "proxyScore" : { + "score" : 100, + "quality" : "great" + }, + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "icmpTraceroutes" : [ { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + } ], + "target" : "10.0.2.2", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "systemMetricDetails" : { + "topCpuApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ], + "topMemoryApplications" : [ { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + }, { + "totalMemoryBytes" : 1023334, + "processes" : [ { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + }, { + "memoryBytes" : 1023334, + "memoryPercentage" : 0.22, + "name" : "Webex background", + "cpu" : 0.5, + "pid" : 15632 + } ], + "totalCpu" : 0.5, + "name" : "Webex", + "totalMemoryPercentage" : 0.22 + } ] + }, + "connectionScore" : { + "score" : 100, + "quality" : "great" + }, + "icmpPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkTopologyId" : "00160:54c3a4b180c6:1490536500:c7a58c49" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_dynamic_test_network_results": OperationExpectation( + operation_id="filter_dynamic_test_network_results", + method="POST", + path="/endpoint/test-results/dynamic-tests/{testId}/network/filter", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + }, + "totalHits" : 12, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "protocol" : "tcp", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "roundId" : 1384309800, + "udpProbeMode" : "unknown", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "tcpProbeMode" : "auto", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "application" : "webex", + "serverIp" : "185.199.108.153", + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "errorDetails" : "Error" + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "protocol" : "tcp", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "roundId" : 1384309800, + "udpProbeMode" : "unknown", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "tcpProbeMode" : "auto", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "application" : "webex", + "serverIp" : "185.199.108.153", + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "errorDetails" : "Error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dynamic_test_path_vis_agent_round_results": OperationExpectation( + operation_id="get_dynamic_test_path_vis_agent_round_results", + method="GET", + path="/endpoint/test-results/dynamic-tests/{testId}/path-vis/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + }, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dynamic_test_path_vis_results": OperationExpectation( + operation_id="get_dynamic_test_path_vis_results", + method="GET", + path="/endpoint/test-results/dynamic-tests/{testId}/path-vis", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + }, + "endDate" : "2022-07-18T22:00:54Z", + "totalHits" : 12, + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "udpProbeMode" : "unknown", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "tcpProbeMode" : "auto", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "protocol" : "tcp", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "application" : "webex", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "webex" : { + "remoteSipSessionId" : "22581707460321454", + "localSipSessionId" : "c124ba2b012050008000aa0c26c4bf0f", + "conferenceId" : "225817074608419375", + "correlationId" : "4e57c97e-abdf-4ec8-a78c-95bac9719896", + "meetingApp" : "ZoomCRC" + }, + "aid" : "1234", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_scheduled_test_network_results": OperationExpectation( + operation_id="filter_scheduled_test_network_results", + method="POST", + path="/endpoint/test-results/scheduled-tests/{testId}/network/filter", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "server" : "www.example.com", + "isSavedEvent" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "type" : "agent-to-server", + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + }, + "totalHits" : 12, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_scheduled_tests_network_results": OperationExpectation( + operation_id="filter_scheduled_tests_network_results", + method="POST", + path="/endpoint/test-results/scheduled-tests/network/filter", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "totalHits" : 12, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "isIcmpBlocked" : true, + "avgLatency" : 167.04, + "minLatency" : 167, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "maxLatency" : 168, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "score" : { + "applicationScore" : 100, + "quality" : "great" + }, + "loss" : 0, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "jitter" : 0.076808, + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "ztaMetrics" : [ { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + }, { + "loss" : 50, + "jitter" : 5, + "avgLatency" : 3, + "errorMessage" : "ERR_NAME_NOT_RESOLVED", + "type" : "zta_service" + } ], + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800, + "errorDetails" : "Error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """), + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_scheduled_test_path_vis_agent_round_results": OperationExpectation( + operation_id="get_scheduled_test_path_vis_agent_round_results", + method="GET", + path="/endpoint/test-results/scheduled-tests/{testId}/path-vis/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "server" : "www.example.com", + "isSavedEvent" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "type" : "agent-to-server", + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + }, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "vpnPathTraces" : [ { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "udpPathTraceMode" : "unknown", + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "aid" : "1234", + "roundId" : 1384309800 + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_scheduled_test_path_vis_results": OperationExpectation( + operation_id="get_scheduled_test_path_vis_results", + method="GET", + path="/endpoint/test-results/scheduled-tests/{testId}/path-vis", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "server" : "www.example.com", + "isSavedEvent" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "type" : "agent-to-server", + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "aid" : "1234", + "roundId" : 1384309800 + }, { + "originalTargetProfile" : { + "protocol" : "tcp", + "remotePort" : 80, + "remoteIpAddress" : "120.98.134.7" + }, + "server" : "www.google.com:443", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "asnDetails" : { + "asName" : "ThousandEyes, Inc", + "asNumber" : 394101 + }, + "vpnProfile" : { + "vpnClientNetworkRange" : [ "9.88.37.27", "9.88.37.27" ], + "vpnGatewayAddress" : "120.98.134.7", + "vpnType" : "cisco-anyconnect", + "vpnClientAddresses" : [ "184.81.113.85", "13.129.91.62" ] + }, + "batteryMetrics" : { + "batteryHealthNormalizedPercent" : 0.92, + "batteryLevel" : "medium", + "batteryLevelNormalizedPercent" : 0.3 + }, + "sourcePrefix" : "196.40.96.0/20", + "userProfile" : { + "userName" : "joeblogs32", + "userPrincipalName" : "joeblogs32@c.com" + }, + "platform" : "mac", + "cellularProfile" : { + "rssi" : -10, + "advertisedNetworkSubtype" : "LTE/HSPA", + "carrierName" : "T-Mobile", + "rsrq" : -30, + "rsrp" : -30, + "advertisedNetworkGen" : "2g, 3g, 4g, 5g", + "rscp" : -30, + "networkGen" : "2g, 3g, 4g, 5g", + "networkSubtype" : "LTE/HSPA", + "sinr" : 20 + }, + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + }, { + "protocol" : "tcp", + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "udpPathTraceMode" : "unknown", + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "tcpPathTraceMode" : "syn-pcap" + } ], + "serverIp" : "185.199.108.153", + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "testId" : "584739201", + "location" : "San Francisco Area", + "aid" : "1234", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_real_user_tests_network_results": OperationExpectation( + operation_id="filter_real_user_tests_network_results", + method="POST", + path="/endpoint/test-results/real-user-tests/networks/filter", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "proxy" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "vpn" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "destination" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "proxy" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "vpn" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "destination" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_real_user_tests_results": OperationExpectation( + operation_id="filter_real_user_tests_results", + method="POST", + path="/endpoint/test-results/real-user-tests/filter", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "pageId" : "C31gBrYJ", + "protocol" : "https", + "numberOfPages" : 2, + "port" : 443, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "pageId" : "C31gBrYJ", + "protocol" : "https", + "numberOfPages" : 2, + "port" : 443, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_real_user_tests_visited_pages_results": OperationExpectation( + operation_id="filter_real_user_tests_visited_pages_results", + method="POST", + path="/endpoint/test-results/real-user-tests/pages/filter", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "responseTime" : 240, + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "id" : "07625:1490529480:aVDViw0i", + "pageId" : "C31gBrYJ", + "roundId" : 1384309800, + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + }, { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "responseTime" : 240, + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "id" : "07625:1490529480:aVDViw0i", + "pageId" : "C31gBrYJ", + "roundId" : 1384309800, + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_real_user_test_page_results": OperationExpectation( + operation_id="get_real_user_test_page_results", + method="GET", + path="/endpoint/test-results/real-user-tests/{id}/pages/{pageId}", + path_param_examples={ + "id": '07625:1490529480:h3qJQTpl', + "pageId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "har" : { + "log" : { + "browser" : { + "name" : "Google Chrome", + "version" : "57.0.2987.98" + }, + "creator" : { + "name" : "ThousandEyes Endpoint Agent", + "version" : "0.47.0" + }, + "entries" : [ { + "pageref" : "page_1", + "request" : { + "headers" : [ { + "name" : "Upgrade-Insecure-Requests", + "value" : "1" + }, { + "name" : "User-Agent", + "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" + }, { + "name" : "Accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" + }, { + "name" : "Referer", + "value" : "https://www.thousandeyes.com/" + }, { + "name" : "Accept-Encoding", + "value" : "gzip, deflate, sdch, br" + }, { + "name" : "Accept-Language", + "value" : "en-US,en;q=0.6" + }, { + "name" : "Cookie", + "value" : "(removed)" + } ], + "method" : "GET", + "queryString" : [ { + "name" : "locale", + "value" : "en-US" + } ], + "url" : "https://www.thousandeyes.com/resources" + }, + "response" : { + "bodySize" : 17776, + "content" : { + "mimeType" : "text/html;charset=ISO-8859-1", + "size" : 17776 + }, + "headers" : [ { + "name" : "Content-Type", + "value" : "text/html;charset=ISO-8859-1" + }, { + "name" : "Content-Length", + "value" : "17776" + }, { + "name" : "Connection", + "value" : "keep-alive" + }, { + "name" : "Date", + "value" : "Sun, 26 Mar 2017 11:58:54 GMT" + }, { + "name" : "Server", + "value" : "Apache" + }, { + "name" : "Cache-Control", + "value" : "max-age=600, must-revalidate" + }, { + "name" : "Content-Language", + "value" : "en-US" + }, { + "name" : "Content-Encoding", + "value" : "gzip" + }, { + "name" : "X-Frame-Options", + "value" : "sameorigin" + }, { + "name" : "Strict-Transport-Security", + "value" : "max-age=31536000" + }, { + "name" : "Vary", + "value" : "Accept-Encoding" + }, { + "name" : "X-Cache", + "value" : "Miss from cloudfront" + }, { + "name" : "Via", + "value" : "1.1 5dbe09af3a2c87121e31ffa67f174f66.cloudfront.net (CloudFront)" + }, { + "name" : "X-Amz-Cf-Id", + "value" : "YkvlkBNKgHt5aMu9vcS22Z8kHn1MUr-8adupwhDk3j9vF-TpSyIxZA==" + } ], + "headersSize" : 527, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "13.32.22.80", + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "time" : 177, + "timings" : { + "blocked" : -1, + "connect" : -1, + "dns" : -1, + "receive" : 27, + "send" : -1, + "ssl" : -1, + "wait" : 150 + } + }, { + "pageref" : "page_1", + "request" : { + "headers" : [ { + "name" : "User-Agent", + "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" + }, { + "name" : "Accept", + "value" : "*/*" + }, { + "name" : "Referer", + "value" : "https://www.thousandeyes.com/resources" + }, { + "name" : "Accept-Encoding", + "value" : "gzip, deflate, sdch, br" + }, { + "name" : "Accept-Language", + "value" : "en-US,en;q=0.6" + } ], + "method" : "GET", + "queryString" : [ ], + "url" : "https://use.typekit.net/cjy5myw.js" + }, + "response" : { + "bodySize" : 0, + "content" : { + "mimeType" : "text/javascript;charset=utf-8", + "size" : 7814 + }, + "headers" : [ { + "name" : "status", + "value" : "200" + }, { + "name" : "access-control-allow-origin", + "value" : "*" + }, { + "name" : "cache-control", + "value" : "public, max-age=600, stale-while-revalidate=604800" + }, { + "name" : "content-encoding", + "value" : "gzip" + }, { + "name" : "content-type", + "value" : "text/javascript;charset=utf-8" + }, { + "name" : "server", + "value" : "nginx" + }, { + "name" : "status", + "value" : "200 OK" + }, { + "name" : "timing-allow-origin", + "value" : "*" + }, { + "name" : "vary", + "value" : "Accept-Encoding" + }, { + "name" : "content-length", + "value" : "7814" + }, { + "name" : "date", + "value" : "Sun, 26 Mar 2017 11:58:43 GMT" + } ], + "headersSize" : 334, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "104.103.103.234", + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "time" : 72, + "timings" : { + "blocked" : -1, + "connect" : -1, + "dns" : -1, + "receive" : 10, + "send" : -1, + "ssl" : -1, + "wait" : 62 + } + } ], + "pages" : [ { + "id" : "page_1", + "pageTimings" : { + "onContentLoad" : 874, + "onLoad" : 3492 + }, + "responseCode" : 200, + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "title" : "Network Performance Resources | ThousandEyes" + } ], + "version" : "1.2", + "systemMetrics" : { + "startTimeMs" : 1581508857327, + "endTimeMs" : 1581508867333, + "cpuUtilization" : { + "min" : 0.30859375, + "max" : 0.5625, + "mean" : 0.38931831001805056, + "median" : 0.353515625, + "stdDev" : 0.08389194281742307, + "count" : 10 + }, + "physicalMemoryUsedBytes" : { + "min" : 12805128192, + "max" : 12825530368, + "mean" : 1.281914582109091E10, + "median" : 12818219008, + "stdDev" : 5741124.05691331, + "count" : 11 + }, + "physicalMemoryTotalBytes" : 17069891584 + } + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_real_user_test_results": OperationExpectation( + operation_id="get_real_user_test_results", + method="GET", + path="/endpoint/test-results/real-user-tests/{id}", + path_param_examples={ + "id": '07625:1490529480:h3qJQTpl', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "network" : { + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "isIcmpBlocked" : true, + "vpnPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "ping" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "traceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "connectRtt" : 77.777, + "gatewayPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "errors" : [ "ping: Request timed out before getting response" ] + }, + "protocol" : "https", + "pages" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + }, { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + } ], + "numberOfPages" : 2, + "port" : 443, + "browser" : { + "name" : "Google Chrome", + "version" : "116.0.0.0" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "network" : { + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "isIcmpBlocked" : true, + "vpnPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "ping" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "bypass" : "*.local;169.254/16", + "proxy" : "" + } ] + }, + "subnetMask" : "255.255.255.0", + "error" : "An operation timed out.", + "wirelessProfile" : { + "rssi" : -38, + "bssid" : "4c:ba:ba:f4:fa:fa", + "snr" : 57, + "vendor" : "Cisco", + "txRate" : 130, + "channel" : 1, + "noise" : -95, + "phyMode" : "802.11n", + "ssid" : "Internet for the masses", + "quality" : 100 + }, + "interfaceName" : "en0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ], + "gateway" : "10.0.0.1" + }, + "traceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "vpnTraceroute" : { + "destination" : "13.32.22.232", + "hops" : [ { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + }, { + "delay" : 5, + "prefix" : "196.40.96.0/20", + "hop" : 1, + "ipAddress" : "196.40.106.237", + "name" : "89-210-88-65.access.t-2.net", + "mpls" : [ "L=301472,E=0,S=1,T=1" ], + "asn" : 34779 + } ], + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "internalErrors" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ] + }, + "connectRtt" : 77.777, + "gatewayPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "errors" : [ "ping: Request timed out before getting response" ] + }, + "protocol" : "https", + "pages" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + }, { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "pageId" : "C31gBrYJ", + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + } ], + "numberOfPages" : 2, + "port" : 443, + "browser" : { + "name" : "Google Chrome", + "version" : "116.0.0.0" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py new file mode 100644 index 00000000..2b2f5860 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_http_server_endpoint_scheduled_test_results_api_integration.py @@ -0,0 +1,2386 @@ +# 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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + 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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + 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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + }, { + "name" : "response-time", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + http_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.HttpEndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py new file mode 100644 index 00000000..43ddded4 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_local_network_endpoint_test_results_api_integration.py @@ -0,0 +1,1903 @@ +# coding: utf-8 + +""" + Endpoint Test Results API + + Retrieve results for scheduled and dynamic tests on endpoint agents. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.endpoint_test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.endpoint_test_results.api.local_network_endpoint_test_results_api import LocalNetworkEndpointTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestLocalNetworkEndpointTestResultsApiIntegration(IntegrationTestBase): + """LocalNetworkEndpointTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = LocalNetworkEndpointTestResultsApi(self.api_client) + + + def test_filter_local_networks_test_results_topologies_happy_path(self) -> None: + """Integration test for filter_local_networks_test_results_topologies success path""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + 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" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "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" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "type" : [ "vpn", "proxy" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_network_topology_result_request = thousandeyes_sdk.endpoint_test_results.models.EndpointNetworkTopologyResultRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py new file mode 100644 index 00000000..f1cd1c01 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_network_dynamic_endpoint_test_results_api_integration.py @@ -0,0 +1,2293 @@ +# coding: utf-8 + +""" + Endpoint Test Results API + + Retrieve results for scheduled and dynamic tests on endpoint agents. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.endpoint_test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.endpoint_test_results.api.network_dynamic_endpoint_test_results_api import NetworkDynamicEndpointTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestNetworkDynamicEndpointTestResultsApiIntegration(IntegrationTestBase): + """NetworkDynamicEndpointTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = NetworkDynamicEndpointTestResultsApi(self.api_client) + + + def test_filter_dynamic_test_network_results_happy_path(self) -> None: + """Integration test for filter_dynamic_test_network_results success path""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + 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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "webexConferenceId" : [ "719057112996612360", "719057112996612360" ], + "webexLocalSipSessionId" : [ "c124ba2b012050008000aa0c26c4bf0f", "c124ba2b012050008000aa0c26c4bf0f" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ], + "webexCorrelationId" : [ "f7d73641-8673-4547-be62-9521f78d9888", "f7d73641-8673-4547-be62-9521f78d9888" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + dynamic_endpoint_tests_data_round_search = thousandeyes_sdk.endpoint_test_results.models.DynamicEndpointTestsDataRoundSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py new file mode 100644 index 00000000..4854b465 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_network_endpoint_scheduled_test_results_api_integration.py @@ -0,0 +1,2959 @@ +# coding: utf-8 + +""" + Endpoint Test Results API + + Retrieve results for scheduled and dynamic tests on endpoint agents. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.endpoint_test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.endpoint_test_results.api.network_endpoint_scheduled_test_results_api import NetworkEndpointScheduledTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestNetworkEndpointScheduledTestResultsApiIntegration(IntegrationTestBase): + """NetworkEndpointScheduledTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = NetworkEndpointScheduledTestResultsApi(self.api_client) + + + def test_filter_scheduled_test_network_results_happy_path(self) -> None: + """Integration test for filter_scheduled_test_network_results success path""" + request_body_json = """ + + { + "searchSort" : [ { + "sort" : "round-id", + "order" : "desc" + }, { + "sort" : "round-id", + "order" : "desc" + } ], + "searchFilters" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + 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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "userPrincipalName" : [ "joeblogs32@c.com", "joeblogs32@c.com" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.EndpointTestsDataRoundsSearch.from_json(request_body_json) + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + 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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "error_description" : "Invalid access token", + "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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" : { + "agentId" : [ "52455b09-ff1b-4849-8194-99026cc890e0", "52455b09-ff1b-4849-8194-99026cc890e0" ], + "testId" : [ "5", "5" ] + }, + "thresholdFilter" : { + "conditionalOperator" : "and", + "filters" : [ { + "name" : "loss", + "value" : 10, + "operator" : "gte" + }, { + "name" : "loss", + "value" : 10, + "operator" : "gte" + } ] + } + } + + """ + multi_test_id_endpoint_tests_data_rounds_search = thousandeyes_sdk.endpoint_test_results.models.MultiTestIdEndpointTestsDataRoundsSearch.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + max = 5 + cursor = 'cursor_example' + use_all_permitted_aids = False + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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_integration.py b/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py new file mode 100644 index 00000000..1b69c9a9 --- /dev/null +++ b/thousandeyes-sdk-endpoint-test-results/test/test_real_user_endpoint_test_results_api_integration.py @@ -0,0 +1,2771 @@ +# coding: utf-8 + +""" + Endpoint Test Results API + + Retrieve results for scheduled and dynamic tests on endpoint agents. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.endpoint_test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.endpoint_test_results.api.real_user_endpoint_test_results_api import RealUserEndpointTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestRealUserEndpointTestResultsApiIntegration(IntegrationTestBase): + """RealUserEndpointTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = RealUserEndpointTestResultsApi(self.api_client) + + + def test_filter_real_user_tests_network_results_happy_path(self) -> None: + """Integration test for filter_real_user_tests_network_results success path""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "proxy" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "vpn" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "destination" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "proxy" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "vpn" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "destination" : { + "loss" : 0.1, + "jitter" : 46, + "latency" : 150, + "target" : "54.208.6.220" + }, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_real_user_tests_network_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_network_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_real_user_tests_network_results_error_400(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 400)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.filter_real_user_tests_network_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_401(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 401)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.filter_real_user_tests_network_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_403(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 403)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.filter_real_user_tests_network_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_404(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 404)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.filter_real_user_tests_network_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_429(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 429)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.filter_real_user_tests_network_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_500(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 500)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.filter_real_user_tests_network_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_network_results_error_502(self) -> None: + """Integration test for filter_real_user_tests_network_results error path (HTTP 502)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.filter_real_user_tests_network_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_network_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_filter_real_user_tests_results_happy_path(self) -> None: + """Integration test for filter_real_user_tests_results success path""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "pageId" : "C31gBrYJ", + "protocol" : "https", + "numberOfPages" : 2, + "port" : 443, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "pageId" : "C31gBrYJ", + "protocol" : "https", + "numberOfPages" : 2, + "port" : 443, + "id" : "07625:1490529480:aVDViw0i", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_real_user_tests_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_real_user_tests_results_error_400(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 400)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.filter_real_user_tests_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_401(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 401)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.filter_real_user_tests_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_403(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 403)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.filter_real_user_tests_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_404(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 404)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.filter_real_user_tests_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_429(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 429)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.filter_real_user_tests_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_500(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 500)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.filter_real_user_tests_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_results_error_502(self) -> None: + """Integration test for filter_real_user_tests_results error path (HTTP 502)""" + request_body_json = """ + + { + "searchFilters" : { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + } + + """ + real_user_endpoint_test_results_request = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultsRequest.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.filter_real_user_tests_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_results_request=real_user_endpoint_test_results_request, + + _headers=self.te_headers("filter_real_user_tests_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_filter_real_user_tests_visited_pages_results_happy_path(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results success path""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "responseTime" : 240, + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "id" : "07625:1490529480:aVDViw0i", + "pageId" : "C31gBrYJ", + "roundId" : 1384309800, + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + }, { + "pageTimings" : { + "onContentLoad" : 1483, + "onLoad" : 4569 + }, + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "pageTitle" : "Network Performance Resources | ThousandEyes", + "responseTime" : 240, + "pageUrl" : "https://app.thousandeyes.com/settings/integrations", + "id" : "07625:1490529480:aVDViw0i", + "pageId" : "C31gBrYJ", + "roundId" : 1384309800, + "loadDate" : "2022-07-17T22:00:54Z", + "responseCode" : 200 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.filter_real_user_tests_visited_pages_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + + _headers=self.te_headers("filter_real_user_tests_visited_pages_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_filter_real_user_tests_visited_pages_results_error_400(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 400)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_401(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 401)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_403(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 403)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_404(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 404)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_429(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 429)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_500(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 500)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_filter_real_user_tests_visited_pages_results_error_502(self) -> None: + """Integration test for filter_real_user_tests_visited_pages_results error path (HTTP 502)""" + request_body_json = """ + + { + "agentId" : [ "3fde6422-f119-40e1-ae32-d08a1243c038", "236e6f18-9637-4a2f-b15f-7aa6a29c9fce" ], + "bssid" : [ "8c:68:c8:a5:0a:8c", "0c:51:01:e4:3e:d0" ], + "visitedSite" : [ "app.thousandeyes.com" ], + "trigger" : [ "user" ], + "ssid" : [ "wifi-name", "other-room-wifi" ], + "platform" : [ "mac", "mac" ], + "proxyTarget" : [ "78.153.54.204", "78.153.54.206" ], + "destinationIp" : [ "84.255.241.1", "193.2.1.88" ], + "domain" : [ "thousandeyes.com" ], + "location" : [ "San Francisco Bay Area", "Germany" ], + "connection" : [ "wireless", "wireless" ], + "vpnTarget" : [ "78.153.54.204", "78.153.54.206" ], + "networkId" : [ "660b34109d12", "660b34109d15" ], + "gateway" : [ "78.153.54.204", "78.153.54.206" ] + } + + """ + real_user_endpoint_test_result_request_filter = thousandeyes_sdk.endpoint_test_results.models.RealUserEndpointTestResultRequestFilter.from_json(request_body_json) + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.filter_real_user_tests_visited_pages_results( + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + real_user_endpoint_test_result_request_filter=real_user_endpoint_test_result_request_filter, + + _headers=self.te_headers("filter_real_user_tests_visited_pages_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_real_user_test_page_results_happy_path(self) -> None: + """Integration test for get_real_user_test_page_results success path""" + id = '07625:1490529480:h3qJQTpl' + page_id = '281474976710706' + aid = '1234' + response_body_json = """ + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "har" : { + "log" : { + "browser" : { + "name" : "Google Chrome", + "version" : "57.0.2987.98" + }, + "creator" : { + "name" : "ThousandEyes Endpoint Agent", + "version" : "0.47.0" + }, + "entries" : [ { + "pageref" : "page_1", + "request" : { + "headers" : [ { + "name" : "Upgrade-Insecure-Requests", + "value" : "1" + }, { + "name" : "User-Agent", + "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" + }, { + "name" : "Accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" + }, { + "name" : "Referer", + "value" : "https://www.thousandeyes.com/" + }, { + "name" : "Accept-Encoding", + "value" : "gzip, deflate, sdch, br" + }, { + "name" : "Accept-Language", + "value" : "en-US,en;q=0.6" + }, { + "name" : "Cookie", + "value" : "(removed)" + } ], + "method" : "GET", + "queryString" : [ { + "name" : "locale", + "value" : "en-US" + } ], + "url" : "https://www.thousandeyes.com/resources" + }, + "response" : { + "bodySize" : 17776, + "content" : { + "mimeType" : "text/html;charset=ISO-8859-1", + "size" : 17776 + }, + "headers" : [ { + "name" : "Content-Type", + "value" : "text/html;charset=ISO-8859-1" + }, { + "name" : "Content-Length", + "value" : "17776" + }, { + "name" : "Connection", + "value" : "keep-alive" + }, { + "name" : "Date", + "value" : "Sun, 26 Mar 2017 11:58:54 GMT" + }, { + "name" : "Server", + "value" : "Apache" + }, { + "name" : "Cache-Control", + "value" : "max-age=600, must-revalidate" + }, { + "name" : "Content-Language", + "value" : "en-US" + }, { + "name" : "Content-Encoding", + "value" : "gzip" + }, { + "name" : "X-Frame-Options", + "value" : "sameorigin" + }, { + "name" : "Strict-Transport-Security", + "value" : "max-age=31536000" + }, { + "name" : "Vary", + "value" : "Accept-Encoding" + }, { + "name" : "X-Cache", + "value" : "Miss from cloudfront" + }, { + "name" : "Via", + "value" : "1.1 5dbe09af3a2c87121e31ffa67f174f66.cloudfront.net (CloudFront)" + }, { + "name" : "X-Amz-Cf-Id", + "value" : "YkvlkBNKgHt5aMu9vcS22Z8kHn1MUr-8adupwhDk3j9vF-TpSyIxZA==" + } ], + "headersSize" : 527, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "13.32.22.80", + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "time" : 177, + "timings" : { + "blocked" : -1, + "connect" : -1, + "dns" : -1, + "receive" : 27, + "send" : -1, + "ssl" : -1, + "wait" : 150 + } + }, { + "pageref" : "page_1", + "request" : { + "headers" : [ { + "name" : "User-Agent", + "value" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36" + }, { + "name" : "Accept", + "value" : "*/*" + }, { + "name" : "Referer", + "value" : "https://www.thousandeyes.com/resources" + }, { + "name" : "Accept-Encoding", + "value" : "gzip, deflate, sdch, br" + }, { + "name" : "Accept-Language", + "value" : "en-US,en;q=0.6" + } ], + "method" : "GET", + "queryString" : [ ], + "url" : "https://use.typekit.net/cjy5myw.js" + }, + "response" : { + "bodySize" : 0, + "content" : { + "mimeType" : "text/javascript;charset=utf-8", + "size" : 7814 + }, + "headers" : [ { + "name" : "status", + "value" : "200" + }, { + "name" : "access-control-allow-origin", + "value" : "*" + }, { + "name" : "cache-control", + "value" : "public, max-age=600, stale-while-revalidate=604800" + }, { + "name" : "content-encoding", + "value" : "gzip" + }, { + "name" : "content-type", + "value" : "text/javascript;charset=utf-8" + }, { + "name" : "server", + "value" : "nginx" + }, { + "name" : "status", + "value" : "200 OK" + }, { + "name" : "timing-allow-origin", + "value" : "*" + }, { + "name" : "vary", + "value" : "Accept-Encoding" + }, { + "name" : "content-length", + "value" : "7814" + }, { + "name" : "date", + "value" : "Sun, 26 Mar 2017 11:58:43 GMT" + } ], + "headersSize" : 334, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "104.103.103.234", + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "time" : 72, + "timings" : { + "blocked" : -1, + "connect" : -1, + "dns" : -1, + "receive" : 10, + "send" : -1, + "ssl" : -1, + "wait" : 62 + } + } ], + "pages" : [ { + "id" : "page_1", + "pageTimings" : { + "onContentLoad" : 874, + "onLoad" : 3492 + }, + "responseCode" : 200, + "startedDateTime" : "2017-03-22T11:58:54.123+02:00", + "title" : "Network Performance Resources | ThousandEyes" + } ], + "version" : "1.2", + "systemMetrics" : { + "startTimeMs" : 1581508857327, + "endTimeMs" : 1581508867333, + "cpuUtilization" : { + "min" : 0.30859375, + "max" : 0.5625, + "mean" : 0.38931831001805056, + "median" : 0.353515625, + "stdDev" : 0.08389194281742307, + "count" : 10 + }, + "physicalMemoryUsedBytes" : { + "min" : 12805128192, + "max" : 12825530368, + "mean" : 1.281914582109091E10, + "median" : 12818219008, + "stdDev" : 5741124.05691331, + "count" : 11 + }, + "physicalMemoryTotalBytes" : 17069891584 + } + } + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_real_user_test_page_results( + + id=id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_real_user_test_page_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_real_user_test_page_results_error_401(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 401)""" + id = '07625:1490529480:h3qJQTpl' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.get_real_user_test_page_results( + + id=id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_real_user_test_page_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_page_results_error_403(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 403)""" + id = '07625:1490529480:h3qJQTpl' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_real_user_test_page_results( + + id=id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_real_user_test_page_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_page_results_error_404(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 404)""" + id = '07625:1490529480:h3qJQTpl' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_real_user_test_page_results( + + id=id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_real_user_test_page_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_page_results_error_429(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 429)""" + id = '07625:1490529480:h3qJQTpl' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_real_user_test_page_results( + + id=id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_real_user_test_page_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_page_results_error_500(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 500)""" + id = '07625:1490529480:h3qJQTpl' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_real_user_test_page_results( + + id=id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_real_user_test_page_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_real_user_test_page_results_error_502(self) -> None: + """Integration test for get_real_user_test_page_results error path (HTTP 502)""" + id = '07625:1490529480:h3qJQTpl' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.get_real_user_test_page_results( + + id=id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_real_user_test_page_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_real_user_test_results_happy_path(self) -> None: + """Integration test for get_real_user_test_results success path""" + id = '07625:1490529480:h3qJQTpl' + aid = '1234' + response_body_json = """ + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agentId" : "861b7557-cd57-4bbb-b648-00bddf88ef49", + "committed" : "2022-07-17T22:00:54Z", + "experienceScore" : 0.5, + "sourceAddress" : "84.255.241.1", + "organizationName" : "T-2 Access Network", + "visitedSite" : "www.thousandeyes.com", + "coordinates" : { + "latitude" : 46.0552778, + "location" : "Slovenia", + "longitude" : 14.5144444 + }, + "network" : { + "systemMetrics" : { + "cpuUtilization" : { + "min" : 0.22, + "median" : 0.61, + "max" : 0.75, + "mean" : 0.55, + "count" : 150, + "stdDev" : 0.01 + }, + "physicalMemoryTotalBytes" : 1024, + "startTimeMs" : 1581508857327, + "physicalMemoryUsedBytes" : { + "min" : 1.2, + "median" : 1.85, + "max" : 2.5, + "mean" : 1.77, + "count" : 155, + "stdDev" : 0.25 + }, + "endTimeMs" : 1581508867333 + }, + "isIcmpBlocked" : true, + "vpnPing" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "ping" : { + "maxRtt" : 66, + "loss" : 1, + "pktsReceived" : 10, + "avgRtt" : 7, + "meanDevRtt" : 11, + "minRtt" : 1, + "error" : "An operation timed out.", + "infoFlags" : [ "TE_INFO_ICMP_BLOCKED_BY_FIREWALL" ], + "pktsSent" : 10 + }, + "networkProfile" : { + "previousInterface" : { + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "interfaceName" : "en0", + "subnetMask" : "255.255.255.0", + "dnsServers" : [ "8.8.8.8", "8.8.8.4" ] + }, + "ethernetProfile" : { + "linkSpeed" : 860 + }, + "publicIpAddress" : "84.255.241.1", + "publicIpRange" : "84.255.241.0-84.255.241.255", + "ipAddress" : "10.0.0.13", + "hardwareType" : "wireless", + "localPrefix" : "10.0.0.0", + "proxyProfile" : { + "method" : "System", + "proxies" : [ { + "bypass" : "*.local;169.254/16", + "proxy" : "" + }, { + "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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-endpoint-test-results/test/test_utils.py +++ b/thousandeyes-sdk-endpoint-test-results/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-endpoint-tests/.openapi-generator/FILES b/thousandeyes-sdk-endpoint-tests/.openapi-generator/FILES index 9008d979..01a462c3 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 b6b1e3f2..fa1957bd 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.97 - 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 2d2d0d70..7491afcd 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 4e318151..1d9d1263 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 fd71b117..b082a202 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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-endpoint-tests/test/integration_test_utils.py b/thousandeyes-sdk-endpoint-tests/test/integration_test_utils.py new file mode 100644 index 00000000..5a1cf965 --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Endpoint Tests API + + Manage endpoint agent dynamic and scheduled tests using the Endpoint Tests API. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-endpoint-tests/test/mock_manifest.py b/thousandeyes-sdk-endpoint-tests/test/mock_manifest.py new file mode 100644 index 00000000..5f8f0d5e --- /dev/null +++ b/thousandeyes-sdk-endpoint-tests/test/mock_manifest.py @@ -0,0 +1,2809 @@ +# coding: utf-8 + +""" + Endpoint Tests API + + Manage endpoint agent dynamic and scheduled tests using the Endpoint Tests API. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_agent_to_server_endpoint_dynamic_test": OperationExpectation( + operation_id="create_agent_to_server_endpoint_dynamic_test", + method="POST", + path="/endpoint/tests/dynamic-tests/agent-to-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "isPrioritized" : false, + "maxMachines" : 25, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "interval" : 60, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_agent_to_server_endpoint_dynamic_test": OperationExpectation( + operation_id="delete_agent_to_server_endpoint_dynamic_test", + method="DELETE", + path="/endpoint/tests/dynamic-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_endpoint_dynamic_test": OperationExpectation( + operation_id="get_agent_to_server_endpoint_dynamic_test", + method="GET", + path="/endpoint/tests/dynamic-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + success_body=json.loads(""" + + { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_endpoint_dynamic_tests": OperationExpectation( + operation_id="get_agent_to_server_endpoint_dynamic_tests", + method="GET", + path="/endpoint/tests/dynamic-tests/agent-to-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + }, { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_agent_to_server_endpoint_dynamic_test": OperationExpectation( + operation_id="update_agent_to_server_endpoint_dynamic_test", + method="PATCH", + path="/endpoint/tests/dynamic-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + success_body=json.loads(""" + + { + "hasPing" : true, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "application" : "webex", + "hasTraceroute" : true, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "protocol" : "icmp", + "application" : "webex", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_agent_to_server_endpoint_scheduled_test": OperationExpectation( + operation_id="create_agent_to_server_endpoint_scheduled_test", + method="POST", + path="/endpoint/tests/scheduled-tests/agent-to-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "server" : "www.example.com", + "isSavedEvent" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "type" : "agent-to-server", + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "server" : "www.example.com", + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "serverName" : "www.example.com", + "isPrioritized" : false, + "endpointAgentLabels" : [ "567", "214" ], + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "ipVersion" : "V4_ONLY", + "port" : 443, + "interval" : 60, + "testName" : "Test name" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_agent_to_server_endpoint_scheduled_test": OperationExpectation( + operation_id="delete_agent_to_server_endpoint_scheduled_test", + method="DELETE", + path="/endpoint/tests/scheduled-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_endpoint_scheduled_test": OperationExpectation( + operation_id="get_agent_to_server_endpoint_scheduled_test", + method="GET", + path="/endpoint/tests/scheduled-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + success_body=json.loads(""" + + { + "server" : "www.example.com", + "isSavedEvent" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "type" : "agent-to-server", + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_endpoint_scheduled_tests": OperationExpectation( + operation_id="get_agent_to_server_endpoint_scheduled_tests", + method="GET", + path="/endpoint/tests/scheduled-tests/agent-to-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "server" : "www.example.com", + "isSavedEvent" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "type" : "agent-to-server", + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + }, { + "server" : "www.example.com", + "isSavedEvent" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "type" : "agent-to-server", + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_agent_to_server_endpoint_scheduled_test": OperationExpectation( + operation_id="update_agent_to_server_endpoint_scheduled_test", + method="PATCH", + path="/endpoint/tests/scheduled-tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + success_body=json.loads(""" + + { + "server" : "www.example.com", + "isSavedEvent" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "type" : "agent-to-server", + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "server" : "www.example.com", + "protocol" : "icmp", + "port" : 49153, + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "testName" : "Test name" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_endpoint_real_user_tests": OperationExpectation( + operation_id="get_endpoint_real_user_tests", + method="GET", + path="/endpoint/tests/real-user-tests", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "realUserTests" : [ { + "includedDomains" : [ "example.com", "example.com" ], + "profileId" : "73421", + "monitoringSettings" : { + "monitoringSettingsId" : "1f5c1b5d-8a0d-4d6b-a3be-56b060f7f2c9", + "monitoringSettingsType" : "agent-tags", + "tagIds" : [ "49d9e7d2-7df5-43df-9b37-aa596b929062" ], + "labelIds" : [ "567" ] + }, + "name" : "Corporate domains", + "excludedDomains" : [ "static.example.com", "static.example.com" ], + "aid" : "1234" + }, { + "includedDomains" : [ "example.com", "example.com" ], + "profileId" : "73421", + "monitoringSettings" : { + "monitoringSettingsId" : "1f5c1b5d-8a0d-4d6b-a3be-56b060f7f2c9", + "monitoringSettingsType" : "agent-tags", + "tagIds" : [ "49d9e7d2-7df5-43df-9b37-aa596b929062" ], + "labelIds" : [ "567" ] + }, + "name" : "Corporate domains", + "excludedDomains" : [ "static.example.com", "static.example.com" ], + "aid" : "1234" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_endpoint_scheduled_tests": OperationExpectation( + operation_id="get_endpoint_scheduled_tests", + method="GET", + path="/endpoint/tests/scheduled-tests", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "server" : "www.example.com", + "isSavedEvent" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "type" : "agent-to-server", + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + }, { + "server" : "www.example.com", + "isSavedEvent" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "networkMeasurements" : true, + "type" : "agent-to-server", + "tcpProbeMode" : "auto", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "protocol" : "icmp", + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "testName" : "Test name" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_http_server_endpoint_scheduled_test": OperationExpectation( + operation_id="create_http_server_endpoint_scheduled_test", + method="POST", + path="/endpoint/tests/scheduled-tests/http-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "server" : "www.example.com", + "isSavedEvent" : false, + "sslVersion" : "Auto", + "useNtlm" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "httpTimeLimit" : 5000, + "type" : "http-server", + "protocol" : "icmp", + "httpVersion" : 2, + "followRedirects" : true, + "authType" : "none", + "testName" : "Test name", + "verifyCertificate" : true, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "verifyCertificate" : true, + "hasPing" : true, + "agentSelectorType" : "all-agents", + "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ], + "maxMachines" : 25, + "isPrioritized" : false, + "httpTimeLimit" : 5000, + "networkMeasurements" : true, + "endpointAgentLabels" : [ "567", "214" ], + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ], + "protocol" : "icmp", + "password" : "password", + "ipVersion" : "V4_ONLY", + "hasTraceroute" : true, + "targetResponseTime" : 1000, + "interval" : 60, + "authType" : "none", + "hasPathTraceInSession" : true, + "testName" : "Test name", + "username" : "username", + "sslVersionId" : "0" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_http_server_endpoint_scheduled_test": OperationExpectation( + operation_id="delete_http_server_endpoint_scheduled_test", + method="DELETE", + path="/endpoint/tests/scheduled-tests/http-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_http_server_endpoint_scheduled_test": OperationExpectation( + operation_id="get_http_server_endpoint_scheduled_test", + method="GET", + path="/endpoint/tests/scheduled-tests/http-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + success_body=json.loads(""" + + { + "server" : "www.example.com", + "isSavedEvent" : false, + "sslVersion" : "Auto", + "useNtlm" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "httpTimeLimit" : 5000, + "type" : "http-server", + "protocol" : "icmp", + "httpVersion" : 2, + "followRedirects" : true, + "authType" : "none", + "testName" : "Test name", + "verifyCertificate" : true, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_http_server_endpoint_scheduled_tests": OperationExpectation( + operation_id="get_http_server_endpoint_scheduled_tests", + method="GET", + path="/endpoint/tests/scheduled-tests/http-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "server" : "www.example.com", + "isSavedEvent" : false, + "sslVersion" : "Auto", + "useNtlm" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "httpTimeLimit" : 5000, + "type" : "http-server", + "protocol" : "icmp", + "httpVersion" : 2, + "followRedirects" : true, + "authType" : "none", + "testName" : "Test name", + "verifyCertificate" : true, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" + }, { + "server" : "www.example.com", + "isSavedEvent" : false, + "sslVersion" : "Auto", + "useNtlm" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "httpTimeLimit" : 5000, + "type" : "http-server", + "protocol" : "icmp", + "httpVersion" : 2, + "followRedirects" : true, + "authType" : "none", + "testName" : "Test name", + "verifyCertificate" : true, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_http_server_endpoint_scheduled_test": OperationExpectation( + operation_id="update_http_server_endpoint_scheduled_test", + method="PATCH", + path="/endpoint/tests/scheduled-tests/http-server/{testId}", + path_param_examples={ + "testId": '584739201', + }, + success_status=200, + success_body=json.loads(""" + + { + "server" : "www.example.com", + "isSavedEvent" : false, + "sslVersion" : "Auto", + "useNtlm" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/network/filter" + }, { + "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/scheduled-tests/281474976710706/pathvis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isPrioritized" : false, + "httpTimeLimit" : 5000, + "type" : "http-server", + "protocol" : "icmp", + "httpVersion" : 2, + "followRedirects" : true, + "authType" : "none", + "testName" : "Test name", + "verifyCertificate" : true, + "networkMeasurements" : true, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "ipVersion" : "V4_ONLY", + "port" : 443, + "isEnabled" : true, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "aid" : "1234", + "agentSelectorConfig" : { + "agentSelectorType" : "all-agents", + "maxMachines" : 25 + }, + "hasPathTraceInSession" : true, + "httpTargetTime" : 100, + "username" : "username", + "sslVersionId" : "0" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "protocol" : "icmp", + "isEnabled" : true, + "interval" : 60, + "tcpProbeMode" : "auto", + "url" : "https://example.com:443", + "testName" : "Test name" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py b/thousandeyes-sdk-endpoint-tests/test/test_agent_to_server_endpoint_dynamic_tests_api_integration.py new file mode 100644 index 00000000..bb4673f4 --- /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 00000000..33fd5cb7 --- /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 00000000..f64c4578 --- /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 00000000..ac442bfa --- /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 00000000..27b916f1 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-endpoint-tests/test/test_utils.py +++ b/thousandeyes-sdk-endpoint-tests/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-event-detection/.openapi-generator/FILES b/thousandeyes-sdk-event-detection/.openapi-generator/FILES index 36db1126..c86b0544 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 58f9cf7d..8bd8e3c4 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.97 - 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 00000000..54a716f4 --- /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 00000000..637ec319 --- /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 00000000..db4bd8b8 --- /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 00000000..2822a7cf --- /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 e216e2b9..f3e60b67 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 00000000..f59efb39 --- /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 00000000..b6a09113 --- /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 6bd6eff1..a244ed73 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 00000000..d11912ec --- /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 00000000..150d7bb1 --- /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 00000000..43435623 --- /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 00000000..683d0aa8 --- /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 00000000..aeb21d27 --- /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 00000000..c97c8a28 --- /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 01d6ae61..f70cad20 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 371c853b..e8c03cb2 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 00000000..fcf63439 --- /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 8bcfbd3a..4ae9b6af 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 b3b4c39e..784bbdc1 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 305b1bd5..10dda03c 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 6550e361..6d3cc25a 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 8e4dbe85..9bf9d914 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 00000000..846acbd5 --- /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 00000000..7faf3e50 --- /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 00000000..7b340380 --- /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 00000000..1dd233b6 --- /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 ff18ae96..c24907d3 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 b3685d60..0a8bccbc 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 292202cf..5b632862 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 dc24e429..5757a00d 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 c4f1956b..47bffb3a 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 059fd3f9..2d4daeb2 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 00000000..6e32467e --- /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 00000000..15e1bdbc --- /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 00000000..b4574142 --- /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 00000000..d8eea672 --- /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 17bb8149..092b0fd5 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_agents import AffectedAgen 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_state import EventState 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.test_type import TestType 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 afd97f04..3b98006a 100644 --- a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/api/events_api.py +++ b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/api/events_api.py @@ -19,7 +19,7 @@ from importlib.metadata import version import thousandeyes_sdk.event_detection.models from datetime import datetime -from pydantic import Field, StrictInt, StrictStr, field_validator +from pydantic import Field, StrictBool, StrictInt, StrictStr, field_validator from typing import Optional from typing_extensions import Annotated from thousandeyes_sdk.event_detection.models.event_detail import EventDetail @@ -350,6 +350,7 @@ class EventsApi: end_date: Annotated[Optional[datetime], Field(description="Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`.")] = None, max: Annotated[Optional[StrictInt], Field(description="(Optional) Maximum number of objects to return.")] = None, cursor: Annotated[Optional[StrictStr], Field(description="(Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter.")] = None, + ongoing: Annotated[Optional[StrictBool], Field(description="When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -379,6 +380,8 @@ class EventsApi: :type max: int :param cursor: (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. :type cursor: str + :param ongoing: When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response. + :type ongoing: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -403,7 +406,7 @@ class EventsApi: return PaginationIterable( self.get_events, lambda data: data.events if data and data.events else [], - aid = aid, window = window, start_date = start_date, end_date = end_date, max = max, cursor = cursor, + aid = aid, window = window, start_date = start_date, end_date = end_date, max = max, cursor = cursor, ongoing = ongoing, _request_timeout=_request_timeout, _request_auth=_request_auth, _content_type=_content_type, @@ -421,6 +424,7 @@ class EventsApi: end_date: Annotated[Optional[datetime], Field(description="Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`.")] = None, max: Annotated[Optional[StrictInt], Field(description="(Optional) Maximum number of objects to return.")] = None, cursor: Annotated[Optional[StrictStr], Field(description="(Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter.")] = None, + ongoing: Annotated[Optional[StrictBool], Field(description="When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -450,6 +454,8 @@ class EventsApi: :type max: int :param cursor: (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. :type cursor: str + :param ongoing: When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response. + :type ongoing: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -479,6 +485,7 @@ class EventsApi: end_date=end_date, max=max, cursor=cursor, + ongoing=ongoing, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -516,6 +523,7 @@ class EventsApi: end_date: Annotated[Optional[datetime], Field(description="Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`.")] = None, max: Annotated[Optional[StrictInt], Field(description="(Optional) Maximum number of objects to return.")] = None, cursor: Annotated[Optional[StrictStr], Field(description="(Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter.")] = None, + ongoing: Annotated[Optional[StrictBool], Field(description="When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -545,6 +553,8 @@ class EventsApi: :type max: int :param cursor: (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. :type cursor: str + :param ongoing: When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response. + :type ongoing: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -574,6 +584,7 @@ class EventsApi: end_date=end_date, max=max, cursor=cursor, + ongoing=ongoing, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -611,6 +622,7 @@ class EventsApi: end_date: Annotated[Optional[datetime], Field(description="Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`.")] = None, max: Annotated[Optional[StrictInt], Field(description="(Optional) Maximum number of objects to return.")] = None, cursor: Annotated[Optional[StrictStr], Field(description="(Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter.")] = None, + ongoing: Annotated[Optional[StrictBool], Field(description="When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -640,6 +652,8 @@ class EventsApi: :type max: int :param cursor: (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. :type cursor: str + :param ongoing: When set to `true`, only ongoing (active) events whose start date is within the specified time window are included in the response. When set to `false`, ongoing events are excluded from the response. If not set, both ongoing and concluded events appear in the response. + :type ongoing: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -669,6 +683,7 @@ class EventsApi: end_date=end_date, max=max, cursor=cursor, + ongoing=ongoing, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -700,6 +715,7 @@ class EventsApi: end_date, max, cursor, + ongoing, _request_auth, _content_type, _headers, @@ -762,6 +778,10 @@ class EventsApi: _query_params.append(('cursor', cursor)) + if ongoing is not None: + + _query_params.append(('ongoing', ongoing)) + # process the header parameters # process the form parameters # process the body parameter diff --git a/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/__init__.py b/thousandeyes-sdk-event-detection/src/thousandeyes_sdk/event_detection/models/__init__.py index c9364bdd..02890b34 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_agents import AffectedAgen 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_state import EventState 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.test_type import TestType 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 00000000..9d82f5f7 --- /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 00000000..080302cd --- /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 00000000..45716706 --- /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 00000000..4cca640c --- /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 3f3be028..66b28632 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_agents import AffectedAgen 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 @@ class AgentLocalEventDetail(BaseModel): "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 00000000..9f02d54c --- /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 00000000..7b993dba --- /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 c8bde281..532027dd 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_agents import AffectedAgen 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 @@ class DnsEventDetail(BaseModel): "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 00000000..3c48cbab --- /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 00000000..3ffaed8e --- /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 00000000..f5c10354 --- /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 00000000..caeb5019 --- /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 00000000..c2be7c6b --- /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 00000000..f5310869 --- /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 14dfdd75..20e8d274 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 datetime import datetime 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 @@ class Event(BaseModel): "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 ff2ca4ae..a7f593b1 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 enum import Enum 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 00000000..4eaf255e --- /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 5192944c..53c68a46 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 @@ import json 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 45283f05..ea34581d 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 json 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 @@ class EventDetail(BaseModel): 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 @@ class EventDetail(BaseModel): 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 @@ class EventDetail(BaseModel): 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 b7186650..ee0b5a9a 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 typing import Any, ClassVar, Dict, List, Optional 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 @@ class EventDetailBase(BaseModel): "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 c9688b51..2e611457 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 @@ from typing_extensions import Self 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 00000000..b0c9d32c --- /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 00000000..ca3b4bf4 --- /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 00000000..2fe9d183 --- /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 00000000..3477250e --- /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 39be2a50..5bb46fbf 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 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.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 @@ class NetworkEventDetail(BaseModel): "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 f1c631f0..0daacad8 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 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.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 @@ class NetworkPopEventDetail(BaseModel): "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 c7f0a032..4bf649eb 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 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.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 @@ class ProxyEventDetail(BaseModel): "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 5d6e39b0..804db7e1 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 ef1117a5..d0516e9e 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 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 @@ -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 @@ class TargetEventDetail(BaseModel): "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 038c06c2..cbccf19f 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 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 @@ -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 @@ class TargetNetworkEventDetail(BaseModel): "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 00000000..cb4a783f --- /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 00000000..5adb0ce7 --- /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 00000000..6472e007 --- /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 00000000..d9428d2d --- /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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-event-detection/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-event-detection/test/integration_test_utils.py b/thousandeyes-sdk-event-detection/test/integration_test_utils.py new file mode 100644 index 00000000..bb20b37c --- /dev/null +++ b/thousandeyes-sdk-event-detection/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Event Detection API + + Event detection occurs when ThousandEyes identifies that error signals related to a component (proxy, network node, AS, server etc) have deviated from the baselines established by events. * To determine this, ThousandEyes takes the test results from all accounts groups within an organization, and analyzes that data. * Noisy test results (those that have too many errors in a short window) are removed until they stabilize, and the rest of the results are tagged with the components associated with that test result (for example, proxy, network, or server). * Next, any increase in failures from the test results and each component helps in determining the problem domain and which component may be at fault. * When this failure rate increases beyond a pre-defined threshold (set by the algorithm), an event is triggered and an email notification is sent to the user (if they've enabled email alerts). With the Events API, you can perform the following tasks on the ThousandEyes platform: * **Retrieve Events**: Obtain a list of events and detailed information for each event. For more information about events, see [Event Detection](https://docs.thousandeyes.com/product-documentation/event-detection). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-event-detection/test/mock_manifest.py b/thousandeyes-sdk-event-detection/test/mock_manifest.py new file mode 100644 index 00000000..f5715b1d --- /dev/null +++ b/thousandeyes-sdk-event-detection/test/mock_manifest.py @@ -0,0 +1,460 @@ +# coding: utf-8 + +""" + Event Detection API + + Event detection occurs when ThousandEyes identifies that error signals related to a component (proxy, network node, AS, server etc) have deviated from the baselines established by events. * To determine this, ThousandEyes takes the test results from all accounts groups within an organization, and analyzes that data. * Noisy test results (those that have too many errors in a short window) are removed until they stabilize, and the rest of the results are tagged with the components associated with that test result (for example, proxy, network, or server). * Next, any increase in failures from the test results and each component helps in determining the problem domain and which component may be at fault. * When this failure rate increases beyond a pre-defined threshold (set by the algorithm), an event is triggered and an email notification is sent to the user (if they've enabled email alerts). With the Events API, you can perform the following tasks on the ThousandEyes platform: * **Retrieve Events**: Obtain a list of events and detailed information for each event. For more information about events, see [Event Detection](https://docs.thousandeyes.com/product-documentation/event-detection). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "get_event": OperationExpectation( + operation_id="get_event", + method="GET", + path="/events/{id}", + path_param_examples={ + "id": 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569', + }, + success_status=200, + success_body=json.loads(""" + + { + "severity" : "medium", + "summary" : "Significant number of issues detected with 66.29.146.15", + "agentType" : "cloud-enterprise-agent", + "affectedTests" : { + "total" : 5, + "tests" : [ { + "affectedTargetIds" : [ "123", "1234" ], + "affectedAgentIds" : [ "2954", "2953" ], + "_links" : { + "test" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Google test", + "testType" : "agent-to-server", + "testId" : "226770" + }, { + "affectedTargetIds" : [ "123", "1234" ], + "affectedAgentIds" : [ "2954", "2953" ], + "_links" : { + "test" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "name" : "Google test", + "testType" : "agent-to-server", + "testId" : "226770" + } ], + "inAccountGroup" : 2 + }, + "endDate" : "2020-04-23T13:43:16Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "typeName" : "Network Issue", + "cause" : [ "Network Loss and/or High RTT" ], + "affectedTargets" : { + "total" : 5, + "inAccountGroup" : 2, + "targets" : [ { + "affectedAgentIds" : [ "2954", "2953" ], + "ip" : "216.239.32.10", + "name" : "google.com", + "affectedTestIds" : [ "123", "1234" ], + "serverId" : "123" + }, { + "affectedAgentIds" : [ "2954", "2953" ], + "ip" : "216.239.32.10", + "name" : "google.com", + "affectedTestIds" : [ "123", "1234" ], + "serverId" : "123" + } ] + }, + "type" : "target", + "grouping" : { + "target" : "google.com" + }, + "affectedAgents" : { + "total" : 5, + "inAccountGroup" : 2, + "agents" : [ { + "affectedTargetIds" : [ "123", "1234" ], + "agentId" : "2954", + "_links" : { + "agent" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "countryCode" : "BR", + "name" : "São Paulo, Brazil - agent", + "location" : "São Paulo, Brazil", + "affectedTestIds" : [ "2954", "2953" ], + "type" : "enterprise" + }, { + "affectedTargetIds" : [ "123", "1234" ], + "agentId" : "2954", + "_links" : { + "agent" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "countryCode" : "BR", + "name" : "São Paulo, Brazil - agent", + "location" : "São Paulo, Brazil", + "affectedTestIds" : [ "2954", "2953" ], + "type" : "enterprise" + } ] + }, + "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", + "state" : "resolved", + "aid" : "1234", + "startDate" : "2020-04-23T13:43:16Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_events": OperationExpectation( + operation_id="get_events", + method="GET", + path="/events", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "aid" : "1234", + "startDate" : "2022-07-17T22:00:54Z", + "events" : [ { + "severity" : "medium", + "agentType" : "cloud-enterprise-agent", + "affectedTests" : { + "total" : 5, + "inAccountGroup" : 2 + }, + "endDate" : "2020-04-23T13:43:16Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "typeName" : "Network Issue", + "title" : "Affecting destinations in google.com", + "type" : "target", + "affectedTargets" : { + "total" : 5, + "inAccountGroup" : 2 + }, + "affectedAgents" : { + "total" : 5, + "inAccountGroup" : 2 + }, + "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", + "state" : "resolved", + "startDate" : "2020-04-23T13:43:16Z" + }, { + "severity" : "medium", + "agentType" : "cloud-enterprise-agent", + "affectedTests" : { + "total" : 5, + "inAccountGroup" : 2 + }, + "endDate" : "2020-04-23T13:43:16Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "typeName" : "Network Issue", + "title" : "Affecting destinations in google.com", + "type" : "target", + "affectedTargets" : { + "total" : 5, + "inAccountGroup" : 2 + }, + "affectedAgents" : { + "total" : 5, + "inAccountGroup" : 2 + }, + "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569", + "state" : "resolved", + "startDate" : "2020-04-23T13:43:16Z" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-event-detection/test/test_events_api.py b/thousandeyes-sdk-event-detection/test/test_events_api.py index aed81efb..a83f1b17 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 @@ class TestEventsApi(unittest.TestCase): { "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 @@ class TestEventsApi(unittest.TestCase): "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 @@ class TestEventsApi(unittest.TestCase): "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 @@ class TestEventsApi(unittest.TestCase): "startDate" : "2022-07-17T22:00:54Z", "events" : [ { "severity" : "medium", + "agentType" : "cloud-enterprise-agent", "affectedTests" : { "total" : 5, "inAccountGroup" : 2 @@ -216,22 +218,23 @@ class TestEventsApi(unittest.TestCase): "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 @@ class TestEventsApi(unittest.TestCase): "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 00000000..4b0ca5d1 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-event-detection/test/test_utils.py +++ b/thousandeyes-sdk-event-detection/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-instant-tests/.openapi-generator/FILES b/thousandeyes-sdk-instant-tests/.openapi-generator/FILES index fa33a7c1..71b993d4 100644 --- a/thousandeyes-sdk-instant-tests/.openapi-generator/FILES +++ b/thousandeyes-sdk-instant-tests/.openapi-generator/FILES @@ -250,17 +250,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 697ee833..dda8a2f4 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.97 - 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 diff --git a/thousandeyes-sdk-instant-tests/docs/APIInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/APIInstantTestsApi.md index 5cc2f820..58a03160 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 994ec2c8..d6a088e4 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 a277f45e..60190d8a 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 af643553..e944b647 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 603b4c41..f56bc4f6 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 f2e3a2f3..fd4290ea 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 6e722db2..4d640382 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 78b35f19..21387379 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 bc651855..dca62d65 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/SIPServerInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/SIPServerInstantTestsApi.md index e21a2a64..5ceafcee 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/VoiceInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/VoiceInstantTestsApi.md index f616bb31..33a437be 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/WebTransactionInstantTestsApi.md b/thousandeyes-sdk-instant-tests/docs/WebTransactionInstantTestsApi.md index 96f77cbe..240e66c8 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/test/conftest.py b/thousandeyes-sdk-instant-tests/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-instant-tests/test/integration_test_utils.py b/thousandeyes-sdk-instant-tests/test/integration_test_utils.py new file mode 100644 index 00000000..b4de1e4f --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Instant Tests API + + The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-instant-tests/test/mock_manifest.py b/thousandeyes-sdk-instant-tests/test/mock_manifest.py new file mode 100644 index 00000000..be288d75 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/mock_manifest.py @@ -0,0 +1,3980 @@ +# coding: utf-8 + +""" + Instant Tests API + + The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_api_instant_test": OperationExpectation( + operation_id="create_api_instant_test", + method="POST", + path="/tests/api/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "credentials" : [ "3247", "1051" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_agent_to_agent_instant_test": OperationExpectation( + operation_id="create_agent_to_agent_instant_test", + method="POST", + path="/tests/agent-to-agent/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_agent_to_server_instant_test": OperationExpectation( + operation_id="create_agent_to_server_instant_test", + method="POST", + path="/tests/agent-to-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "pingPayloadSize" : 112, + "continuousMode" : false + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "sharedWithAccounts" : [ "1234", "12345" ], + "continuousMode" : false + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_sec_instant_test": OperationExpectation( + operation_id="create_dns_sec_instant_test", + method="POST", + path="/tests/dnssec/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "testName" : "ThousandEyes Test" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_server_instant_test": OperationExpectation( + operation_id="create_dns_server_instant_test", + method="POST", + path="/tests/dns-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_trace_instant_test": OperationExpectation( + operation_id="create_dns_trace_instant_test", + method="POST", + path="/tests/dns-trace/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "testName" : "ThousandEyes Test" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_ftp_server_instant_test": OperationExpectation( + operation_id="create_ftp_server_instant_test", + method="POST", + path="/tests/ftp-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "downloadLimit" : 1048576, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "useActiveFtp" : false, + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "downloadLimit" : 1048576, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_page_load_instant_test": OperationExpectation( + operation_id="create_page_load_instant_test", + method="POST", + path="/tests/page-load/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_http_server_instant_test": OperationExpectation( + operation_id="create_http_server_instant_test", + method="POST", + path="/tests/http-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_sip_server_instant_test": OperationExpectation( + operation_id="create_sip_server_instant_test", + method="POST", + path="/tests/sip-server/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "registerEnabled" : false, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "user" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "registerEnabled" : false, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_voice_instant_test": OperationExpectation( + operation_id="create_voice_instant_test", + method="POST", + path="/tests/voice/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "description" : "ThousandEyes Test", + "type" : "voice", + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "codec" : "G.711 @ 64 Kbps", + "codecId" : "0", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 1024, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "281474976710706", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "description" : "ThousandEyes Test", + "type" : "voice", + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "codec" : "G.711 @ 64 Kbps", + "codecId" : "0", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 1024, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "281474976710706", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_web_transaction_instant_test": OperationExpectation( + operation_id="create_web_transaction_instant_test", + method="POST", + path="/tests/web-transactions/instant", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_agent_to_agent_instant_tests_api_integration.py new file mode 100644 index 00000000..117ba1ff --- /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 00000000..1601027b --- /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 00000000..40cd1176 --- /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 00000000..51c0d619 --- /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 00000000..890a5303 --- /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 00000000..fa8372bb --- /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 00000000..4065b5a5 --- /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_integration.py b/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py new file mode 100644 index 00000000..00a3de6c --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_http_page_load_instant_tests_api_integration.py @@ -0,0 +1,1400 @@ +# coding: utf-8 + +""" + Instant Tests API + + The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.instant_tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.instant_tests.api.http_page_load_instant_tests_api import HTTPPageLoadInstantTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestHTTPPageLoadInstantTestsApiIntegration(IntegrationTestBase): + """HTTPPageLoadInstantTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = HTTPPageLoadInstantTestsApi(self.api_client) + + + def test_create_page_load_instant_test_happy_path(self) -> None: + """Integration test for create_page_load_instant_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_page_load_instant_test( + + page_load_instant_test_request=page_load_instant_test_request, + + aid=aid, + + _headers=self.te_headers("create_page_load_instant_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_page_load_instant_test_error_400(self) -> None: + """Integration test for create_page_load_instant_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_instant_test_request = thousandeyes_sdk.instant_tests.models.PageLoadInstantTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "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, + "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, + "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, + "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, + "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, + "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, + "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 00000000..b01cbdae --- /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 00000000..67b19d69 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_instant_tests_api_integration.py @@ -0,0 +1,35 @@ +# coding: utf-8 + +""" + Instant Tests API + + The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.instant_tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.instant_tests.api.instant_tests_api import InstantTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestInstantTestsApiIntegration(IntegrationTestBase): + """InstantTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = InstantTestsApi(self.api_client) + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_sip_server_instant_tests_api_integration.py new file mode 100644 index 00000000..96614a41 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-instant-tests/test/test_utils.py +++ b/thousandeyes-sdk-instant-tests/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py b/thousandeyes-sdk-instant-tests/test/test_voice_instant_tests_api_integration.py new file mode 100644 index 00000000..b441e773 --- /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_integration.py b/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py new file mode 100644 index 00000000..7535eb44 --- /dev/null +++ b/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py @@ -0,0 +1,1418 @@ +# coding: utf-8 + +""" + Instant Tests API + + The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.instant_tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.instant_tests.api.web_transaction_instant_tests_api import WebTransactionInstantTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase): + """WebTransactionInstantTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = WebTransactionInstantTestsApi(self.api_client) + + + def test_create_web_transaction_instant_test_happy_path(self) -> None: + """Integration test for create_web_transaction_instant_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_web_transaction_instant_test( + + web_transaction_instant_test_request=web_transaction_instant_test_request, + + aid=aid, + + _headers=self.te_headers("create_web_transaction_instant_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_web_transaction_instant_test_error_400(self) -> None: + """Integration test for create_web_transaction_instant_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "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, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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 465fddf7..240c5fd7 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 4dd0eb42..61ae68b8 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.97 - 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 d98e531d..0edf337e 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 2c19fd3f..97dd6efb 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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-internet-insights/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-internet-insights/test/integration_test_utils.py b/thousandeyes-sdk-internet-insights/test/integration_test_utils.py new file mode 100644 index 00000000..693c4b1e --- /dev/null +++ b/thousandeyes-sdk-internet-insights/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Internet Insights API + + **Note:** All Internet Insights APIs are not available for ThousandEyes for Government instance. We are happy to announce the release of the Internet Insights API set. This limited release includes endpoints that: * Make our catalog provider and Internet outage data accessible to API users. * Provide access to advanced filtering, which is part of our next-generation API efforts to allow API users to fine-tune queries across all of our APIs in a consistent manner. Internet Insights provide visibility into core Internet infrastructure, including ISPs, DNS providers, IaaS, CDNs , and SaaS providers. It tracks the macro-level impact of Internet events on individual users and enterprise networks connecting at the edge of the Internet. These events include Outages, Routing hijacks and leaks, DDoS attacks, And political interference, among others. Future releases of the Internet Insights API set will further unlock access to core Internet Insights functionality, unlocking potential integrations to enrich customer process flows. For more information about Internet Insights, see the [Internet Insights](https://docs.thousandeyes.com/product-documentation/internet-insights). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-internet-insights/test/mock_manifest.py b/thousandeyes-sdk-internet-insights/test/mock_manifest.py new file mode 100644 index 00000000..c925a517 --- /dev/null +++ b/thousandeyes-sdk-internet-insights/test/mock_manifest.py @@ -0,0 +1,899 @@ +# coding: utf-8 + +""" + Internet Insights API + + **Note:** All Internet Insights APIs are not available for ThousandEyes for Government instance. We are happy to announce the release of the Internet Insights API set. This limited release includes endpoints that: * Make our catalog provider and Internet outage data accessible to API users. * Provide access to advanced filtering, which is part of our next-generation API efforts to allow API users to fine-tune queries across all of our APIs in a consistent manner. Internet Insights provide visibility into core Internet infrastructure, including ISPs, DNS providers, IaaS, CDNs , and SaaS providers. It tracks the macro-level impact of Internet events on individual users and enterprise networks connecting at the edge of the Internet. These events include Outages, Routing hijacks and leaks, DDoS attacks, And political interference, among others. Future releases of the Internet Insights API set will further unlock access to core Internet Insights functionality, unlocking potential integrations to enrich customer process flows. For more information about Internet Insights, see the [Internet Insights](https://docs.thousandeyes.com/product-documentation/internet-insights). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "filter_catalog_providers": OperationExpectation( + operation_id="filter_catalog_providers", + method="POST", + path="/internet-insights/catalog/providers/filter", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "providers" : [ { + "interfacesCount" : 15, + "locationsCount" : 50, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "countriesCount" : 2, + "dataType" : "Application", + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "asnsCount" : 10, + "included" : true, + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" + }, { + "interfacesCount" : 15, + "locationsCount" : 50, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "countriesCount" : 2, + "dataType" : "Application", + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "asnsCount" : 10, + "included" : true, + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "providerName" : "Amazon Web Services", + "providerType" : "IAAS", + "region" : "North America", + "location" : "San Jose, US", + "asn" : "Amazon.com, Inc.", + "included" : true + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_catalog_provider": OperationExpectation( + operation_id="get_catalog_provider", + method="GET", + path="/internet-insights/catalog/providers/{providerId}", + path_param_examples={ + "providerId": '85602a0a-54a7-4e97-946e-67492ef1fa26', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dataType" : "Application", + "asns" : [ { + "name" : "LVLT-1 - Level 3 Communications, Inc.", + "id" : 1 + }, { + "name" : "LVLT-1 - Level 3 Communications, Inc.", + "id" : 1 + } ], + "locations" : [ { + "interfacesCount" : 5, + "location" : "San Jose, US" + }, { + "interfacesCount" : 5, + "location" : "San Jose, US" + } ], + "id" : "85602a0a-54a7-4e97-946e-67492ef1fa26", + "region" : "North America", + "providerName" : "Amazon Web Services", + "providerType" : "IAAS" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "filter_outages": OperationExpectation( + operation_id="filter_outages", + method="POST", + path="/internet-insights/outages/filter", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "outages" : [ { + "affectedInterfacesCount" : 1, + "endDate" : "2022-03-01T23:31:11Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "affectedLocationsCount" : 1, + "endRoundId" : 1646177700, + "affectedTestsCount" : 1, + "type" : "app", + "providerType" : "SAAS", + "duration" : 214, + "startRoundId" : 1646177400, + "name" : "Google", + "id" : "xxxxxxxxxxxxxxxxxx1", + "affectedServersCount" : 2, + "asn" : 19994, + "providerName" : "Google", + "startDate" : "2022-03-01T23:31:11Z" + }, { + "affectedInterfacesCount" : 1, + "endDate" : "2022-03-01T23:31:11Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "affectedLocationsCount" : 1, + "endRoundId" : 1646177700, + "affectedTestsCount" : 1, + "type" : "app", + "providerType" : "SAAS", + "duration" : 214, + "startRoundId" : 1646177400, + "name" : "Google", + "id" : "xxxxxxxxxxxxxxxxxx1", + "affectedServersCount" : 2, + "asn" : 19994, + "providerName" : "Google", + "startDate" : "2022-03-01T23:31:11Z" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "startDate" : "2022-03-01T01:30:00Z", + "endDate" : "2022-03-01T23:30:15Z", + "outageScope" : "all", + "providerName" : [ "Telia", "Amazon" ], + "interfaceNetwork" : [ "Telianet", "Cloudflare" ], + "applicationName" : [ "slack", "facebook" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_app_outage": OperationExpectation( + operation_id="get_app_outage", + method="GET", + path="/internet-insights/outages/app/{outageId}", + path_param_examples={ + "outageId": 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0', + }, + success_status=200, + success_body=json.loads(""" + + { + "affectedDomains" : [ "amazon.com", "amazon.com" ], + "affectedTests" : [ { + "name" : "amazon-test2", + "id" : 5 + }, { + "name" : "amazon-test2", + "id" : 5 + } ], + "endDate" : "2023-01-27T20:53:51.256Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "endRoundId" : 1674852600, + "providerType" : "SAAS", + "duration" : 180, + "startRoundId" : 1674852600, + "affectedAgents" : [ { + "name" : "London, England", + "id" : 11 + }, { + "name" : "London, England", + "id" : 11 + } ], + "id" : "0CC4C4209887126DE42E92252FB43962CBB3193147F318EA", + "providerName" : "Amazon Web Services", + "applicationName" : "Amazon Web Services", + "startDate" : "2023-01-27T20:50:51.256Z", + "errors" : [ "HTTP_SERVER_TIMEOUT", "HTTP_SERVER_TIMEOUT" ], + "affectedLocations" : [ { + "location" : "Chicago, Illinois, US", + "affectedServers" : [ { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + }, { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + } ] + }, { + "location" : "Chicago, Illinois, US", + "affectedServers" : [ { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + }, { + "prefix" : "123.176.185.0/23", + "domain" : "amazon.com" + } ] + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_network_outage": OperationExpectation( + operation_id="get_network_outage", + method="GET", + path="/internet-insights/outages/net/{outageId}", + path_param_examples={ + "outageId": '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F', + }, + success_status=200, + success_body=json.loads(""" + + { + "affectedDomains" : [ "periodic-failure.com", "periodic-failure.com" ], + "affectedTests" : [ { + "name" : "amazon-test2", + "id" : 5 + }, { + "name" : "amazon-test2", + "id" : 5 + } ], + "endDate" : "2023-01-27T20:53:51.256Z", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "networkName" : "Rackspace Hosting", + "endRoundId" : 1674852600, + "providerType" : "IAAS", + "duration" : 180, + "startRoundId" : 1674852600, + "affectedAgents" : [ { + "name" : "London, England", + "id" : 11 + }, { + "name" : "London, England", + "id" : 11 + } ], + "id" : "8EF2760862C705783A2F8BCBAAABB44F28DBC670DBA3B610", + "asn" : 19994, + "providerName" : "Rackspace", + "startDate" : "2023-01-27T20:50:51.256Z", + "affectedLocations" : [ { + "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ], + "location" : "Chicago, Illinois, US" + }, { + "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ], + "location" : "Chicago, Illinois, US" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py b/thousandeyes-sdk-internet-insights/test/test_internet_insights_catalog_providers_api_integration.py new file mode 100644 index 00000000..689bbf01 --- /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 00000000..cd7d3990 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-internet-insights/test/test_utils.py +++ b/thousandeyes-sdk-internet-insights/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-snapshots/.openapi-generator/FILES b/thousandeyes-sdk-snapshots/.openapi-generator/FILES index 88c13d48..ea6466d9 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 4237ce5f..4d008daf 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.97 - 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 5bdeeb96..8615d20c 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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-snapshots/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-snapshots/test/integration_test_utils.py b/thousandeyes-sdk-snapshots/test/integration_test_utils.py new file mode 100644 index 00000000..f7109bbb --- /dev/null +++ b/thousandeyes-sdk-snapshots/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Test Snapshots API + + Creates a new test snapshot in ThousandEyes. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-snapshots/test/mock_manifest.py b/thousandeyes-sdk-snapshots/test/mock_manifest.py new file mode 100644 index 00000000..0b88c58d --- /dev/null +++ b/thousandeyes-sdk-snapshots/test/mock_manifest.py @@ -0,0 +1,213 @@ +# coding: utf-8 + +""" + Test Snapshots API + + Creates a new test snapshot in ThousandEyes. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_test_snapshot": OperationExpectation( + operation_id="create_test_snapshot", + method="POST", + path="/tests/{testId}/snapshot", + path_param_examples={ + "testId": '202701', + }, + success_status=201, + success_body=json.loads(""" + + { + "shareDate" : "2023-06-06T00:00:00Z", + "uid" : "281474976810911", + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "startRoundId" : 1538784000, + "displayName" : "Snapshot created through API", + "endRoundId" : 1538787600, + "testId" : "281474976710801", + "extraParams" : "params", + "id" : "wdiac", + "roundId" : 1538784000, + "sourceTestId" : "281474976710706" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "endDate" : "2023-06-06T01:00:00Z", + "displayName" : "Snapshot created through API", + "isPublic" : false, + "startDate" : "2023-06-06T00:00:00Z" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py b/thousandeyes-sdk-snapshots/test/test_test_snapshots_api_integration.py new file mode 100644 index 00000000..a8bf42de --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-snapshots/test/test_utils.py +++ b/thousandeyes-sdk-snapshots/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-streaming/.openapi-generator/FILES b/thousandeyes-sdk-streaming/.openapi-generator/FILES index fcda2a9e..28854bab 100644 --- a/thousandeyes-sdk-streaming/.openapi-generator/FILES +++ b/thousandeyes-sdk-streaming/.openapi-generator/FILES @@ -72,5 +72,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 902038d8..978b75cf 100644 --- a/thousandeyes-sdk-streaming/README.md +++ b/thousandeyes-sdk-streaming/README.md @@ -24,7 +24,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.97 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator @@ -98,7 +98,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 diff --git a/thousandeyes-sdk-streaming/docs/StreamingApi.md b/thousandeyes-sdk-streaming/docs/StreamingApi.md index ebf24a0c..dd20f1c7 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/test/conftest.py b/thousandeyes-sdk-streaming/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-streaming/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-streaming/test/integration_test_utils.py b/thousandeyes-sdk-streaming/test/integration_test_utils.py new file mode 100644 index 00000000..20108a9f --- /dev/null +++ b/thousandeyes-sdk-streaming/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + ThousandEyes for OpenTelemetry API + + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * OTel-based integrations that rely on connectors and operations, including: * Splunk Cloud Platform HEC * Splunk Enterprise HEC * Splunk Observability APM * Dynatrace Observability APM ThousandEyes for OpenTelemetry provides machine-to-machine integration between ThousandEyes and its customers. It allows you to export ThousandEyes telemetry data in OTel format, which is widely used in the industry. With ThousandEyes for OTel, you can leverage frameworks widely used in the observability domain - such as Splunk, Grafana, and Honeycomb - to capture and analyze ThousandEyes data. Any client that supports OTel can use ThousandEyes for OpenTelemetry. ThousandEyes for OTel is made up of the following components: * Data streaming APIs that you can use to configure and enable your ThousandEyes tests with OTel-compatible streams, in particular to configure how ThousandEyes telemetry data is exported to client integrations. * A set of streaming pipelines called _collectors_ that actively fetch ThousandEyes network test data, enrich the data with some additional detail, filter, and push the data to the customer-configured endpoints, depending on what you configure via the public APIs. * Third-party OTel collectors that receive, transform, filter, and export different metrics to client applications such as AppD, or any other OTel-capable client configuration. For more information about ThousandEyes for OpenTelemetry, see the [product documentation](https://docs.thousandeyes.com/product-documentation/integration-guides/opentelemetry). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-streaming/test/mock_manifest.py b/thousandeyes-sdk-streaming/test/mock_manifest.py new file mode 100644 index 00000000..88dd4618 --- /dev/null +++ b/thousandeyes-sdk-streaming/test/mock_manifest.py @@ -0,0 +1,759 @@ +# coding: utf-8 + +""" + ThousandEyes for OpenTelemetry API + + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * OTel-based integrations that rely on connectors and operations, including: * Splunk Cloud Platform HEC * Splunk Enterprise HEC * Splunk Observability APM * Dynatrace Observability APM ThousandEyes for OpenTelemetry provides machine-to-machine integration between ThousandEyes and its customers. It allows you to export ThousandEyes telemetry data in OTel format, which is widely used in the industry. With ThousandEyes for OTel, you can leverage frameworks widely used in the observability domain - such as Splunk, Grafana, and Honeycomb - to capture and analyze ThousandEyes data. Any client that supports OTel can use ThousandEyes for OpenTelemetry. ThousandEyes for OTel is made up of the following components: * Data streaming APIs that you can use to configure and enable your ThousandEyes tests with OTel-compatible streams, in particular to configure how ThousandEyes telemetry data is exported to client integrations. * A set of streaming pipelines called _collectors_ that actively fetch ThousandEyes network test data, enrich the data with some additional detail, filter, and push the data to the customer-configured endpoints, depending on what you configure via the public APIs. * Third-party OTel collectors that receive, transform, filter, and export different metrics to client applications such as AppD, or any other OTel-capable client configuration. For more information about ThousandEyes for OpenTelemetry, see the [product documentation](https://docs.thousandeyes.com/product-documentation/integration-guides/opentelemetry). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_stream": OperationExpectation( + operation_id="create_stream", + method="POST", + path="/streams", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "createdBy" : 3962 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "BAD_REQUEST", + "errors" : [ "JSON parse error: invalid type", "JSON parse error: invalid type" ], + "timestamp" : 1679677853573 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "412": ErrorResponseExpectation( + status=412, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "PRECONDITION_FAILED", + "errors" : [ "User cannot create more than 5 integrations", "User cannot create more than 5 integrations" ], + "timestamp" : 1679677853573 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_stream": OperationExpectation( + operation_id="delete_stream", + method="DELETE", + path="/streams/{id}", + path_param_examples={ + "id": 'id_example', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_stream": OperationExpectation( + operation_id="get_stream", + method="GET", + path="/streams/{id}", + path_param_examples={ + "id": 'id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_streams": OperationExpectation( + operation_id="get_streams", + method="GET", + path="/streams", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + [ { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + }, { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } ] + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "BAD_REQUEST", + "errors" : [ "JSON parse error: invalid type", "JSON parse error: invalid type" ], + "timestamp" : 1679677853573 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_stream": OperationExpectation( + operation_id="update_stream", + method="PUT", + path="/streams/{id}", + path_param_examples={ + "id": 'id_example', + }, + success_status=200, + success_body=json.loads(""" + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + }, + "enabled" : true + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "BAD_REQUEST", + "errors" : [ "JSON parse error: invalid type", "JSON parse error: invalid type" ], + "timestamp" : 1679677853573 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py b/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py new file mode 100644 index 00000000..01fff3ef --- /dev/null +++ b/thousandeyes-sdk-streaming/test/test_streaming_api_integration.py @@ -0,0 +1,1404 @@ +# coding: utf-8 + +""" + ThousandEyes for OpenTelemetry API + + **Note:** The following ThousandEyes for OpenTelemetry API capabilities are not available for ThousandEyes for Government instance: * Traces * OTel-based integrations that rely on connectors and operations, including: * Splunk Cloud Platform HEC * Splunk Enterprise HEC * Splunk Observability APM * Dynatrace Observability APM ThousandEyes for OpenTelemetry provides machine-to-machine integration between ThousandEyes and its customers. It allows you to export ThousandEyes telemetry data in OTel format, which is widely used in the industry. With ThousandEyes for OTel, you can leverage frameworks widely used in the observability domain - such as Splunk, Grafana, and Honeycomb - to capture and analyze ThousandEyes data. Any client that supports OTel can use ThousandEyes for OpenTelemetry. ThousandEyes for OTel is made up of the following components: * Data streaming APIs that you can use to configure and enable your ThousandEyes tests with OTel-compatible streams, in particular to configure how ThousandEyes telemetry data is exported to client integrations. * A set of streaming pipelines called _collectors_ that actively fetch ThousandEyes network test data, enrich the data with some additional detail, filter, and push the data to the customer-configured endpoints, depending on what you configure via the public APIs. * Third-party OTel collectors that receive, transform, filter, and export different metrics to client applications such as AppD, or any other OTel-capable client configuration. For more information about ThousandEyes for OpenTelemetry, see the [product documentation](https://docs.thousandeyes.com/product-documentation/integration-guides/opentelemetry). + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.streaming.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.streaming.api.streaming_api import StreamingApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestStreamingApiIntegration(IntegrationTestBase): + """StreamingApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = StreamingApi(self.api_client) + + + def test_create_stream_happy_path(self) -> None: + """Integration test for create_stream success path""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """ + stream = thousandeyes_sdk.streaming.models.Stream.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "createdBy" : 3962 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_stream( + + aid=aid, + + stream=stream, + + _headers=self.te_headers("create_stream"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_stream_error_400(self) -> None: + """Integration test for create_stream error path (HTTP 400)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """ + stream = thousandeyes_sdk.streaming.models.Stream.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "BAD_REQUEST", + "errors" : [ "JSON parse error: invalid type", "JSON parse error: invalid type" ], + "timestamp" : 1679677853573 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.create_stream( + + aid=aid, + + stream=stream, + + _headers=self.te_headers("create_stream", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_stream_error_401(self) -> None: + """Integration test for create_stream error path (HTTP 401)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """ + stream = thousandeyes_sdk.streaming.models.Stream.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.create_stream( + + aid=aid, + + stream=stream, + + _headers=self.te_headers("create_stream", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_stream_error_412(self) -> None: + """Integration test for create_stream error path (HTTP 412)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """ + stream = thousandeyes_sdk.streaming.models.Stream.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "PRECONDITION_FAILED", + "errors" : [ "User cannot create more than 5 integrations", "User cannot create more than 5 integrations" ], + "timestamp" : 1679677853573 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(412) + ) as context: + self.api.create_stream( + + aid=aid, + + stream=stream, + + _headers=self.te_headers("create_stream", error_status="412"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_create_stream_error_500(self) -> None: + """Integration test for create_stream error path (HTTP 500)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "dataModelVersion" : "v2", + "enabled" : true, + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "signal" : "metric", + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + + """ + stream = thousandeyes_sdk.streaming.models.Stream.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.create_stream( + + aid=aid, + + stream=stream, + + _headers=self.te_headers("create_stream", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_delete_stream_happy_path(self) -> None: + """Integration test for delete_stream success path""" + id = 'id_example' + aid = '1234' + response = self.api.delete_stream_with_http_info( + + id=id, + + aid=aid, + + _headers=self.te_headers("delete_stream"), + ) + self.assertEqual(204, response.status_code) + self.assertIsNone(response.data) + + + def test_delete_stream_error_401(self) -> None: + """Integration test for delete_stream error path (HTTP 401)""" + id = 'id_example' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.delete_stream( + + id=id, + + aid=aid, + + _headers=self.te_headers("delete_stream", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_delete_stream_error_500(self) -> None: + """Integration test for delete_stream error path (HTTP 500)""" + id = 'id_example' + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.delete_stream( + + id=id, + + aid=aid, + + _headers=self.te_headers("delete_stream", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_stream_happy_path(self) -> None: + """Integration test for get_stream success path""" + id = 'id_example' + aid = '1234' + response_body_json = """ + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_stream( + + id=id, + + aid=aid, + + _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" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + }, { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } ] + """ + expected_response = json.loads(response_body_json) + response = self.api.get_streams( + + aid=aid, + + _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" + } ], + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + }, + "enabled" : true + } + + """ + put_stream = thousandeyes_sdk.streaming.models.PutStream.from_json(request_body_json) + id = 'id_example' + aid = '1234' + response_body_json = """ + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointType" : "grpc", + "_links" : { + "self" : { + "href" : "https://api.thousandeyes.com/v7/streams/575766da-9664-4e85-94fe-facbe1154799" + } + }, + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "type" : "opentelemetry", + "enabled" : true, + "dataModelVersion" : "v2", + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "id" : "342ieu09", + "streamStatus" : { + "lastSuccess" : 1679677853573, + "lastFailure" : 1679677853573, + "status" : "connected" + }, + "signal" : "metric", + "auditOperation" : { + "createdDate" : 1679677853573, + "updatedBy" : 3962, + "createdBy" : 3962, + "updatedDate" : 1679677853573 + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_stream( + + id=id, + + aid=aid, + + put_stream=put_stream, + + _headers=self.te_headers("update_stream"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_stream_error_400(self) -> None: + """Integration test for update_stream error path (HTTP 400)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + }, + "enabled" : true + } + + """ + put_stream = thousandeyes_sdk.streaming.models.PutStream.from_json(request_body_json) + id = 'id_example' + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/streams", + "httpStatus" : "BAD_REQUEST", + "errors" : [ "JSON parse error: invalid type", "JSON parse error: invalid type" ], + "timestamp" : 1679677853573 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.update_stream( + + id=id, + + aid=aid, + + put_stream=put_stream, + + _headers=self.te_headers("update_stream", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_stream_error_401(self) -> None: + """Integration test for update_stream error path (HTTP 401)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + }, + "enabled" : true + } + + """ + put_stream = thousandeyes_sdk.streaming.models.PutStream.from_json(request_body_json) + id = 'id_example' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.update_stream( + + id=id, + + aid=aid, + + put_stream=put_stream, + + _headers=self.te_headers("update_stream", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_update_stream_error_500(self) -> None: + """Integration test for update_stream error path (HTTP 500)""" + request_body_json = """ + + { + "endpointAgentLabel" : [ { + "id" : "1234" + }, { + "id" : "1234" + } ], + "endpointAgentTag" : [ { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + }, { + "id" : "91863f70-e5a6-4a1c-a266-caf02db3607d" + } ], + "testMatch" : [ { + "id" : "1234", + "domain" : "cea" + }, { + "id" : "5678", + "domain" : "endpoint" + } ], + "streamEndpointUrl" : "https://api.thousandeyes.otel-collector", + "exporterConfig" : { + "authorization" : { + "oAuth2" : { + "clientId" : "1234567890", + "tokenUrl" : "https://example.com/token", + "clientSecret" : "1234567890", + "scopes" : [ "read", "write" ] + } + }, + "splunkHec" : { + "sourceType" : "ThousandEyesOTel", + "index" : "thousandeyes_otel_events_index", + "source" : "ThousandEyesOTel", + "token" : "d0a91307-be2f-4218-a9f8-71c02d98846b" + } + }, + "tagMatch" : [ { + "key" : "keyA", + "value" : "valueA" + }, { + "key" : "keyB", + "value" : "valueB" + } ], + "filters" : { + "testTypes" : { + "values" : [ "agent-to-server", "bgp", "http-server" ] + } + }, + "customHeaders" : { + "Authorization" : "*****", + "Content-Type" : "*****" + }, + "enabled" : true + } + + """ + put_stream = thousandeyes_sdk.streaming.models.PutStream.from_json(request_body_json) + id = 'id_example' + aid = '1234' + error_body_json = """ + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.update_stream( + + id=id, + + aid=aid, + + put_stream=put_stream, + + _headers=self.te_headers("update_stream", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-streaming/test/test_utils.py b/thousandeyes-sdk-streaming/test/test_utils.py index 930528d9..37913f62 100644 --- a/thousandeyes-sdk-streaming/test/test_utils.py +++ b/thousandeyes-sdk-streaming/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-tags/.openapi-generator/FILES b/thousandeyes-sdk-tags/.openapi-generator/FILES index 2bfbde68..f6df16c3 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 09a4b480..bca7ab24 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.97 - 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 91dd869a..1d46cf8f 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: @@ -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: @@ -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: diff --git a/thousandeyes-sdk-tags/docs/TagsApi.md b/thousandeyes-sdk-tags/docs/TagsApi.md index 0c5c03f2..3e373059 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 = # TagInfo | Tag resource (optional) try: # Create tag @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/thousandeyes-sdk-tags/test/conftest.py b/thousandeyes-sdk-tags/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-tags/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-tags/test/integration_test_utils.py b/thousandeyes-sdk-tags/test/integration_test_utils.py new file mode 100644 index 00000000..38df1ff2 --- /dev/null +++ b/thousandeyes-sdk-tags/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Tags API + + The ThousandEyes Tags API provides a tagging system with key/value pairs. It allows you to tag assets within the ThousandEyes platform (such as agents, tests, or dashboards) with meaningful metadata. For example: `branch:sfo`, `branch:nyc`, and `team:netops`. This feature provides: * Support for automation. * Powerful and flexible reports/dashboards. * Support for third-party integrations. Things to note with the ThousandEyes Tags API: * Tags are backwards-compatible with existing labels. * Tags are separated by Tests (CEA), Agents (CEA), Endpoint Agents, Scheduled Endpoint Tests, and Reports. A single tag can only apply to one type of target object, so each tag must specify the target type of object via a `type` field. * Tags are defined in a single table so that they can be represented using a single model - `Tag`. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-tags/test/mock_manifest.py b/thousandeyes-sdk-tags/test/mock_manifest.py new file mode 100644 index 00000000..6d951851 --- /dev/null +++ b/thousandeyes-sdk-tags/test/mock_manifest.py @@ -0,0 +1,1774 @@ +# coding: utf-8 + +""" + Tags API + + The ThousandEyes Tags API provides a tagging system with key/value pairs. It allows you to tag assets within the ThousandEyes platform (such as agents, tests, or dashboards) with meaningful metadata. For example: `branch:sfo`, `branch:nyc`, and `team:netops`. This feature provides: * Support for automation. * Powerful and flexible reports/dashboards. * Support for third-party integrations. Things to note with the ThousandEyes Tags API: * Tags are backwards-compatible with existing labels. * Tags are separated by Tests (CEA), Agents (CEA), Endpoint Agents, Scheduled Endpoint Tests, and Reports. A single tag can only apply to one type of target object, so each tag must specify the target type of object via a `type` field. * Tags are defined in a single table so that they can be represented using a single model - `Tag`. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "assign_tag": OperationExpectation( + operation_id="assign_tag", + method="POST", + path="/tags/{id}/assign", + path_param_examples={ + "id": 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55', + }, + success_status=207, + success_body=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """), + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "assign_tags": OperationExpectation( + operation_id="assign_tags", + method="POST", + path="/tags/assign", + path_param_examples={ + }, + success_status=207, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } ] + } + + """), + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "unassign_tag": OperationExpectation( + operation_id="unassign_tag", + method="POST", + path="/tags/{id}/unassign", + path_param_examples={ + "id": 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ] + } + + """), + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "unassign_tags": OperationExpectation( + operation_id="unassign_tags", + method="POST", + path="/tags/unassign", + path_param_examples={ + }, + success_status=207, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } ] + } + + """), + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_tag": OperationExpectation( + operation_id="create_tag", + method="POST", + path="/tags", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_tags": OperationExpectation( + operation_id="create_tags", + method="POST", + path="/tags/bulk", + path_param_examples={ + }, + success_status=207, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "errors" : [ { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + }, { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + } ], + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "errors" : [ { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + }, { + "tag" : { + "key" : { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + }, + "message" : "Object successfully created", + "responseCode" : 200 + } ], + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_tag": OperationExpectation( + operation_id="delete_tag", + method="DELETE", + path="/tags/{id}", + path_param_examples={ + "id": 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_tag": OperationExpectation( + operation_id="get_tag", + method="GET", + path="/tags/{id}", + path_param_examples={ + "id": 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55', + }, + success_status=200, + success_body=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_tags": OperationExpectation( + operation_id="get_tags", + method="GET", + path="/tags", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "tags" : [ { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + }, { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_tag": OperationExpectation( + operation_id="update_tag", + method="PUT", + path="/tags/{id}", + path_param_examples={ + "id": 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55', + }, + success_status=200, + success_body=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "assignments" : [ { + "id" : "123", + "type" : "test" + }, { + "id" : "123", + "type" : "test" + } ], + "color" : "#FF0000", + "matchType" : "and", + "builtIn" : true, + "icon" : "icon", + "description" : "To tag assets in San Francisco", + "filters" : [ { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + }, { + "mode" : "in", + "values" : [ "10.1.1.0/24", "192.168.1.0/24" ], + "scope" : "custom", + "key" : "vpn-client-network" + } ], + "type" : "static", + "objectType" : "test", + "accessType" : "all", + "modifiedDate" : "2022-03-01T23:31:11Z", + "legacyId" : 0.8008281904610115, + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "aid" : 1234, + "value" : "sfo", + "key" : "branch", + "createDate" : "2022-03-01T23:31:11Z" + } + + """), + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "path" : "https://api.thousandeyes.com/v7/request/path", + "errors" : "Internal Server Error", + "timestamp" : 1679677853573, + "status" : 500 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py b/thousandeyes-sdk-tags/test/test_tag_assignment_api_integration.py new file mode 100644 index 00000000..692a2599 --- /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 00000000..c2652462 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-tags/test/test_utils.py +++ b/thousandeyes-sdk-tags/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-test-results/.openapi-generator/FILES b/thousandeyes-sdk-test-results/.openapi-generator/FILES index 641dee9c..a2c2bc97 100644 --- a/thousandeyes-sdk-test-results/.openapi-generator/FILES +++ b/thousandeyes-sdk-test-results/.openapi-generator/FILES @@ -198,16 +198,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 431001c1..893eb2cd 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.97 - Generator version: 7.6.0 - Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator diff --git a/thousandeyes-sdk-test-results/docs/NetworkTestResultsApi.md b/thousandeyes-sdk-test-results/docs/NetworkTestResultsApi.md index 03314992..c18ec3dd 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 660cab17..7f528448 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/test/conftest.py b/thousandeyes-sdk-test-results/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-test-results/test/integration_test_utils.py b/thousandeyes-sdk-test-results/test/integration_test_utils.py new file mode 100644 index 00000000..27d6ab3a --- /dev/null +++ b/thousandeyes-sdk-test-results/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-test-results/test/mock_manifest.py b/thousandeyes-sdk-test-results/test/mock_manifest.py new file mode 100644 index 00000000..1317b5e7 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/mock_manifest.py @@ -0,0 +1,6272 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "get_test_api_agent_round_results": OperationExpectation( + operation_id="get_test_api_agent_round_results", + method="GET", + path="/test-results/{testId}/api/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "requests" : [ { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + }, { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "requests" : [ { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + }, { + "completion" : 100, + "stepType" : "default", + "responseTime" : 440.8, + "apiCallTime" : 900.9, + "processingTime" : 59.9, + "url" : "https://api.thousandeyes.com/v7/status", + "sendTime" : 8.1, + "receiveTime" : 224.1, + "connectTime" : 12.1, + "dnsTime" : 11.1, + "name" : "First Step to Acquire Token", + "stepNumber" : 1, + "assertions" : [ { + "hasFailed" : false, + "step" : 1 + }, { + "hasFailed" : false, + "step" : 1 + } ], + "assertErrorCount" : 0, + "blockedTime" : 49.9, + "stepTime" : 990.1, + "waitTime" : 18.1 + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_api_results": OperationExpectation( + operation_id="get_test_api_results", + method="GET", + path="/test-results/{testId}/api", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "completion" : 100, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "errorType" : "None", + "apiTransactionTime" : 990.1, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_dns_sec_results": OperationExpectation( + operation_id="get_test_dns_sec_results", + method="GET", + path="/test-results/{testId}/dnssec", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isValid" : true, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "isValid" : true, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_dns_server_result": OperationExpectation( + operation_id="get_test_dns_server_result", + method="GET", + path="/test-results/{testId}/dns-server/{serverId}", + path_param_examples={ + "testId": '202701', + "serverId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_dns_servers_results": OperationExpectation( + operation_id="get_test_dns_servers_results", + method="GET", + path="/test-results/{testId}/dns-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "a1.verisigndns.com.", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "mappings" : "208.185.7.120", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "resolutionTime" : 3, + "roundId" : 1384309800, + "serverId" : "456", + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_dns_trace_results": OperationExpectation( + operation_id="get_test_dns_trace_results", + method="GET", + path="/test-results/{testId}/dns-trace", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "finalServerQueried" : "a1.verisigndns.com.", + "finalQueryTime" : 178, + "queries" : 3, + "failedQueries" : 0, + "output" : "com.\\t172800\\tIN\\tNS\\ta.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tf.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tc.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tb.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\td.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\te.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tg.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tm.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\th.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tj.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\ti.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tl.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tk.gtld-servers.net.\\n;; Received 498 bytes from 199.7.91.13(d.root-servers.net.) in 119 ms\\n\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta1.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta2.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta3.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\tu1.verisigndns.com.\\n;; Received 266 bytes from 192.5.6.30(a.gtld-servers.net.) in 178 ms\\n\\napp.thousandeyes.com.\\t300\\tIN\\tCNAME\\tweb.thousandeyes.com.\\nweb.thousandeyes.com.\\t300\\tIN\\tCNAME\\tlb-app.thousandeyes.com.\\nlb-app.thousandeyes.com.\\t3600\\tIN\\tA\\t208.185.7.120\\n;; Received 173 bytes from 209.112.113.33(a1.verisigndns.com.) in 178 ms\\n\\n", + "mappings" : "208.185.7.120", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "finalServerQueried" : "a1.verisigndns.com.", + "finalQueryTime" : 178, + "queries" : 3, + "failedQueries" : 0, + "output" : "com.\\t172800\\tIN\\tNS\\ta.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tf.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tc.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tb.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\td.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\te.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tg.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tm.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\th.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tj.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\ti.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tl.gtld-servers.net.\\ncom.\\t172800\\tIN\\tNS\\tk.gtld-servers.net.\\n;; Received 498 bytes from 199.7.91.13(d.root-servers.net.) in 119 ms\\n\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta1.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta2.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\ta3.verisigndns.com.\\nthousandeyes.com.\\t172800\\tIN\\tNS\\tu1.verisigndns.com.\\n;; Received 266 bytes from 192.5.6.30(a.gtld-servers.net.) in 178 ms\\n\\napp.thousandeyes.com.\\t300\\tIN\\tCNAME\\tweb.thousandeyes.com.\\nweb.thousandeyes.com.\\t300\\tIN\\tCNAME\\tlb-app.thousandeyes.com.\\nlb-app.thousandeyes.com.\\t3600\\tIN\\tA\\t208.185.7.120\\n;; Received 173 bytes from 209.112.113.33(a1.verisigndns.com.) in 178 ms\\n\\n", + "mappings" : "208.185.7.120", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_bgp_results": OperationExpectation( + operation_id="get_test_bgp_results", + method="GET", + path="/test-results/{testId}/bgp", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "reachability" : 0, + "updates" : 0, + "pathChanges" : 0, + "roundId" : 1384309800, + "prefixId" : "215" + }, { + "date" : "2022-07-17T22:00:54Z", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "reachability" : 0, + "updates" : 0, + "pathChanges" : 0, + "roundId" : 1384309800, + "prefixId" : "215" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_bgp_routes_prefix_round_results": OperationExpectation( + operation_id="get_test_bgp_routes_prefix_round_results", + method="GET", + path="/test-results/{testId}/bgp/routes/prefix/{prefixId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "prefixId": '3789376546', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "hops" : [ { + "asName" : "Telus Advanced Communications", + "asn" : 852 + }, { + "asName" : "Telus Advanced Communications", + "asn" : 852 + } ], + "isActive" : true, + "roundId" : 1384309800, + "prefixId" : "215" + }, { + "date" : "2022-07-17T22:00:54Z", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "prefix" : "99.128.0.0/11", + "monitor" : { + "monitorId" : "281474976710706", + "monitorName" : "Vancouver, Canada - Bell Canada (AS 6539)", + "countryId" : "US" + }, + "hops" : [ { + "asName" : "Telus Advanced Communications", + "asn" : 852 + }, { + "asName" : "Telus Advanced Communications", + "asn" : 852 + } ], + "isActive" : true, + "roundId" : 1384309800, + "prefixId" : "215" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_network_results": OperationExpectation( + operation_id="get_test_network_results", + method="GET", + path="/test-results/{testId}/network", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.thousandeyes.com:80", + "availableBandwidth" : 9.100464, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "minLatency" : 167, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "maxLatency" : 168, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "startTime" : 1384309800, + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "roundId" : 1384309800, + "direction" : "to-target" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.thousandeyes.com:80", + "availableBandwidth" : 9.100464, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "minLatency" : 167, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "maxLatency" : 168, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "startTime" : 1384309800, + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "roundId" : 1384309800, + "direction" : "to-target" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_path_vis_agent_round_results": OperationExpectation( + operation_id="get_test_path_vis_agent_round_results", + method="GET", + path="/test-results/{testId}/path-vis/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + }, { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + }, { + "hops" : [ { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + }, { + "rdns" : "core-router1.cpt2.host-h.net", + "prefix" : "196.40.96.0/20", + "responseTime" : 1, + "hop" : 1, + "ipAddress" : "196.40.106.237", + "mpls" : "mpls", + "location" : "Cape Town, South Africa", + "network" : "HETZNER (Pty) Ltd (AS 37153)" + } ], + "pathId" : "4711301366345855606023718047703941305741293841502186803" + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_path_vis_results": OperationExpectation( + operation_id="get_test_path_vis_results", + method="GET", + path="/test-results/{testId}/path-vis", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + }, { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.google.com:443", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "targetIsProxy" : true, + "sourcePrefix" : "196.40.96.0/20", + "sourceIp" : "196.40.106.237", + "pathTraces" : [ { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + }, { + "numberOfHops" : 15, + "responseTime" : 1500, + "ipAddress" : "196.40.106.237", + "pathMtu" : 1500, + "pathId" : "1230899668701775614109128428722974545787322404682781961521", + "mss" : 1460 + } ], + "serverIp" : "172.217.170.68", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "direction" : "to-target" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_rtp_server_results": OperationExpectation( + operation_id="get_test_rtp_server_results", + method="GET", + path="/test-results/{testId}/rtp-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pdv" : 1, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dscpName" : "EF (DSCP 46)", + "latency" : 103, + "mos" : 4.351024, + "loss" : 0, + "dscp" : "46", + "codecMaxMos" : 4.41, + "discards" : 0, + "serverIp" : "172.97.102.37", + "errorDetail" : "Connection error", + "startTime" : 1384309800, + "endTime" : 1384309800, + "codecName" : "G.711 @ 64 Kbps", + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pdv" : 1, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dscpName" : "EF (DSCP 46)", + "latency" : 103, + "mos" : 4.351024, + "loss" : 0, + "dscp" : "46", + "codecMaxMos" : 4.41, + "discards" : 0, + "serverIp" : "172.97.102.37", + "errorDetail" : "Connection error", + "startTime" : 1384309800, + "endTime" : 1384309800, + "codecName" : "G.711 @ 64 Kbps", + "roundId" : 1384309800 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_sip_server_results": OperationExpectation( + operation_id="get_test_sip_server_results", + method="GET", + path="/test-results/{testId}/sip-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "numRedirects" : 0, + "registerTime" : 21, + "optionsTime" : 17, + "optionsRequest" : "OPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 3 OPTIONS\\r\\nContact: \\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n\\nOPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 4 OPTIONS\\r\\nContact: \\r\\nAuthorization: Digest username=\\"al6054\\", realm=\\"asterisk\\", nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\", uri=\\"sip:6054@voice.sfo2.notarealco.com\\", response=\\"83c538a39ff766cf75ffd1d62317b442\\", algorithm=MD5, cnonce=\\"0a4f113b\\", opaque=\\"748ffa241d840721\\", qop=auth, nc=00000001\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n", + "responseTime" : 12, + "totalTime" : 40, + "errorType" : "none", + "availability" : 100, + "responseCode" : 200, + "optionsResponse" : "SIP/2.0 401 Unauthorized\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 3 OPTIONS\\r\\nWWW-Authenticate: Digest realm=\\"asterisk\\",nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\",opaque=\\"748ffa241d840721\\",algorithm=md5,qop=\\"auth\\"\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n\\nSIP/2.0 200 OK\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 4 OPTIONS\\r\\nAccept: application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0\\r\\nAllow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER\\r\\nSupported: 100rel, timer, replaces, norefersub\\r\\nAccept-Encoding: text/plain\\r\\nAccept-Language: en\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n", + "problemDetail" : "problemDetail", + "connectTime" : 5, + "dnsTime" : 2, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "waitTime" : 5, + "inviteTime" : 10 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "numRedirects" : 0, + "registerTime" : 21, + "optionsTime" : 17, + "optionsRequest" : "OPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 3 OPTIONS\\r\\nContact: \\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n\\nOPTIONS sip:6054@voice.sfo2.notarealco.com SIP/2.0\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;branch=z9hG4bKRTzPzMoVh0;rport\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: \\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nCSeq: 4 OPTIONS\\r\\nContact: \\r\\nAuthorization: Digest username=\\"al6054\\", realm=\\"asterisk\\", nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\", uri=\\"sip:6054@voice.sfo2.notarealco.com\\", response=\\"83c538a39ff766cf75ffd1d62317b442\\", algorithm=MD5, cnonce=\\"0a4f113b\\", opaque=\\"748ffa241d840721\\", qop=auth, nc=00000001\\r\\nUser-Agent: ThousandEyes Test Call\\r\\nAllow: INVITE, ACK, CANCEL, BYE\\r\\nSupported: outbound, path\\r\\nMax-Forwards: 70\\r\\nExpires: 60\\r\\nContent-Length: 0\\r\\n\\r\\n", + "responseTime" : 12, + "totalTime" : 40, + "errorType" : "none", + "availability" : 100, + "responseCode" : 200, + "optionsResponse" : "SIP/2.0 401 Unauthorized\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 3 OPTIONS\\r\\nWWW-Authenticate: Digest realm=\\"asterisk\\",nonce=\\"1598728080/4e3bef2c789bdfa45ce9123221e08c8f\\",opaque=\\"748ffa241d840721\\",algorithm=md5,qop=\\"auth\\"\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n\\nSIP/2.0 200 OK\\r\\nVia: SIP/2.0/TCP 38.140.61.68:55431;rport=55431;received=38.140.61.68;branch=z9hG4bKRTzPzMoVh0\\r\\nCall-ID: oO9WaL3av8@38.140.61.68\\r\\nFrom: ;tag=cGaJDNKQFE\\r\\nTo: ;tag=z9hG4bKRTzPzMoVh0\\r\\nCSeq: 4 OPTIONS\\r\\nAccept: application/xpidf+xml, application/cpim-pidf+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/pidf+xml, application/dialog-info+xml, application/sdp, message/sipfrag;version=2.0\\r\\nAllow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER\\r\\nSupported: 100rel, timer, replaces, norefersub\\r\\nAccept-Encoding: text/plain\\r\\nAccept-Language: en\\r\\nServer: Asterisk PBX 16.4.0\\r\\nContent-Length: 0\\r\\n\\r\\n", + "problemDetail" : "problemDetail", + "connectTime" : 5, + "dnsTime" : 2, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800, + "waitTime" : 5, + "inviteTime" : 10 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_ftp_server_results": OperationExpectation( + operation_id="get_test_ftp_server_results", + method="GET", + path="/test-results/{testId}/ftp-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "transferTime" : 99.865, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "negotiationTime" : 503.413, + "responseTime" : 0.589, + "totalTime" : 705.554, + "errorType" : "None", + "responseCode" : 226, + "dnsTime" : 0.589, + "connectTime" : 50.153, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "waitTime" : 52.1, + "wireSize" : 22172, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "transferTime" : 99.865, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "negotiationTime" : 503.413, + "responseTime" : 0.589, + "totalTime" : 705.554, + "errorType" : "None", + "responseCode" : 226, + "dnsTime" : 0.589, + "connectTime" : 50.153, + "serverIp" : "193.2.1.88", + "startTime" : 1384309800, + "endTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "waitTime" : 52.1, + "wireSize" : 22172, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_http_server_results": OperationExpectation( + operation_id="get_test_http_server_results", + method="GET", + path="/test-results/{testId}/http-server", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "sslVersion" : "TLSv1.3", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "numRedirects" : 0, + "errorType" : "None", + "healthScore" : 0.98, + "responseCode" : 200, + "connectTime" : 2, + "startTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "sslCipher" : "sslCipher", + "redirectTime" : 10, + "sslCertificates" : [ { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + }, { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + } ], + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "sslTime" : 9, + "endTime" : 1384309800, + "waitTime" : 3, + "dnsServerMeasurement" : { + "usedDnsResponse" : { + "id" : 41837, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "noerror", + "question" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "answer" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 300, + "data" : "203.0.113.10" + } ], + "dnsResolver" : "8.8.8.8", + "timing" : { + "startTimeUs" : "1769706600000000", + "totalTimeUs" : 19304 + }, + "protocol" : "udp" + }, + "unusedDnsResponses" : [ { + "id" : 41838, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "nxdomain", + "question" : [ { + "name" : "www.example.com", + "type" : "aaaa", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "dnsResolver" : "8.8.4.4", + "timing" : { + "startTimeUs" : "1769706600020000", + "totalTimeUs" : 15420 + }, + "protocol" : "udp" + } ], + "usedHostsFile" : false, + "resolvedIp" : "203.0.113.10" + }, + "wireSize" : 9993, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "sslVersion" : "TLSv1.3", + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "numRedirects" : 0, + "errorType" : "None", + "healthScore" : 0.98, + "responseCode" : 200, + "connectTime" : 2, + "startTime" : 1384309800, + "throughput" : 123, + "roundId" : 1384309800, + "headers" : { + "requestHeaders" : "GET / HTTP/1.1\\r\\nHost: www.thousandeyes.com\\r\\nUser-Agent: curl/7.58.0-DEV\\r\\nAccept: */*\\r\\nAccept-Encoding: deflate, gzip\\r\\nX-ThousandEyes-Agent: yes\\r\\n", + "responseHeaders" : "HTTP/1.1 200 OK\\r\\nContent-Type: text/html;charset=UTF-8\\r\\nContent-Length: 9993\\r\\nConnection: keep-alive\\r\\nDate: Mon, 04 May 2020 16:13:00 GMT\\r\\nServer: Apache\\r\\nContent-Language: en-US\\r\\nContent-Encoding: gzip\\r\\nX-Frame-Options: sameorigin\\r\\nCache-Control: max-age=600, must-revalidate\\r\\nStrict-Transport-Security: max-age=31536000\\r\\nX-Content-Type-Options: nosniff\\r\\nX-XSS-Protection: 1; mode=block\\r\\nVary: Accept-Encoding\\r\\nX-Cache: Hit from cloudfront\\r\\nVia: 1.1 7ba3caf71ae7a52dd411d1a543e80cd8.cloudfront.net (CloudFront)\\r\\nX-Amz-Cf-Pop: SFO5-C3\\r\\nX-Amz-Cf-Id: w4h42tkoJD-rEpkRDZUvnQBmy26GVGe6pUsuRr1Dphf7oajYbjXaOA==\\r\\nAge: 132\\r\\n" + }, + "sslCipher" : "sslCipher", + "redirectTime" : 10, + "sslCertificates" : [ { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + }, { + "hasValidSigningCert" : false, + "issuerName" : "DigiCert SHA2 Extended Validation Server CA", + "subjectAlternativeNames" : [ "www.thousandeyes.com", "thousandeyes.com" ], + "isFetchDateInValidCertDateRange" : true, + "validBefore" : "2020-05-12T12:00:00Z", + "daysUntilExpiry" : 0, + "validAfter" : "2018-03-27T00:00:00Z", + "subjectName" : "www.thousandeyes.com" + } ], + "responseTime" : 14, + "totalTime" : 15, + "receiveTime" : 1, + "dnsTime" : 0, + "serverIp" : "193.2.1.88", + "sslTime" : 9, + "endTime" : 1384309800, + "waitTime" : 3, + "dnsServerMeasurement" : { + "usedDnsResponse" : { + "id" : 41837, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "noerror", + "question" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "answer" : [ { + "name" : "www.example.com", + "type" : "a", + "class" : "in", + "ttl" : 300, + "data" : "203.0.113.10" + } ], + "dnsResolver" : "8.8.8.8", + "timing" : { + "startTimeUs" : "1769706600000000", + "totalTimeUs" : 19304 + }, + "protocol" : "udp" + }, + "unusedDnsResponses" : [ { + "id" : 41838, + "qr" : "response", + "opcode" : "query", + "authoritativeAnswer" : false, + "truncation" : false, + "recursionDesired" : true, + "recursionAvailable" : true, + "zero" : false, + "authenticData" : false, + "checkingDisabled" : false, + "responseCode" : "nxdomain", + "question" : [ { + "name" : "www.example.com", + "type" : "aaaa", + "class" : "in", + "ttl" : 0, + "data" : "" + } ], + "dnsResolver" : "8.8.4.4", + "timing" : { + "startTimeUs" : "1769706600020000", + "totalTimeUs" : 15420 + }, + "protocol" : "udp" + } ], + "usedHostsFile" : false, + "resolvedIp" : "203.0.113.10" + }, + "wireSize" : 9993, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_page_load_agent_round_results": OperationExpectation( + operation_id="get_test_page_load_agent_round_results", + method="GET", + path="/test-results/{testId}/page-load/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "numErrors" : 0, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "responseTime" : 34.35, + "pageLoadTime" : 352, + "numObjects" : 17, + "totalSize" : 403301, + "domLoadTime" : 352, + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "numErrors" : 0, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "responseTime" : 34.35, + "pageLoadTime" : 352, + "numObjects" : 17, + "totalSize" : 403301, + "domLoadTime" : 352, + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "roundId" : 1384309800 + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_page_load_results": OperationExpectation( + operation_id="get_test_page_load_results", + method="GET", + path="/test-results/{testId}/page-load", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "totalSize" : 403301, + "numErrors" : 0, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "responseTime" : 34.35, + "domLoadTime" : 352, + "startTime" : 1384309800, + "pageLoadTime" : 352, + "endTime" : 1384309800, + "roundId" : 1384309800, + "numObjects" : 17 + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "totalSize" : 403301, + "numErrors" : 0, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "responseTime" : 34.35, + "domLoadTime" : 352, + "startTime" : 1384309800, + "pageLoadTime" : 352, + "endTime" : 1384309800, + "roundId" : 1384309800, + "numObjects" : 17 + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_web_transaction_agent_round_page_results": OperationExpectation( + operation_id="get_test_web_transaction_agent_round_page_results", + method="GET", + path="/test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId}/page/{pageId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + "pageId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "transactionTime" : 2379, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "transactionTime" : 2379, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_web_transaction_agent_round_results": OperationExpectation( + operation_id="get_test_web_transaction_agent_round_results", + method="GET", + path="/test-results/{testId}/web-transactions/agent/{agentId}/round/{roundId}", + path_param_examples={ + "testId": '202701', + "agentId": '11', + "roundId": '1384309800', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_web_transaction_results": OperationExpectation( + operation_id="get_test_web_transaction_results", + method="GET", + path="/test-results/{testId}/web-transactions", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_api_test_results_api_integration.py new file mode 100644 index 00000000..d9d14a54 --- /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 00000000..d813920f --- /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 00000000..70345c51 --- /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 00000000..18e9c670 --- /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 00000000..562ab1b2 --- /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_integration.py b/thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py new file mode 100644 index 00000000..d0cc370b --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_network_test_results_api_integration.py @@ -0,0 +1,1440 @@ +# 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", + "availableBandwidth" : 9.100464, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "minLatency" : 167, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "maxLatency" : 168, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "startTime" : 1384309800, + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "roundId" : 1384309800, + "direction" : "to-target" + }, { + "date" : "2022-07-17T22:00:54Z", + "server" : "www.thousandeyes.com:80", + "availableBandwidth" : 9.100464, + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ], + "avgLatency" : 167.04, + "bandwidth" : 4.3313155, + "minLatency" : 167, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "maxLatency" : 168, + "proxyJitter" : 1.2, + "proxyAverageLatency" : 45, + "proxyLoss" : 2.5, + "healthScore" : 0.98, + "capacity" : 210.10854, + "loss" : 0, + "proxyMinLatency" : 40, + "jitter" : 0.076808, + "serverIp" : "50.18.127.223", + "startTime" : 1384309800, + "endTime" : 1384309800, + "proxyMaxLatency" : 50, + "roundId" : 1384309800, + "direction" : "to-target" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_network_results( + + test_id=test_id, + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + _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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-test-results/test/test_utils.py +++ b/thousandeyes-sdk-test-results/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py b/thousandeyes-sdk-test-results/test/test_voice_rtp_server_test_results_api_integration.py new file mode 100644 index 00000000..7614c5e1 --- /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 00000000..73ccce68 --- /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 00000000..a4e01896 --- /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 00000000..7a846289 --- /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 00000000..79b7a674 --- /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_integration.py b/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py new file mode 100644 index 00000000..ad56db30 --- /dev/null +++ b/thousandeyes-sdk-test-results/test/test_web_transactions_test_results_api_integration.py @@ -0,0 +1,1794 @@ +# coding: utf-8 + +""" + Test Results API + + Get test result metrics for Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.test_results.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.test_results.api.web_transactions_test_results_api import WebTransactionsTestResultsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestWebTransactionsTestResultsApiIntegration(IntegrationTestBase): + """WebTransactionsTestResultsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = WebTransactionsTestResultsApi(self.api_client) + + + def test_get_test_web_transaction_agent_round_page_results_happy_path(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results success path""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + aid = '1234' + response_body_json = """ + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "transactionTime" : 2379, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "transactionTime" : 2379, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "har" : { + "log" : { + "creator" : { + "name" : "ThousandEyes DB Exporter" + }, + "entries" : [ { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://google.com/" + }, + "response" : { + "bodySize" : 220, + "content" : { + "mimeType" : "text/html", + "size" : 220 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "public, max-age=2592000" + }, { + "name" : "content-length", + "value" : "220" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "Sun, 15 Dec 2019 16:41:54 GMT" + }, { + "name" : "location", + "value" : "https://www.google.com/" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "status", + "value" : "301" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 471, + "redirectURL" : "", + "status" : 301, + "statusText" : "MOVED_PERMANENTLY" + }, + "serverIPAddress" : "172.217.6.110", + "startedDateTime" : "2019-11-15T16:41:54.798Z", + "time" : 71, + "timings" : { + "blocked" : 2, + "connect" : 16, + "dns" : 1, + "receive" : 1, + "send" : 0, + "ssl" : 14, + "wait" : 50 + } + }, { + "pageref" : "page_0", + "request" : { + "headers" : [ { + "name" : ":authority", + "value" : "www.google.com" + }, { + "name" : ":method", + "value" : "GET" + }, { + "name" : ":path", + "value" : "/" + }, { + "name" : ":scheme", + "value" : "https" + }, { + "name" : "accept", + "value" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" + }, { + "name" : "accept-encoding", + "value" : "gzip, deflate, br" + }, { + "name" : "accept-language", + "value" : "en-US,en;q=0.9" + }, { + "name" : "upgrade-insecure-requests", + "value" : "1" + }, { + "name" : "user-agent", + "value" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.83 Safari/537.36" + }, { + "name" : "x-thousandeyes-agent", + "value" : "yes" + } ], + "method" : "GET", + "url" : "https://www.google.com/" + }, + "response" : { + "bodySize" : 65214, + "content" : { + "mimeType" : "text/html", + "size" : 225039 + }, + "headers" : [ { + "name" : "alt-svc", + "value" : "quic=\\":443\\"; ma=2592000; v=\\"46,43\\",h3-Q050=\\":443\\"; ma=2592000,h3-Q049=\\":443\\"; ma=2592000,h3-Q048=\\":443\\"; ma=2592000,h3-Q046=\\":443\\"; ma=2592000,h3-Q043=\\":443\\"; ma=2592000" + }, { + "name" : "cache-control", + "value" : "private, max-age=0" + }, { + "name" : "content-encoding", + "value" : "br" + }, { + "name" : "content-length", + "value" : "65214" + }, { + "name" : "content-type", + "value" : "text/html; charset=UTF-8" + }, { + "name" : "date", + "value" : "Fri, 15 Nov 2019 16:41:54 GMT" + }, { + "name" : "expires", + "value" : "-1" + }, { + "name" : "p3p", + "value" : "CP=\\"This is not a P3P policy! See g.co/p3phelp for more info.\\"" + }, { + "name" : "server", + "value" : "gws" + }, { + "name" : "set-cookie", + "value" : "(removed)" + }, { + "name" : "status", + "value" : "200" + }, { + "name" : "strict-transport-security", + "value" : "max-age=31536000" + }, { + "name" : "x-frame-options", + "value" : "SAMEORIGIN" + }, { + "name" : "x-xss-protection", + "value" : "0" + } ], + "headersSize" : 915, + "redirectURL" : "", + "status" : 200, + "statusText" : "OK" + }, + "serverIPAddress" : "172.217.4.196", + "startedDateTime" : "2019-11-15T16:41:54.870Z", + "time" : 182, + "timings" : { + "blocked" : 2, + "connect" : 4, + "dns" : 0, + "receive" : 58, + "send" : 0, + "ssl" : 2, + "wait" : 118 + } + } ], + "pages" : [ { + "id" : "page_0", + "pageTimings" : { + "onContentLoad" : 367, + "onLoad" : 737 + }, + "responseCode" : 0, + "startedDateTime" : "2019-11-15T16:41:54.796Z", + "title" : "Google" + } ], + "version" : "1.2" + } + }, + "startTime" : 1384309800, + "endTime" : 1384309800, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_web_transaction_agent_round_page_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_web_transaction_agent_round_page_results_error_400(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 400)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.get_test_web_transaction_agent_round_page_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_401(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 401)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.get_test_web_transaction_agent_round_page_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_403(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 403)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_test_web_transaction_agent_round_page_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_404(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 404)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_test_web_transaction_agent_round_page_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_429(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 429)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_test_web_transaction_agent_round_page_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_500(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 500)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_test_web_transaction_agent_round_page_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_page_results_error_502(self) -> None: + """Integration test for get_test_web_transaction_agent_round_page_results error path (HTTP 502)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + page_id = '281474976710706' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.get_test_web_transaction_agent_round_page_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + page_id=page_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_page_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_test_web_transaction_agent_round_results_happy_path(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results success path""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + response_body_json = """ + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "pages" : [ { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + }, { + "duration" : 1117.5660001039505, + "componentCount" : 136, + "pageNum" : 0, + "pageName" : "Google", + "errorCount" : 0 + } ], + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "markers" : [ { + "duration" : 1360, + "name" : "SearchForWebdriver" + }, { + "duration" : 1360, + "name" : "SearchForWebdriver" + } ], + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ] + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_web_transaction_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_web_transaction_agent_round_results_error_400(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 400)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.get_test_web_transaction_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_401(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 401)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.get_test_web_transaction_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_403(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 403)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_test_web_transaction_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_404(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 404)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_test_web_transaction_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_429(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 429)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_test_web_transaction_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_500(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 500)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_test_web_transaction_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_agent_round_results_error_502(self) -> None: + """Integration test for get_test_web_transaction_agent_round_results error path (HTTP 502)""" + test_id = '202701' + agent_id = '11' + round_id = '1384309800' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.get_test_web_transaction_agent_round_results( + + test_id=test_id, + + agent_id=agent_id, + + round_id=round_id, + + aid=aid, + + _headers=self.te_headers("get_test_web_transaction_agent_round_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_get_test_web_transaction_results_happy_path(self) -> None: + """Integration test for get_test_web_transaction_results success path""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + response_body_json = """ + { + "test" : { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, + "endDate" : "2022-07-18T22:00:54Z", + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "results" : [ { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + }, { + "date" : "2022-07-17T22:00:54Z", + "agent" : { + "agentId" : "281474976710706", + "agentName" : "thousandeyes-stg-va-254", + "location" : "San Francisco Bay Area", + "countryId" : "US" + }, + "_links" : { + "appLink" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "componentErrors" : 5, + "errorType" : "None", + "startTime" : 1384309800, + "endTime" : 1384309800, + "transactionTime" : 2379, + "roundId" : 1384309800, + "errorDetails" : "Connection error" + } ], + "startDate" : "2022-07-17T22:00:54Z" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_test_web_transaction_results( + + test_id=test_id, + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + _headers=self.te_headers("get_test_web_transaction_results"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_test_web_transaction_results_error_400(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 400)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(400) + ) as context: + self.api.get_test_web_transaction_results( + + test_id=test_id, + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + _headers=self.te_headers("get_test_web_transaction_results", error_status="400"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_401(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 401)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.get_test_web_transaction_results( + + test_id=test_id, + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + _headers=self.te_headers("get_test_web_transaction_results", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_403(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 403)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_test_web_transaction_results( + + test_id=test_id, + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + _headers=self.te_headers("get_test_web_transaction_results", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_404(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 404)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_test_web_transaction_results( + + test_id=test_id, + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + _headers=self.te_headers("get_test_web_transaction_results", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_429(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 429)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_test_web_transaction_results( + + test_id=test_id, + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + _headers=self.te_headers("get_test_web_transaction_results", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_500(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 500)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_test_web_transaction_results( + + test_id=test_id, + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + _headers=self.te_headers("get_test_web_transaction_results", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_test_web_transaction_results_error_502(self) -> None: + """Integration test for get_test_web_transaction_results error path (HTTP 502)""" + test_id = '202701' + aid = '1234' + window = '12h' + start_date = '2022-07-17T22:00:54Z' + end_date = '2022-07-18T22:00:54Z' + cursor = 'cursor_example' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.get_test_web_transaction_results( + + test_id=test_id, + + aid=aid, + + window=window, + + start_date=start_date, + + end_date=end_date, + + cursor=cursor, + + _headers=self.te_headers("get_test_web_transaction_results", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + + +if __name__ == '__main__': + unittest.main() diff --git a/thousandeyes-sdk-tests/.openapi-generator/FILES b/thousandeyes-sdk-tests/.openapi-generator/FILES index 60ca0c12..9efae890 100644 --- a/thousandeyes-sdk-tests/.openapi-generator/FILES +++ b/thousandeyes-sdk-tests/.openapi-generator/FILES @@ -394,19 +394,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 e7c10151..0a74a754 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.97 - 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 diff --git a/thousandeyes-sdk-tests/docs/APITestsApi.md b/thousandeyes-sdk-tests/docs/APITestsApi.md index e56922e1..dcb2498d 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 95b5143f..3acc21c0 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 0bf576ce..067a6dde 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 3e35f4d7..f804d835 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 2832eba6..326cc430 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 6a0a821a..bbff7d89 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 12e6b67e..a7d745a2 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 78611f8f..b6180196 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 2278693b..212afd82 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/PageLoadTestsApi.md b/thousandeyes-sdk-tests/docs/PageLoadTestsApi.md index dd149062..94835d58 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 9f85baa6..99c63aca 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 ec021d47..c800421e 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/VoiceTestsApi.md b/thousandeyes-sdk-tests/docs/VoiceTestsApi.md index 065aed3f..87f5e5d5 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/WebTransactionTestsApi.md b/thousandeyes-sdk-tests/docs/WebTransactionTestsApi.md index 34f8d4b8..394c1c2d 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/test/conftest.py b/thousandeyes-sdk-tests/test/conftest.py new file mode 100644 index 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-tests/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-tests/test/integration_test_utils.py b/thousandeyes-sdk-tests/test/integration_test_utils.py new file mode 100644 index 00000000..3375a6fd --- /dev/null +++ b/thousandeyes-sdk-tests/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-tests/test/mock_manifest.py b/thousandeyes-sdk-tests/test/mock_manifest.py new file mode 100644 index 00000000..c9bad0bb --- /dev/null +++ b/thousandeyes-sdk-tests/test/mock_manifest.py @@ -0,0 +1,18313 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "create_api_test": OperationExpectation( + operation_id="create_api_test", + method="POST", + path="/tests/api", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_api_test": OperationExpectation( + operation_id="delete_api_test", + method="DELETE", + path="/tests/api/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_api_test": OperationExpectation( + operation_id="get_api_test", + method="GET", + path="/tests/api/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_api_tests": OperationExpectation( + operation_id="get_api_tests", + method="GET", + path="/tests/api", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1 + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_api_test": OperationExpectation( + operation_id="update_api_test", + method="PUT", + path="/tests/api/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "credentials" : [ "3247", "1051" ], + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "requests" : [ { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + }, { + "headers" : [ { + "value" : "keep-alive", + "key" : "x-custom-header" + }, { + "value" : "keep-alive", + "key" : "x-custom-header" + } ], + "variables" : [ { + "name" : "myTestName", + "value" : "tests[0].name" + }, { + "name" : "myTestName", + "value" : "tests[0].name" + } ], + "clientId" : "client-id", + "tokenUrl" : "https://id.cisco.com/oauth2/default/v1/token", + "method" : "get", + "verifyCertificate" : false, + "body" : "body", + "url" : "https://api.thousandeyes.com/v7/status", + "password" : "basic_pw123", + "bearerToken" : "abcd-1234-...", + "scope" : "read, write, deploy", + "name" : "Step 1", + "waitTimeMs" : 0, + "clientAuthentication" : "basic-auth-header", + "clientSecret" : "client-secret", + "assertions" : [ { + "name" : "status-code", + "value" : "200", + "operator" : "is" + }, { + "name" : "status-code", + "value" : "200", + "operator" : "is" + } ], + "authType" : "none", + "collectApiResponse" : true, + "username" : "ThousandEyesUserName" + } ], + "type" : "api", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "protocol" : "tcp", + "collectProxyNetworkData" : false, + "followRedirects" : true, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "clientCertDomainsAllowList" : "www.thousandeyes.com", + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "overrideAgentProxy" : false, + "predefinedVariables" : [ { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + }, { + "name" : "myUsername", + "value" : "ThousandEyesAccountUserName" + } ], + "liveShare" : false, + "distributedTracing" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 19, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "sslVersionId" : "0", + "targetTime" : 1, + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_agent_to_agent_test": OperationExpectation( + operation_id="create_agent_to_agent_test", + method="POST", + path="/tests/agent-to-agent", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_agent_to_agent_test": OperationExpectation( + operation_id="delete_agent_to_agent_test", + method="DELETE", + path="/tests/agent-to-agent/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_agent_test": OperationExpectation( + operation_id="get_agent_to_agent_test", + method="GET", + path="/tests/agent-to-agent/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_agent_tests": OperationExpectation( + operation_id="get_agent_to_agent_tests", + method="GET", + path="/tests/agent-to-agent", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_agent_to_agent_test": OperationExpectation( + operation_id="update_agent_to_agent_test", + method="PUT", + path="/tests/agent-to-agent/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "agent-to-agent", + "mss" : 100, + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "throughputRate" : 10, + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "direction" : "to-target", + "throughputMeasurements" : false, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "throughputDuration" : 10000, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 49153, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "2954", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_agent_to_server_test": OperationExpectation( + operation_id="create_agent_to_server_test", + method="POST", + path="/tests/agent-to-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 443, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "sharedWithAccounts" : [ "1234", "12345" ], + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_agent_to_server_test": OperationExpectation( + operation_id="delete_agent_to_server_test", + method="DELETE", + path="/tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_test": OperationExpectation( + operation_id="get_agent_to_server_test", + method="GET", + path="/tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_agent_to_server_tests": OperationExpectation( + operation_id="get_agent_to_server_tests", + method="GET", + path="/tests/agent-to-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "continuousMode" : false + }, { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "pingPayloadSize" : 112, + "continuousMode" : false + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_agent_to_server_test": OperationExpectation( + operation_id="update_agent_to_server_test", + method="PUT", + path="/tests/agent-to-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "agent-to-server", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : false, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "server" : "www.thousandeyes.com:80", + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "usePublicBgp" : true, + "enabled" : true, + "dscpId" : "0", + "fixedPacketRate" : 25, + "protocol" : "tcp", + "dscp" : "Best Effort (DSCP 0)", + "pathTraceMode" : "classic", + "alertsEnabled" : true, + "testName" : "Test name", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "networkMeasurements" : false, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "randomizedStartTime" : false, + "port" : 443, + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "pingPayloadSize" : 112, + "continuousMode" : false, + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_bgp_test": OperationExpectation( + operation_id="create_bgp_test", + method="POST", + path="/tests/bgp", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_bgp_test": OperationExpectation( + operation_id="delete_bgp_test", + method="DELETE", + path="/tests/bgp/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_bgp_test": OperationExpectation( + operation_id="get_bgp_test", + method="GET", + path="/tests/bgp/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_bgp_tests": OperationExpectation( + operation_id="get_bgp_tests", + method="GET", + path="/tests/bgp", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_bgp_test": OperationExpectation( + operation_id="update_bgp_test", + method="PUT", + path="/tests/bgp/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "prefix" : "prefix", + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "includeCoveredPrefixes" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "bgp", + "usePublicBgp" : true, + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_sec_test": OperationExpectation( + operation_id="create_dns_sec_test", + method="POST", + path="/tests/dnssec", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_dns_sec_test": OperationExpectation( + operation_id="delete_dns_sec_test", + method="DELETE", + path="/tests/dnssec/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_sec_test": OperationExpectation( + operation_id="get_dns_sec_test", + method="GET", + path="/tests/dnssec/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_sec_tests": OperationExpectation( + operation_id="get_dns_sec_tests", + method="GET", + path="/tests/dnssec", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_dns_sec_test": OperationExpectation( + operation_id="update_dns_sec_test", + method="PUT", + path="/tests/dnssec/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "dnssec", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_server_test": OperationExpectation( + operation_id="create_dns_server_test", + method="POST", + path="/tests/dns-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_dns_server_test": OperationExpectation( + operation_id="delete_dns_server_test", + method="DELETE", + path="/tests/dns-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_server_test": OperationExpectation( + operation_id="get_dns_server_test", + method="GET", + path="/tests/dns-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_server_tests": OperationExpectation( + operation_id="get_dns_server_tests", + method="GET", + path="/tests/dns-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706" + }, { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_dns_server_test": OperationExpectation( + operation_id="update_dns_server_test", + method="PUT", + path="/tests/dns-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ { + "serverName" : "dns-example.net", + "serverId" : "1447" + }, { + "serverName" : "dns-example.net", + "serverId" : "1447" + } ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "probeMode" : "auto", + "type" : "dns-server", + "usePublicBgp" : true, + "enabled" : true, + "protocol" : "tcp", + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "dnsServers" : [ "dns-example.net", "8.8.8.8" ], + "alertsEnabled" : true, + "recursiveQueries" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "dnsQueryClass" : "in", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_dns_trace_test": OperationExpectation( + operation_id="create_dns_trace_test", + method="POST", + path="/tests/dns-trace", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_dns_trace_test": OperationExpectation( + operation_id="delete_dns_trace_test", + method="DELETE", + path="/tests/dns-trace/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_trace_test": OperationExpectation( + operation_id="get_dns_trace_test", + method="GET", + path="/tests/dns-trace/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_dns_trace_tests": OperationExpectation( + operation_id="get_dns_trace_tests", + method="GET", + path="/tests/dns-trace", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_dns_trace_test": OperationExpectation( + operation_id="update_dns_trace_test", + method="PUT", + path="/tests/dns-trace/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "savedEvent" : true, + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "dnsQueryClass" : "in", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "dnsTransportProtocol" : "udp", + "type" : "dns-trace", + "enabled" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "domain" : "www.thousandeyes.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_ftp_server_test": OperationExpectation( + operation_id="create_ftp_server_test", + method="POST", + path="/tests/ftp-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "downloadLimit" : 1048576, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "downloadLimit" : 1048576, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_ftp_server_test": OperationExpectation( + operation_id="delete_ftp_server_test", + method="DELETE", + path="/tests/ftp-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_ftp_server_test": OperationExpectation( + operation_id="get_ftp_server_test", + method="GET", + path="/tests/ftp-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "downloadLimit" : 1048576, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_ftp_server_tests": OperationExpectation( + operation_id="get_ftp_server_tests", + method="GET", + path="/tests/ftp-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "downloadLimit" : 1048576, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "useActiveFtp" : false, + "username" : "username" + }, { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "downloadLimit" : 1048576, + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "useActiveFtp" : false, + "username" : "username" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_ftp_server_test": OperationExpectation( + operation_id="update_ftp_server_test", + method="PUT", + path="/tests/ftp-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "downloadLimit" : 1048576, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "downloadLimit" : 1048576, + "alertRules" : [ "344753", "212697" ], + "bandwidthMeasurements" : true, + "description" : "ThousandEyes Test", + "useExplicitFtps" : false, + "probeMode" : "auto", + "type" : "ftp-server", + "usePublicBgp" : true, + "enabled" : true, + "password" : "password", + "protocol" : "tcp", + "fixedPacketRate" : 50, + "ftpTargetTime" : 1400, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "requestType" : "download", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "ftpTimeLimit" : 10, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "useActiveFtp" : false, + "username" : "username", + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_http_server_test": OperationExpectation( + operation_id="create_http_server_test", + method="POST", + path="/tests/http-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_http_server_test": OperationExpectation( + operation_id="delete_http_server_test", + method="DELETE", + path="/tests/http-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_http_server_test": OperationExpectation( + operation_id="get_http_server_test", + method="GET", + path="/tests/http-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_http_server_tests": OperationExpectation( + operation_id="get_http_server_tests", + method="GET", + path="/tests/http-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_http_server_test": OperationExpectation( + operation_id="update_http_server_test", + method="PUT", + path="/tests/http-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "requestMethod" : "get", + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "http-server", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "contentRegex" : "(regex)+", + "testName" : "ThousandEyes Test", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "ipv6Policy" : "use-agent-policy", + "downloadLimit" : 2048, + "requestMethod" : "get", + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "headers" : [ "header1: value1", "header2: value2" ], + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "postBody" : "{ \\"example\\" : \\"value\\"}", + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_page_load_test": OperationExpectation( + operation_id="create_page_load_test", + method="POST", + path="/tests/page-load", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_page_load_test": OperationExpectation( + operation_id="delete_page_load_test", + method="DELETE", + path="/tests/page-load/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_page_load_test": OperationExpectation( + operation_id="get_page_load_test", + method="GET", + path="/tests/page-load/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_page_load_tests": OperationExpectation( + operation_id="get_page_load_tests", + method="GET", + path="/tests/page-load", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_page_load_test": OperationExpectation( + operation_id="update_page_load_test", + method="PUT", + path="/tests/page-load/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_path_vis_interface_groups": OperationExpectation( + operation_id="create_path_vis_interface_groups", + method="POST", + path="/network/path-vis/interface-groups", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_path_vis_interface_group": OperationExpectation( + operation_id="delete_path_vis_interface_group", + method="DELETE", + path="/network/path-vis/interface-groups/{interfaceGroupId}", + path_param_examples={ + "interfaceGroupId": '281474976710706', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_path_vis_interface_groups": OperationExpectation( + operation_id="get_path_vis_interface_groups", + method="GET", + path="/network/path-vis/interface-groups", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "pathVisInterfaceGroups" : [ { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + }, { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_path_vis_interface_group": OperationExpectation( + operation_id="update_path_vis_interface_group", + method="PUT", + path="/network/path-vis/interface-groups/{interfaceGroupId}", + path_param_examples={ + "interfaceGroupId": '281474976710706', + }, + success_status=200, + success_body=json.loads(""" + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "groupName" : "PathVis Interface Group", + "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], + "groupId" : "281474976710706", + "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], + "aid" : "1234" + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_sip_server_test": OperationExpectation( + operation_id="create_sip_server_test", + method="POST", + path="/tests/sip-server", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "registerEnabled" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "numPathTraces" : 3, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "registerEnabled" : false, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_sip_server_test": OperationExpectation( + operation_id="delete_sip_server_test", + method="DELETE", + path="/tests/sip-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_sip_server_test": OperationExpectation( + operation_id="get_sip_server_test", + method="GET", + path="/tests/sip-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "registerEnabled" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "numPathTraces" : 3, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_sip_server_tests": OperationExpectation( + operation_id="get_sip_server_tests", + method="GET", + path="/tests/sip-server", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "registerEnabled" : false, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "user" : "username" + }, { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "registerEnabled" : false, + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "user" : "username" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_sip_server_test": OperationExpectation( + operation_id="update_sip_server_test", + method="PUT", + path="/tests/sip-server/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "registerEnabled" : false, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "authUser" : "username", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "password" : "password", + "protocol" : "tcp", + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "bgpMeasurements" : true, + "numPathTraces" : 3, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "sipRegistrar" : "voice.thousandeyes.com", + "networkMeasurements" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "port" : 49153, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "user" : "username", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "mtuMeasurements" : false, + "ipv6Policy" : "use-agent-policy", + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "registerEnabled" : false, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "probeMode" : "auto", + "type" : "sip-server", + "usePublicBgp" : true, + "enabled" : true, + "fixedPacketRate" : 50, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "targetSipCredentials" : { + "password" : "password", + "protocol" : "tcp", + "port" : 49153, + "sipRegistrar" : "voice.thousandeyes.com", + "authUser" : "username", + "user" : "username" + }, + "testName" : "ThousandEyes Test", + "sipTargetTime" : 1000, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "optionsRegex" : "[\\"a-z\\"]", + "liveShare" : false, + "savedEvent" : true, + "networkMeasurements" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "sipTimeLimit" : 5, + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_test_version_history": OperationExpectation( + operation_id="get_test_version_history", + method="GET", + path="/tests/{testId}/history", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "testVersionHistory" : [ { + "versionId" : "1234", + "versionTimestamp" : "2022-07-17T22:00:54Z", + "createdBy" : "user (user@user.com)", + "testId" : "474276" + }, { + "versionId" : "1234", + "versionTimestamp" : "2022-07-17T22:00:54Z", + "createdBy" : "user (user@user.com)", + "testId" : "474276" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_tests": OperationExpectation( + operation_id="get_tests", + method="GET", + path="/tests", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "liveShare" : false, + "savedEvent" : true, + "description" : "ThousandEyes Test", + "type" : "agent-to-server", + "enabled" : true, + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "modifiedBy" : "user@user.com", + "testId" : "281474976710706", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_voice_test": OperationExpectation( + operation_id="create_voice_test", + method="POST", + path="/tests/voice", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "codec" : "G.711 @ 64 Kbps", + "codecId" : "0", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 1024, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "281474976710706", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "codec" : "G.711 @ 64 Kbps", + "codecId" : "0", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 1024, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "281474976710706", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_voice_test": OperationExpectation( + operation_id="delete_voice_test", + method="DELETE", + path="/tests/voice/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_voice_test": OperationExpectation( + operation_id="get_voice_test", + method="GET", + path="/tests/voice/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "codec" : "G.711 @ 64 Kbps", + "codecId" : "0", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 1024, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "281474976710706", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_voice_tests": OperationExpectation( + operation_id="get_voice_tests", + method="GET", + path="/tests/voice", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "codec" : "G.711 @ 64 Kbps", + "codecId" : "0", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 1024, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "281474976710706", + "interval" : 60, + "testId" : "281474976710706" + }, { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "codec" : "G.711 @ 64 Kbps", + "codecId" : "0", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 1024, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "281474976710706", + "interval" : 60, + "testId" : "281474976710706" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_voice_test": OperationExpectation( + operation_id="update_voice_test", + method="PUT", + path="/tests/voice/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "codec" : "G.711 @ 64 Kbps", + "codecId" : "0", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 1024, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "281474976710706", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "type" : "voice", + "usePublicBgp" : true, + "enabled" : true, + "jitterBuffer" : 40, + "dscpId" : "0", + "duration" : 5, + "dscp" : "Best Effort (DSCP 0)", + "modifiedBy" : "user@user.com", + "alertsEnabled" : true, + "testName" : "ThousandEyes Test", + "numPathTraces" : 3, + "bgpMeasurements" : true, + "liveShare" : false, + "savedEvent" : true, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "codec" : "G.711 @ 64 Kbps", + "codecId" : "0", + "createdDate" : "2022-07-17T22:00:54Z", + "createdBy" : "user@user.com", + "port" : 1024, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "targetAgentId" : "281474976710706", + "interval" : 60, + "testId" : "281474976710706", + "sharedWithAccounts" : [ "1234", "12345" ], + "monitors" : [ "17410", "5" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "create_web_transactions_test": OperationExpectation( + operation_id="create_web_transactions_test", + method="POST", + path="/tests/web-transactions", + path_param_examples={ + }, + success_status=201, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "delete_web_transactions_test": OperationExpectation( + operation_id="delete_web_transactions_test", + method="DELETE", + path="/tests/web-transactions/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_web_transactions_test": OperationExpectation( + operation_id="get_web_transactions_test", + method="GET", + path="/tests/web-transactions/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_web_transactions_tests": OperationExpectation( + operation_id="get_web_transactions_tests", + method="GET", + path="/tests/web-transactions", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "tests" : [ { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + + "update_web_transactions_test": OperationExpectation( + operation_id="update_web_transactions_test", + method="PUT", + path="/tests/web-transactions/{testId}", + path_param_examples={ + "testId": '202701', + }, + success_status=200, + success_body=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + "502": ErrorResponseExpectation( + status=502, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_agent_to_agent_tests_api_integration.py new file mode 100644 index 00000000..84a945e8 --- /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 00000000..47c8025a --- /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 00000000..2ff5379d --- /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 00000000..a77fddd4 --- /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 00000000..78862b4e --- /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 00000000..6640de03 --- /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 00000000..814db727 --- /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 00000000..d9f18b08 --- /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 00000000..ea6d9e2a --- /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_integration.py b/thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py new file mode 100644 index 00000000..b8d56e61 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_page_load_tests_api_integration.py @@ -0,0 +1,4055 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.page_load_tests_api import PageLoadTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestPageLoadTestsApiIntegration(IntegrationTestBase): + """PageLoadTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = PageLoadTestsApi(self.api_client) + + + def test_create_page_load_test_happy_path(self) -> None: + """Integration test for create_page_load_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_page_load_test( + + page_load_test_request=page_load_test_request, + + aid=aid, + + _headers=self.te_headers("create_page_load_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_page_load_test_error_400(self) -> None: + """Integration test for create_page_load_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "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, + "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, + "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, + "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, + "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, + "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, + "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, + "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, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_page_load_tests( + + aid=aid, + + _headers=self.te_headers("get_page_load_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_page_load_tests_error_401(self) -> None: + """Integration test for get_page_load_tests error path (HTTP 401)""" + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.get_page_load_tests( + + aid=aid, + + _headers=self.te_headers("get_page_load_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_tests_error_403(self) -> None: + """Integration test for get_page_load_tests error path (HTTP 403)""" + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_page_load_tests( + + aid=aid, + + _headers=self.te_headers("get_page_load_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_tests_error_404(self) -> None: + """Integration test for get_page_load_tests error path (HTTP 404)""" + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_page_load_tests( + + aid=aid, + + _headers=self.te_headers("get_page_load_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_tests_error_429(self) -> None: + """Integration test for get_page_load_tests error path (HTTP 429)""" + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_page_load_tests( + + aid=aid, + + _headers=self.te_headers("get_page_load_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_tests_error_500(self) -> None: + """Integration test for get_page_load_tests error path (HTTP 500)""" + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_page_load_tests( + + aid=aid, + + _headers=self.te_headers("get_page_load_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_page_load_tests_error_502(self) -> None: + """Integration test for get_page_load_tests error path (HTTP 502)""" + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.get_page_load_tests( + + aid=aid, + + _headers=self.te_headers("get_page_load_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_page_load_test_happy_path(self) -> None: + """Integration test for update_page_load_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_page_load_test( + + test_id=test_id, + + page_load_test_request=page_load_test_request, + + aid=aid, + + _headers=self.te_headers("update_page_load_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_page_load_test_error_400(self) -> None: + """Integration test for update_page_load_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "page-load", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "httpInterval" : 120, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "pageLoadTargetTime" : 10, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "pageLoadTimeLimit" : 10, + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username" + } + + """ + page_load_test_request = thousandeyes_sdk.tests.models.PageLoadTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "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, + "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, + "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, + "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, + "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, + "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, + "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 00000000..71f3d786 --- /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 00000000..37366e48 --- /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 00000000..c06af4e5 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-tests/test/test_utils.py +++ b/thousandeyes-sdk-tests/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json) diff --git a/thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py b/thousandeyes-sdk-tests/test/test_voice_tests_api_integration.py new file mode 100644 index 00000000..1642afbc --- /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_integration.py b/thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py new file mode 100644 index 00000000..d6ec8962 --- /dev/null +++ b/thousandeyes-sdk-tests/test/test_web_transaction_tests_api_integration.py @@ -0,0 +1,4074 @@ +# coding: utf-8 + +""" + Tests API + + **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics tests. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import unittest +import thousandeyes_sdk.tests.models + +from thousandeyes_sdk.core.exceptions import ApiException +from thousandeyes_sdk.tests.api.web_transaction_tests_api import WebTransactionTestsApi +from .integration_test_utils import IntegrationTestBase +from .test_utils import assert_constructed_model_matches_example_json + + +class TestWebTransactionTestsApiIntegration(IntegrationTestBase): + """WebTransactionTestsApi integration test stubs""" + + def setUp(self) -> None: + super().setUp() + self.api = WebTransactionTestsApi(self.api_client) + + + def test_create_web_transactions_test_happy_path(self) -> None: + """Integration test for create_web_transactions_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + """ + expected_response = json.loads(response_body_json) + response = self.api.create_web_transactions_test( + + web_transaction_test_request=web_transaction_test_request, + + aid=aid, + + _headers=self.te_headers("create_web_transactions_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_create_web_transactions_test_error_400(self) -> None: + """Integration test for create_web_transactions_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_web_transactions_test( + + test_id=test_id, + + aid=aid, + + version_id=version_id, + + _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, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + }, { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "overrideProxyId" : "281474976710706", + "sslVersion" : "Auto", + "useNtlm" : false, + "downloadLimit" : 2048, + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + """ + expected_response = json.loads(response_body_json) + response = self.api.get_web_transactions_tests( + + aid=aid, + + _headers=self.te_headers("get_web_transactions_tests"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_get_web_transactions_tests_error_401(self) -> None: + """Integration test for get_web_transactions_tests error path (HTTP 401)""" + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(401) + ) as context: + self.api.get_web_transactions_tests( + + aid=aid, + + _headers=self.te_headers("get_web_transactions_tests", error_status="401"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_tests_error_403(self) -> None: + """Integration test for get_web_transactions_tests error path (HTTP 403)""" + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(403) + ) as context: + self.api.get_web_transactions_tests( + + aid=aid, + + _headers=self.te_headers("get_web_transactions_tests", error_status="403"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_tests_error_404(self) -> None: + """Integration test for get_web_transactions_tests error path (HTTP 404)""" + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(404) + ) as context: + self.api.get_web_transactions_tests( + + aid=aid, + + _headers=self.te_headers("get_web_transactions_tests", error_status="404"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_tests_error_429(self) -> None: + """Integration test for get_web_transactions_tests error path (HTTP 429)""" + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(429) + ) as context: + self.api.get_web_transactions_tests( + + aid=aid, + + _headers=self.te_headers("get_web_transactions_tests", error_status="429"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_tests_error_500(self) -> None: + """Integration test for get_web_transactions_tests error path (HTTP 500)""" + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(500) + ) as context: + self.api.get_web_transactions_tests( + + aid=aid, + + _headers=self.te_headers("get_web_transactions_tests", error_status="500"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + def test_get_web_transactions_tests_error_502(self) -> None: + """Integration test for get_web_transactions_tests error path (HTTP 502)""" + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 0 + } + """ + expected_error = json.loads(error_body_json) + with self.assertRaises( + ApiException.exception_class_for_http_status(502) + ) as context: + self.api.get_web_transactions_tests( + + aid=aid, + + _headers=self.te_headers("get_web_transactions_tests", error_status="502"), + ) + assert_constructed_model_matches_example_json(context.exception.data, expected_error) + + + + + def test_update_web_transactions_test_happy_path(self) -> None: + """Integration test for update_web_transactions_test success path""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + response_body_json = """ + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + }, { + "labelId" : "961", + "name" : "Artem label", + "isBuiltin" : false + } ], + "tags" : [ { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + }, { + "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c", + "value" : "San Francisco", + "key" : "Location" + } ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ { + "name" : "Account name", + "aid" : "1234" + }, { + "name" : "Account name", + "aid" : "1234" + } ], + "overrideProxyId" : "281474976710706", + "monitors" : [ { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + }, { + "monitorType" : "public", + "monitorId" : "1234", + "monitorName" : "Seattle, WA", + "ipAddress" : "4.69.184.193", + "countryId" : "GB", + "network" : "Level 3 Communications, Inc. (AS 3356)" + } ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + }, { + "severity" : "major", + "expression" : "((hops((hopDelay >= 100 ms))))", + "alertType" : "http-server", + "roundsViolatingMode" : "exact", + "sensitivityLevel" : "medium", + "roundsViolatingOutOf" : 5, + "roundsViolatingRequired" : 2, + "isDefault" : true, + "minimumSourcesPct" : 99, + "ruleName" : "The End of the Internet", + "minimumSources" : 10, + "ruleId" : "127094", + "direction" : "to-target" + } ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + }, { + "agentId" : "281474976710706", + "agentType" : "enterprise-cluster", + "prefix" : "99.128.0.0/11", + "coordinates" : { + "latitude" : 37.77493, + "longitude" : -122.41942 + }, + "agentName" : "thousandeyes-stg-va-254", + "networkProviderInfo" : { + "asn" : 7018, + "name" : "AT&T Services, Inc.", + "type" : "isp" + }, + "countryId" : "US", + "enabled" : true, + "network" : "AT&T Services, Inc. (AS 7018)", + "publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ], + "ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ], + "location" : "San Francisco Bay Area", + "verifySslCertificates" : true + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + """ + expected_response = json.loads(response_body_json) + response = self.api.update_web_transactions_test( + + test_id=test_id, + + web_transaction_test_request=web_transaction_test_request, + + aid=aid, + + _headers=self.te_headers("update_web_transactions_test"), + ) + assert_constructed_model_matches_example_json(response, expected_response) + + + def test_update_web_transactions_test_error_400(self) -> None: + """Integration test for update_web_transactions_test error path (HTTP 400)""" + request_body_json = """ + + { + "clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n", + "mtuMeasurements" : false, + "_links" : { + "testResults" : [ { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network" + }, { + "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis" + } ], + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "dnsOverride" : "8.8.8.8", + "bandwidthMeasurements" : true, + "probeMode" : "auto", + "includeHeaders" : true, + "type" : "web-transactions", + "oAuth" : { + "testUrl" : "https://api.thousandeyes.com/v7/status", + "requestMethod" : "post", + "postBody" : "client_id: ************", + "headers" : "Authorization: Basic ************", + "authType" : "none", + "username" : "user123", + "password" : "*******" + }, + "password" : "password", + "protocol" : "tcp", + "followRedirects" : true, + "chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}", + "contentRegex" : "(regex)+", + "pageLoadingStrategy" : "normal", + "testName" : "ThousandEyes Test", + "allowMicAndCamera" : false, + "browserLanguage" : "en-US", + "verifyCertificate" : false, + "overrideAgentProxy" : false, + "liveShare" : false, + "agentInterfaces" : { + "agentId" : "2954", + "ipAddress" : "192.1.1.0" + }, + "labels" : [ "9842", "1283" ], + "tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "ec8e64fb-6f11-485c-a5d5-488098ad626a" ], + "randomizedStartTime" : false, + "modifiedDate" : "2022-07-17T22:00:54Z", + "interval" : 60, + "emulatedDeviceId" : "2", + "sharedWithAccounts" : [ "1234", "12345" ], + "overrideProxyId" : "281474976710706", + "monitors" : [ "17410", "5" ], + "sslVersion" : "Auto", + "useNtlm" : false, + "credentials" : [ "3247", "1051" ], + "downloadLimit" : 2048, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + error_body_json = """ + { + "error_description" : "Invalid access token", + "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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, + "alertRules" : [ "344753", "212697" ], + "description" : "ThousandEyes Test", + "httpTimeLimit" : 5, + "blockDomains" : "domain.com/", + "usePublicBgp" : true, + "enabled" : true, + "vaultCredentials" : [ { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + }, { + "secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819", + "target" : "username" + } ], + "allowGeolocation" : false, + "allowUnsafeLegacyRenegotiation" : true, + "fixedPacketRate" : 50, + "httpVersion" : 2, + "collectProxyNetworkData" : false, + "pathTraceMode" : "classic", + "modifiedBy" : "user@user.com", + "authType" : "none", + "alertsEnabled" : true, + "customHeaders" : { + "root" : { + "header1" : "value1" + }, + "domains" : { + "domain1.com" : { + "header2" : "value2" + } + }, + "all" : { + "header3" : "value3" + } + }, + "numPathTraces" : 3, + "bgpMeasurements" : true, + "transactionScript" : "if (true) { return true; }", + "distributedTracing" : false, + "savedEvent" : true, + "userAgent" : "curl", + "identifyAgentTrafficWithUserAgent" : false, + "networkMeasurements" : true, + "url" : "www.thousandeyes.com", + "agents" : [ { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + }, { + "agentId" : "125", + "sourceIpAddress" : "1.1.1.1" + } ], + "timeLimit" : 30, + "createdDate" : "2022-07-17T22:00:54Z", + "disableScreenshot" : false, + "createdBy" : "user@user.com", + "testId" : "281474976710706", + "subinterval" : 60, + "chromeOptions" : "--disable-gpu", + "desiredStatusCode" : "200", + "httpTargetTime" : 100, + "sslVersionId" : "0", + "username" : "username", + "targetTime" : 1 + } + + """ + web_transaction_test_request = thousandeyes_sdk.tests.models.WebTransactionTestRequest.from_json(request_body_json) + test_id = '202701' + aid = '1234' + error_body_json = """ + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "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 9a1faf47..16f65af9 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 4509c5fd..4bd853dc 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.97 - 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 a5959f9b..c927549d 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 654c231a..c2d36dbc 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 00000000..2edba7b3 --- /dev/null +++ b/thousandeyes-sdk-usage/test/conftest.py @@ -0,0 +1,7 @@ +import sys +from pathlib import Path + +_repo_root = Path(__file__).resolve().parents[2] +_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test" +if str(_core_test_support) not in sys.path: + sys.path.insert(0, str(_core_test_support)) diff --git a/thousandeyes-sdk-usage/test/integration_test_utils.py b/thousandeyes-sdk-usage/test/integration_test_utils.py new file mode 100644 index 00000000..21833c98 --- /dev/null +++ b/thousandeyes-sdk-usage/test/integration_test_utils.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Usage API + + These usage endpoints define the following operations: * **Usage**: Retrieve usage data for the specified time period (default is one month). * Users must have the `View organization usage` permission to access this endpoint. * This operation offers visibility across all account groups within the organization. * Users with `View organization usage` permission in multiple organizations should query the operation with the `aid` query string parameter (see optional parameters) for each organization. * The `agentId` field in enterprise agent unit responses may be omitted when not available. * **Quotas**: Obtain organization and account usage quotas. Additionally, users with the appropriate permissions can create, update, or delete these quotas. * Users must have the necessary permissions to perform quota-related actions. Refer to the Usage API operations for detailed usage instructions and optional parameters. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from thousandeyes_sdk.core.api_client import ApiClient +from thousandeyes_sdk.core.configuration import Configuration +from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer + +from .mock_manifest import OPERATION_MANIFEST + + +class IntegrationTestBase(unittest.TestCase): + def setUp(self) -> None: + self.server = MockApiServer(OPERATION_MANIFEST) + self.server.start() + configuration = Configuration(host=self.server.base_url, access_token="test-token") + self.api_client = ApiClient(configuration=configuration) + + def tearDown(self) -> None: + self.server.stop() + + def te_headers(self, operation_id: str, error_status=None): + headers = {OPERATION_ID_HEADER: operation_id} + if error_status is not None: + headers[ERROR_STATUS_HEADER] = error_status + return headers diff --git a/thousandeyes-sdk-usage/test/mock_manifest.py b/thousandeyes-sdk-usage/test/mock_manifest.py new file mode 100644 index 00000000..4ce9a01c --- /dev/null +++ b/thousandeyes-sdk-usage/test/mock_manifest.py @@ -0,0 +1,1183 @@ +# coding: utf-8 + +""" + Usage API + + These usage endpoints define the following operations: * **Usage**: Retrieve usage data for the specified time period (default is one month). * Users must have the `View organization usage` permission to access this endpoint. * This operation offers visibility across all account groups within the organization. * Users with `View organization usage` permission in multiple organizations should query the operation with the `aid` query string parameter (see optional parameters) for each organization. * The `agentId` field in enterprise agent unit responses may be omitted when not available. * **Quotas**: Obtain organization and account usage quotas. Additionally, users with the appropriate permissions can create, update, or delete these quotas. * Users must have the necessary permissions to perform quota-related actions. Refer to the Usage API operations for detailed usage instructions and optional parameters. + + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json + +from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation + +OPERATION_MANIFEST = { + + "assign_organizations_account_groups_quotas": OperationExpectation( + operation_id="assign_organizations_account_groups_quotas", + method="POST", + path="/quotas/account-groups/assign", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + }, { + "orgId" : "1234", + "accountGroups" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 12000, + "aid" : "1234" + } ] + } ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "assign_organizations_quotas": OperationExpectation( + operation_id="assign_organizations_quotas", + method="POST", + path="/quotas/assign", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "organizations" : [ { + "orgId" : "1234", + "value" : 12000 + }, { + "orgId" : "12345", + "value" : 10000 + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=json.loads(""" + + { + "organizations" : [ { + "value" : 12000 + }, { + "orgId" : "1234", + "value" : 10000 + } ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_quotas": OperationExpectation( + operation_id="get_quotas", + method="GET", + path="/quotas", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "quotas" : [ { + "accountGroupQuotas" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 10000, + "aid" : "12345" + } ], + "organizationQuota" : { + "value" : 22500, + "orgId" : "10" + } + }, { + "accountGroupQuotas" : [ { + "value" : 12000, + "aid" : "1234" + }, { + "value" : 10000, + "aid" : "12345" + } ], + "organizationQuota" : { + "value" : 22500, + "orgId" : "10" + } + } ], + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "unassign_organizations_account_groups_quotas": OperationExpectation( + operation_id="unassign_organizations_account_groups_quotas", + method="POST", + path="/quotas/account-groups/unassign", + path_param_examples={ + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=json.loads(""" + + { + "organizations" : [ { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + }, { + "orgId" : "1234", + "accountGroups" : [ "1234", "12345" ] + } ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "unassign_organizations_quotas": OperationExpectation( + operation_id="unassign_organizations_quotas", + method="POST", + path="/quotas/unassign", + path_param_examples={ + }, + success_status=204, + success_body=None, + success_content_type="application/json", + request_body_example=json.loads(""" + + { + "organizations" : [ "1234", "12345" ] + } + + """), + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_enterprise_agents_units_usage": OperationExpectation( + operation_id="get_enterprise_agents_units_usage", + method="GET", + path="/usage/units/enterprise-agents", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "breakdowns" : [ { + "aid" : "1234", + "agentId" : "123456", + "accountGroupName" : "Support", + "agentName" : "TEVA-test-agent", + "enterpriseUnitsUsed" : 599878, + "enterpriseUnitsProjected" : 597808 + }, { + "aid" : "315", + "agentId" : "789", + "accountGroupName" : "Documentation", + "agentName" : "lab-physical-appliance-1", + "enterpriseUnitsUsed" : 597123, + "enterpriseUnitsProjected" : 597808 + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_tests_units_usage": OperationExpectation( + operation_id="get_tests_units_usage", + method="GET", + path="/usage/units/tests", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "next" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "previous" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + }, + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "breakdowns" : [ { + "testId" : "1158", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web-Page Load", + "enterpriseUnitsUsed" : 14050, + "enterpriseUnitsProjected" : 340674, + "cloudUnitsUsed" : 10000, + "cloudUnitsProjected" : 12000, + "aid" : "1234", + "accountGroupName" : "Support" + }, { + "testId" : "1221", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web - HTTP Server", + "enterpriseUnitsUsed" : 194051, + "enterpriseUnitsProjected" : 30622, + "cloudUnitsUsed" : 12000, + "cloudUnitsProjected" : 13000, + "aid" : "1234", + "accountGroupName" : "Support" + } ] + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + + "get_usage": OperationExpectation( + operation_id="get_usage", + method="GET", + path="/usage", + path_param_examples={ + }, + success_status=200, + success_body=json.loads(""" + + { + "_links" : { + "self" : { + "hreflang" : "hreflang", + "templated" : true, + "profile" : "profile", + "name" : "name", + "href" : "https://api.thousandeyes.com/v7/link/to/resource/id", + "type" : "type", + "deprecation" : "deprecation", + "title" : "title" + } + }, + "usage" : { + "cloudUnitsProjected" : 20993812, + "connectedDevicesUnitsUsed" : 79640902, + "enterpriseAgentsUsed" : 58, + "endpointAgents" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsUsed" : 22 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsUsed" : 14 + } ], + "cloudUnitsNextBillingPeriod" : 25123456, + "enterpriseUnitsNextBillingPeriod" : 0, + "endpointAgentsUsed" : 42, + "enterpriseUnitsUsed" : 79640902, + "cloudUnitsUsed" : 8500489, + "connectedDevicesUnitsNextBillingPeriod" : 0, + "connectedDevicesUnitsProjected" : 108016317, + "tests" : [ { + "aid" : "1234", + "testId" : "1158", + "accountGroupName" : "Documentation", + "testName" : "https://app.thousandeyes.com", + "testType" : "Web-Page Load", + "cloudUnitsUsed" : 14050, + "cloudUnitsProjected" : 340674 + }, { + "aid" : "12345", + "testId" : "1159", + "accountGroupName" : "Documentation", + "testName" : "https://support.thousandeyes.com", + "testType" : "Web - HTTP Server", + "cloudUnitsUsed" : 64390, + "cloudUnitsProjected" : 164457 + } ], + "endpointAgentsEmbedded" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsEmbeddedUsed" : 2 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsEmbeddedUsed" : 3 + } ], + "allocations" : { + "used" : 1000, + "projected" : 1000, + "allocations" : [ { + "productName" : "Some Product Name", + "allocatedUnits" : 600 + } ] + }, + "endpointAgentsEssentialsUsed" : 5, + "quota" : { + "monthEnd" : "2020-02-05T08:00:00Z", + "endpointAgentsEmbeddedIncluded" : 10, + "enterpriseAgentsIncluded" : 25, + "monthStart" : "2020-01-05T08:00:00Z", + "cloudUnitsIncluded" : 4320000000, + "deviceAgentsIncluded" : 100, + "endpointAgentsIncluded" : 200, + "endpointAgentsEssentialsIncluded" : 10 + }, + "enterpriseUnitsProjected" : 108016317, + "endpointAgentsEmbeddedUsed" : 5, + "enterpriseAgents" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "enterpriseAgentsUsed" : 7 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "enterpriseAgentsUsed" : 1 + } ], + "enterpriseAgentUnits" : [ { + "aid" : "1234", + "agentId" : "123456", + "accountGroupName" : "Support", + "agentName" : "TEVA-test-agent", + "enterpriseUnitsUsed" : 599878, + "enterpriseUnitsProjected" : 597808 + }, { + "aid" : "315", + "agentId" : "789", + "accountGroupName" : "Documentation", + "agentName" : "lab-physical-appliance-1", + "enterpriseUnitsUsed" : 597123, + "enterpriseUnitsProjected" : 597808 + } ], + "endpointAgentsEssentials" : [ { + "aid" : "1234", + "accountGroupName" : "Support", + "endpointAgentsEssentialsUsed" : 2 + }, { + "aid" : "12345", + "accountGroupName" : "Documentation", + "endpointAgentsEssentialsUsed" : 3 + } ] + } + } + + """), + + success_content_type="application/json", + + request_body_example=None, + error_responses={ + + "400": ErrorResponseExpectation( + status=400, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "errors" : [ { + "code" : "code", + "field" : "field", + "message" : "message" + }, { + "code" : "code", + "field" : "field", + "message" : "message" + } ], + "status" : 0 + }"""), + content_type="application/json", + ), + + "401": ErrorResponseExpectation( + status=401, + body=json.loads(""" + { + "error_description" : "Invalid access token", + "error" : "invalid_token" + }"""), + content_type="application/json", + ), + + "403": ErrorResponseExpectation( + status=403, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "404": ErrorResponseExpectation( + status=404, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "429": ErrorResponseExpectation( + status=429, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + "500": ErrorResponseExpectation( + status=500, + body=json.loads(""" + { + "instance" : "instance", + "detail" : "detail", + "type" : "type", + "title" : "title", + "status" : 6 + }"""), + content_type="application/json", + ), + + }, + ), + +} diff --git a/thousandeyes-sdk-usage/test/test_quotas_api_integration.py b/thousandeyes-sdk-usage/test/test_quotas_api_integration.py new file mode 100644 index 00000000..49a00ba4 --- /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 00000000..dc835747 --- /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 930528d9..37913f62 100644 --- a/thousandeyes-sdk-usage/test/test_utils.py +++ b/thousandeyes-sdk-usage/test/test_utils.py @@ -2,15 +2,36 @@ import json import unittest +from typing import Any from pydantic import BaseModel +def _project_onto_constructed(expected: Any, constructed: Any) -> Any: + """Keep only example fields that appear in the constructed model output.""" + if isinstance(constructed, dict): + if not isinstance(expected, dict): + return expected + return { + key: _project_onto_constructed(expected.get(key), value) + for key, value in constructed.items() + } + if isinstance(constructed, list): + if not isinstance(expected, list): + return expected + return [ + _project_onto_constructed(expected[index], value) + for index, value in enumerate(constructed) + ] + return expected + + def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict): test_case = unittest.TestCase() test_case.maxDiff = None test_case.assertIsNotNone(model) constructed_json = json.loads(model.to_json()) - sorted_loaded_json = json.dumps(loaded_json, sort_keys=True) + projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json) + sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True) sorted_constructed_json = json.dumps(constructed_json, sort_keys=True) test_case.assertEqual(sorted_loaded_json, sorted_constructed_json)