mirror of
https://github.com/thousandeyes/thousandeyes-sdk-python.git
synced 2026-08-04 00:46:52 +00:00
Success response bodies now use valid JSON quotes instead of HTML entities, and optional expand enum params are omitted when OpenAPI examples are invalid. Co-authored-by: Cursor <cursoragent@cursor.com>
4075 lines
171 KiB
Python
4075 lines
171 KiB
Python
# 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()
|