thousandeyes-sdk-python/thousandeyes-sdk-instant-tests/test/test_web_transaction_instant_tests_api_integration.py
Kevin 5441f44f1f CP-2453 Add generated integration tests for all SDK packages
Sync OAS-driven integration test artifacts (mock manifest, test base, conftest, and per-operation integration tests) across 21 packages for CP-2453 full rollout evaluation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 12:07:00 +01:00

1411 lines
65 KiB
Python

# coding: utf-8
"""
Instant Tests API
The Instant Tests API operations lets you create and run new instant tests. You will need to be an Account Admin. The response does not include the immediate test results. Use the Test Results endpoints to get test results after creating and executing an instant test. You can find the URLs for these endpoints in the _links section of the test definition that is returned when you create the instant test.
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import json
import unittest
import thousandeyes_sdk.instant_tests.models
from thousandeyes_sdk.core.exceptions import ApiException
from thousandeyes_sdk.instant_tests.api.web_transaction_instant_tests_api import WebTransactionInstantTestsApi
from .integration_test_utils import IntegrationTestBase
from .test_utils import assert_constructed_model_matches_example_json
class TestWebTransactionInstantTestsApiIntegration(IntegrationTestBase):
"""WebTransactionInstantTestsApi integration test stubs"""
def setUp(self) -> None:
super().setUp()
self.api = WebTransactionInstantTestsApi(self.api_client)
def test_create_web_transaction_instant_test_happy_path(self) -> None:
"""Integration test for create_web_transaction_instant_test success path"""
request_body_json = """
{
"clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n",
"mtuMeasurements" : false,
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"dnsOverride" : "8.8.8.8",
"bandwidthMeasurements" : true,
"probeMode" : "auto",
"includeHeaders" : true,
"type" : "web-transactions",
"oAuth" : {
"testUrl" : "https://api.thousandeyes.com/v7/status",
"requestMethod" : "post",
"postBody" : "client_id: ************",
"headers" : "Authorization: Basic ************",
"authType" : "none",
"username" : "user123",
"password" : "*******"
},
"password" : "password",
"protocol" : "tcp",
"followRedirects" : true,
"chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}",
"contentRegex" : "(regex)+",
"pageLoadingStrategy" : "normal",
"testName" : "ThousandEyes Test",
"allowMicAndCamera" : false,
"browserLanguage" : "en-US",
"verifyCertificate" : false,
"overrideAgentProxy" : false,
"liveShare" : false,
"agentInterfaces" : {
"agentId" : "2954",
"ipAddress" : "192.1.1.0"
},
"labels" : [ "9842", "1283" ],
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
"randomizedStartTime" : false,
"modifiedDate" : "2022-07-17T22:00:54Z",
"emulatedDeviceId" : "2",
"sharedWithAccounts" : [ "1234", "12345" ],
"overrideProxyId" : "281474976710706",
"sslVersion" : "Auto",
"useNtlm" : false,
"credentials" : [ "3247", "1051" ],
"downloadLimit" : 2048,
"description" : "ThousandEyes Test",
"httpTimeLimit" : 5,
"blockDomains" : "domain.com/",
"vaultCredentials" : [ {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
}, {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
} ],
"allowGeolocation" : false,
"allowUnsafeLegacyRenegotiation" : true,
"fixedPacketRate" : 50,
"httpVersion" : 2,
"collectProxyNetworkData" : false,
"pathTraceMode" : "classic",
"modifiedBy" : "user@user.com",
"authType" : "none",
"customHeaders" : {
"root" : {
"header1" : "value1"
},
"domains" : {
"domain1.com" : {
"header2" : "value2"
}
},
"all" : {
"header3" : "value3"
}
},
"numPathTraces" : 3,
"transactionScript" : "if (true) { return true; }",
"distributedTracing" : false,
"savedEvent" : true,
"userAgent" : "curl",
"identifyAgentTrafficWithUserAgent" : false,
"networkMeasurements" : true,
"url" : "www.thousandeyes.com",
"agents" : [ {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
}, {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
} ],
"timeLimit" : 30,
"createdDate" : "2022-07-17T22:00:54Z",
"disableScreenshot" : false,
"createdBy" : "user@user.com",
"testId" : "281474976710706",
"chromeOptions" : "--disable-gpu",
"desiredStatusCode" : "200",
"httpTargetTime" : 100,
"sslVersionId" : "0",
"username" : "username",
"targetTime" : 1
}
"""
web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json)
aid = '1234'
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
response_body_json = """
{
&quot;clientCertificate&quot; : &quot;-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n&quot;,
&quot;mtuMeasurements&quot; : false,
&quot;_links&quot; : {
&quot;testResults&quot; : [ {
&quot;href&quot; : &quot;https://api.thousandeyes.com/v7/test-results/281474976710706/network&quot;
}, {
&quot;href&quot; : &quot;https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis&quot;
} ],
&quot;self&quot; : {
&quot;hreflang&quot; : &quot;hreflang&quot;,
&quot;templated&quot; : true,
&quot;profile&quot; : &quot;profile&quot;,
&quot;name&quot; : &quot;name&quot;,
&quot;href&quot; : &quot;https://api.thousandeyes.com/v7/link/to/resource/id&quot;,
&quot;type&quot; : &quot;type&quot;,
&quot;deprecation&quot; : &quot;deprecation&quot;,
&quot;title&quot; : &quot;title&quot;
}
},
&quot;dnsOverride&quot; : &quot;8.8.8.8&quot;,
&quot;bandwidthMeasurements&quot; : true,
&quot;probeMode&quot; : &quot;auto&quot;,
&quot;includeHeaders&quot; : true,
&quot;type&quot; : &quot;web-transactions&quot;,
&quot;oAuth&quot; : {
&quot;testUrl&quot; : &quot;https://api.thousandeyes.com/v7/status&quot;,
&quot;requestMethod&quot; : &quot;post&quot;,
&quot;postBody&quot; : &quot;client_id: ************&quot;,
&quot;headers&quot; : &quot;Authorization: Basic ************&quot;,
&quot;authType&quot; : &quot;none&quot;,
&quot;username&quot; : &quot;user123&quot;,
&quot;password&quot; : &quot;*******&quot;
},
&quot;password&quot; : &quot;password&quot;,
&quot;protocol&quot; : &quot;tcp&quot;,
&quot;followRedirects&quot; : true,
&quot;chromePolicies&quot; : &quot;{\&quot;ProxyMode\&quot;:\&quot;direct\&quot;}&quot;,
&quot;contentRegex&quot; : &quot;(regex)+&quot;,
&quot;pageLoadingStrategy&quot; : &quot;normal&quot;,
&quot;testName&quot; : &quot;ThousandEyes Test&quot;,
&quot;allowMicAndCamera&quot; : false,
&quot;browserLanguage&quot; : &quot;en-US&quot;,
&quot;verifyCertificate&quot; : false,
&quot;overrideAgentProxy&quot; : false,
&quot;liveShare&quot; : false,
&quot;agentInterfaces&quot; : {
&quot;agentId&quot; : &quot;2954&quot;,
&quot;ipAddress&quot; : &quot;192.1.1.0&quot;
},
&quot;labels&quot; : [ {
&quot;labelId&quot; : &quot;961&quot;,
&quot;name&quot; : &quot;Artem label&quot;,
&quot;isBuiltin&quot; : false
}, {
&quot;labelId&quot; : &quot;961&quot;,
&quot;name&quot; : &quot;Artem label&quot;,
&quot;isBuiltin&quot; : false
} ],
&quot;tags&quot; : [ {
&quot;id&quot; : &quot;5aeab5d5-0d34-4d44-a7ac-fb440185295c&quot;,
&quot;value&quot; : &quot;San Francisco&quot;,
&quot;key&quot; : &quot;Location&quot;
}, {
&quot;id&quot; : &quot;5aeab5d5-0d34-4d44-a7ac-fb440185295c&quot;,
&quot;value&quot; : &quot;San Francisco&quot;,
&quot;key&quot; : &quot;Location&quot;
} ],
&quot;randomizedStartTime&quot; : false,
&quot;modifiedDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;emulatedDeviceId&quot; : &quot;2&quot;,
&quot;sharedWithAccounts&quot; : [ {
&quot;name&quot; : &quot;Account name&quot;,
&quot;aid&quot; : &quot;1234&quot;
}, {
&quot;name&quot; : &quot;Account name&quot;,
&quot;aid&quot; : &quot;1234&quot;
} ],
&quot;overrideProxyId&quot; : &quot;281474976710706&quot;,
&quot;sslVersion&quot; : &quot;Auto&quot;,
&quot;useNtlm&quot; : false,
&quot;credentials&quot; : [ &quot;3247&quot;, &quot;1051&quot; ],
&quot;downloadLimit&quot; : 2048,
&quot;description&quot; : &quot;ThousandEyes Test&quot;,
&quot;httpTimeLimit&quot; : 5,
&quot;blockDomains&quot; : &quot;domain.com/&quot;,
&quot;vaultCredentials&quot; : [ {
&quot;secretId&quot; : &quot;f27e85b2-318b-4145-b5aa-c9dc8d8b0819&quot;,
&quot;target&quot; : &quot;username&quot;
}, {
&quot;secretId&quot; : &quot;f27e85b2-318b-4145-b5aa-c9dc8d8b0819&quot;,
&quot;target&quot; : &quot;username&quot;
} ],
&quot;allowGeolocation&quot; : false,
&quot;allowUnsafeLegacyRenegotiation&quot; : true,
&quot;fixedPacketRate&quot; : 50,
&quot;httpVersion&quot; : 2,
&quot;collectProxyNetworkData&quot; : false,
&quot;pathTraceMode&quot; : &quot;classic&quot;,
&quot;modifiedBy&quot; : &quot;user@user.com&quot;,
&quot;authType&quot; : &quot;none&quot;,
&quot;customHeaders&quot; : {
&quot;root&quot; : {
&quot;header1&quot; : &quot;value1&quot;
},
&quot;domains&quot; : {
&quot;domain1.com&quot; : {
&quot;header2&quot; : &quot;value2&quot;
}
},
&quot;all&quot; : {
&quot;header3&quot; : &quot;value3&quot;
}
},
&quot;numPathTraces&quot; : 3,
&quot;transactionScript&quot; : &quot;if (true) { return true; }&quot;,
&quot;distributedTracing&quot; : false,
&quot;savedEvent&quot; : true,
&quot;userAgent&quot; : &quot;curl&quot;,
&quot;identifyAgentTrafficWithUserAgent&quot; : false,
&quot;networkMeasurements&quot; : true,
&quot;url&quot; : &quot;www.thousandeyes.com&quot;,
&quot;agents&quot; : [ {
&quot;agentId&quot; : &quot;281474976710706&quot;,
&quot;agentType&quot; : &quot;enterprise-cluster&quot;,
&quot;prefix&quot; : &quot;99.128.0.0/11&quot;,
&quot;coordinates&quot; : {
&quot;latitude&quot; : 37.77493,
&quot;longitude&quot; : -122.41942
},
&quot;agentName&quot; : &quot;thousandeyes-stg-va-254&quot;,
&quot;networkProviderInfo&quot; : {
&quot;asn&quot; : 7018,
&quot;name&quot; : &quot;AT&amp;T Services, Inc.&quot;,
&quot;type&quot; : &quot;isp&quot;
},
&quot;countryId&quot; : &quot;US&quot;,
&quot;enabled&quot; : true,
&quot;network&quot; : &quot;AT&amp;T Services, Inc. (AS 7018)&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;ipAddresses&quot; : [ &quot;99.139.65.220&quot;, &quot;9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce&quot; ],
&quot;location&quot; : &quot;San Francisco Bay Area&quot;,
&quot;verifySslCertificates&quot; : true
}, {
&quot;agentId&quot; : &quot;281474976710706&quot;,
&quot;agentType&quot; : &quot;enterprise-cluster&quot;,
&quot;prefix&quot; : &quot;99.128.0.0/11&quot;,
&quot;coordinates&quot; : {
&quot;latitude&quot; : 37.77493,
&quot;longitude&quot; : -122.41942
},
&quot;agentName&quot; : &quot;thousandeyes-stg-va-254&quot;,
&quot;networkProviderInfo&quot; : {
&quot;asn&quot; : 7018,
&quot;name&quot; : &quot;AT&amp;T Services, Inc.&quot;,
&quot;type&quot; : &quot;isp&quot;
},
&quot;countryId&quot; : &quot;US&quot;,
&quot;enabled&quot; : true,
&quot;network&quot; : &quot;AT&amp;T Services, Inc. (AS 7018)&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;ipAddresses&quot; : [ &quot;99.139.65.220&quot;, &quot;9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce&quot; ],
&quot;location&quot; : &quot;San Francisco Bay Area&quot;,
&quot;verifySslCertificates&quot; : true
} ],
&quot;timeLimit&quot; : 30,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;disableScreenshot&quot; : false,
&quot;createdBy&quot; : &quot;user@user.com&quot;,
&quot;testId&quot; : &quot;281474976710706&quot;,
&quot;chromeOptions&quot; : &quot;--disable-gpu&quot;,
&quot;desiredStatusCode&quot; : &quot;200&quot;,
&quot;httpTargetTime&quot; : 100,
&quot;sslVersionId&quot; : &quot;0&quot;,
&quot;username&quot; : &quot;username&quot;,
&quot;targetTime&quot; : 1
}
"""
expected_response = json.loads(response_body_json)
response = self.api.create_web_transaction_instant_test(
web_transaction_instant_test_request=web_transaction_instant_test_request,
aid=aid,
expand=expand,
_headers=self.te_headers("create_web_transaction_instant_test"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_create_web_transaction_instant_test_error_400(self) -> None:
"""Integration test for create_web_transaction_instant_test error path (HTTP 400)"""
request_body_json = """
{
"clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n",
"mtuMeasurements" : false,
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"dnsOverride" : "8.8.8.8",
"bandwidthMeasurements" : true,
"probeMode" : "auto",
"includeHeaders" : true,
"type" : "web-transactions",
"oAuth" : {
"testUrl" : "https://api.thousandeyes.com/v7/status",
"requestMethod" : "post",
"postBody" : "client_id: ************",
"headers" : "Authorization: Basic ************",
"authType" : "none",
"username" : "user123",
"password" : "*******"
},
"password" : "password",
"protocol" : "tcp",
"followRedirects" : true,
"chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}",
"contentRegex" : "(regex)+",
"pageLoadingStrategy" : "normal",
"testName" : "ThousandEyes Test",
"allowMicAndCamera" : false,
"browserLanguage" : "en-US",
"verifyCertificate" : false,
"overrideAgentProxy" : false,
"liveShare" : false,
"agentInterfaces" : {
"agentId" : "2954",
"ipAddress" : "192.1.1.0"
},
"labels" : [ "9842", "1283" ],
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
"randomizedStartTime" : false,
"modifiedDate" : "2022-07-17T22:00:54Z",
"emulatedDeviceId" : "2",
"sharedWithAccounts" : [ "1234", "12345" ],
"overrideProxyId" : "281474976710706",
"sslVersion" : "Auto",
"useNtlm" : false,
"credentials" : [ "3247", "1051" ],
"downloadLimit" : 2048,
"description" : "ThousandEyes Test",
"httpTimeLimit" : 5,
"blockDomains" : "domain.com/",
"vaultCredentials" : [ {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
}, {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
} ],
"allowGeolocation" : false,
"allowUnsafeLegacyRenegotiation" : true,
"fixedPacketRate" : 50,
"httpVersion" : 2,
"collectProxyNetworkData" : false,
"pathTraceMode" : "classic",
"modifiedBy" : "user@user.com",
"authType" : "none",
"customHeaders" : {
"root" : {
"header1" : "value1"
},
"domains" : {
"domain1.com" : {
"header2" : "value2"
}
},
"all" : {
"header3" : "value3"
}
},
"numPathTraces" : 3,
"transactionScript" : "if (true) { return true; }",
"distributedTracing" : false,
"savedEvent" : true,
"userAgent" : "curl",
"identifyAgentTrafficWithUserAgent" : false,
"networkMeasurements" : true,
"url" : "www.thousandeyes.com",
"agents" : [ {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
}, {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
} ],
"timeLimit" : 30,
"createdDate" : "2022-07-17T22:00:54Z",
"disableScreenshot" : false,
"createdBy" : "user@user.com",
"testId" : "281474976710706",
"chromeOptions" : "--disable-gpu",
"desiredStatusCode" : "200",
"httpTargetTime" : 100,
"sslVersionId" : "0",
"username" : "username",
"targetTime" : 1
}
"""
web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json)
aid = '1234'
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"errors" : [ {
"code" : "code",
"field" : "field",
"message" : "message"
}, {
"code" : "code",
"field" : "field",
"message" : "message"
} ],
"status" : 0
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(400)
) as context:
self.api.create_web_transaction_instant_test(
web_transaction_instant_test_request=web_transaction_instant_test_request,
aid=aid,
expand=expand,
_headers=self.te_headers("create_web_transaction_instant_test", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_web_transaction_instant_test_error_401(self) -> None:
"""Integration test for create_web_transaction_instant_test error path (HTTP 401)"""
request_body_json = """
{
"clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n",
"mtuMeasurements" : false,
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"dnsOverride" : "8.8.8.8",
"bandwidthMeasurements" : true,
"probeMode" : "auto",
"includeHeaders" : true,
"type" : "web-transactions",
"oAuth" : {
"testUrl" : "https://api.thousandeyes.com/v7/status",
"requestMethod" : "post",
"postBody" : "client_id: ************",
"headers" : "Authorization: Basic ************",
"authType" : "none",
"username" : "user123",
"password" : "*******"
},
"password" : "password",
"protocol" : "tcp",
"followRedirects" : true,
"chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}",
"contentRegex" : "(regex)+",
"pageLoadingStrategy" : "normal",
"testName" : "ThousandEyes Test",
"allowMicAndCamera" : false,
"browserLanguage" : "en-US",
"verifyCertificate" : false,
"overrideAgentProxy" : false,
"liveShare" : false,
"agentInterfaces" : {
"agentId" : "2954",
"ipAddress" : "192.1.1.0"
},
"labels" : [ "9842", "1283" ],
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
"randomizedStartTime" : false,
"modifiedDate" : "2022-07-17T22:00:54Z",
"emulatedDeviceId" : "2",
"sharedWithAccounts" : [ "1234", "12345" ],
"overrideProxyId" : "281474976710706",
"sslVersion" : "Auto",
"useNtlm" : false,
"credentials" : [ "3247", "1051" ],
"downloadLimit" : 2048,
"description" : "ThousandEyes Test",
"httpTimeLimit" : 5,
"blockDomains" : "domain.com/",
"vaultCredentials" : [ {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
}, {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
} ],
"allowGeolocation" : false,
"allowUnsafeLegacyRenegotiation" : true,
"fixedPacketRate" : 50,
"httpVersion" : 2,
"collectProxyNetworkData" : false,
"pathTraceMode" : "classic",
"modifiedBy" : "user@user.com",
"authType" : "none",
"customHeaders" : {
"root" : {
"header1" : "value1"
},
"domains" : {
"domain1.com" : {
"header2" : "value2"
}
},
"all" : {
"header3" : "value3"
}
},
"numPathTraces" : 3,
"transactionScript" : "if (true) { return true; }",
"distributedTracing" : false,
"savedEvent" : true,
"userAgent" : "curl",
"identifyAgentTrafficWithUserAgent" : false,
"networkMeasurements" : true,
"url" : "www.thousandeyes.com",
"agents" : [ {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
}, {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
} ],
"timeLimit" : 30,
"createdDate" : "2022-07-17T22:00:54Z",
"disableScreenshot" : false,
"createdBy" : "user@user.com",
"testId" : "281474976710706",
"chromeOptions" : "--disable-gpu",
"desiredStatusCode" : "200",
"httpTargetTime" : 100,
"sslVersionId" : "0",
"username" : "username",
"targetTime" : 1
}
"""
web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json)
aid = '1234'
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
error_body_json = """
{
"error_description" : "Invalid access token",
"error" : "invalid_token"
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(401)
) as context:
self.api.create_web_transaction_instant_test(
web_transaction_instant_test_request=web_transaction_instant_test_request,
aid=aid,
expand=expand,
_headers=self.te_headers("create_web_transaction_instant_test", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_web_transaction_instant_test_error_403(self) -> None:
"""Integration test for create_web_transaction_instant_test error path (HTTP 403)"""
request_body_json = """
{
"clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n",
"mtuMeasurements" : false,
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"dnsOverride" : "8.8.8.8",
"bandwidthMeasurements" : true,
"probeMode" : "auto",
"includeHeaders" : true,
"type" : "web-transactions",
"oAuth" : {
"testUrl" : "https://api.thousandeyes.com/v7/status",
"requestMethod" : "post",
"postBody" : "client_id: ************",
"headers" : "Authorization: Basic ************",
"authType" : "none",
"username" : "user123",
"password" : "*******"
},
"password" : "password",
"protocol" : "tcp",
"followRedirects" : true,
"chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}",
"contentRegex" : "(regex)+",
"pageLoadingStrategy" : "normal",
"testName" : "ThousandEyes Test",
"allowMicAndCamera" : false,
"browserLanguage" : "en-US",
"verifyCertificate" : false,
"overrideAgentProxy" : false,
"liveShare" : false,
"agentInterfaces" : {
"agentId" : "2954",
"ipAddress" : "192.1.1.0"
},
"labels" : [ "9842", "1283" ],
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
"randomizedStartTime" : false,
"modifiedDate" : "2022-07-17T22:00:54Z",
"emulatedDeviceId" : "2",
"sharedWithAccounts" : [ "1234", "12345" ],
"overrideProxyId" : "281474976710706",
"sslVersion" : "Auto",
"useNtlm" : false,
"credentials" : [ "3247", "1051" ],
"downloadLimit" : 2048,
"description" : "ThousandEyes Test",
"httpTimeLimit" : 5,
"blockDomains" : "domain.com/",
"vaultCredentials" : [ {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
}, {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
} ],
"allowGeolocation" : false,
"allowUnsafeLegacyRenegotiation" : true,
"fixedPacketRate" : 50,
"httpVersion" : 2,
"collectProxyNetworkData" : false,
"pathTraceMode" : "classic",
"modifiedBy" : "user@user.com",
"authType" : "none",
"customHeaders" : {
"root" : {
"header1" : "value1"
},
"domains" : {
"domain1.com" : {
"header2" : "value2"
}
},
"all" : {
"header3" : "value3"
}
},
"numPathTraces" : 3,
"transactionScript" : "if (true) { return true; }",
"distributedTracing" : false,
"savedEvent" : true,
"userAgent" : "curl",
"identifyAgentTrafficWithUserAgent" : false,
"networkMeasurements" : true,
"url" : "www.thousandeyes.com",
"agents" : [ {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
}, {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
} ],
"timeLimit" : 30,
"createdDate" : "2022-07-17T22:00:54Z",
"disableScreenshot" : false,
"createdBy" : "user@user.com",
"testId" : "281474976710706",
"chromeOptions" : "--disable-gpu",
"desiredStatusCode" : "200",
"httpTargetTime" : 100,
"sslVersionId" : "0",
"username" : "username",
"targetTime" : 1
}
"""
web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json)
aid = '1234'
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 0
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(403)
) as context:
self.api.create_web_transaction_instant_test(
web_transaction_instant_test_request=web_transaction_instant_test_request,
aid=aid,
expand=expand,
_headers=self.te_headers("create_web_transaction_instant_test", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_web_transaction_instant_test_error_404(self) -> None:
"""Integration test for create_web_transaction_instant_test error path (HTTP 404)"""
request_body_json = """
{
"clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n",
"mtuMeasurements" : false,
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"dnsOverride" : "8.8.8.8",
"bandwidthMeasurements" : true,
"probeMode" : "auto",
"includeHeaders" : true,
"type" : "web-transactions",
"oAuth" : {
"testUrl" : "https://api.thousandeyes.com/v7/status",
"requestMethod" : "post",
"postBody" : "client_id: ************",
"headers" : "Authorization: Basic ************",
"authType" : "none",
"username" : "user123",
"password" : "*******"
},
"password" : "password",
"protocol" : "tcp",
"followRedirects" : true,
"chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}",
"contentRegex" : "(regex)+",
"pageLoadingStrategy" : "normal",
"testName" : "ThousandEyes Test",
"allowMicAndCamera" : false,
"browserLanguage" : "en-US",
"verifyCertificate" : false,
"overrideAgentProxy" : false,
"liveShare" : false,
"agentInterfaces" : {
"agentId" : "2954",
"ipAddress" : "192.1.1.0"
},
"labels" : [ "9842", "1283" ],
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
"randomizedStartTime" : false,
"modifiedDate" : "2022-07-17T22:00:54Z",
"emulatedDeviceId" : "2",
"sharedWithAccounts" : [ "1234", "12345" ],
"overrideProxyId" : "281474976710706",
"sslVersion" : "Auto",
"useNtlm" : false,
"credentials" : [ "3247", "1051" ],
"downloadLimit" : 2048,
"description" : "ThousandEyes Test",
"httpTimeLimit" : 5,
"blockDomains" : "domain.com/",
"vaultCredentials" : [ {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
}, {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
} ],
"allowGeolocation" : false,
"allowUnsafeLegacyRenegotiation" : true,
"fixedPacketRate" : 50,
"httpVersion" : 2,
"collectProxyNetworkData" : false,
"pathTraceMode" : "classic",
"modifiedBy" : "user@user.com",
"authType" : "none",
"customHeaders" : {
"root" : {
"header1" : "value1"
},
"domains" : {
"domain1.com" : {
"header2" : "value2"
}
},
"all" : {
"header3" : "value3"
}
},
"numPathTraces" : 3,
"transactionScript" : "if (true) { return true; }",
"distributedTracing" : false,
"savedEvent" : true,
"userAgent" : "curl",
"identifyAgentTrafficWithUserAgent" : false,
"networkMeasurements" : true,
"url" : "www.thousandeyes.com",
"agents" : [ {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
}, {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
} ],
"timeLimit" : 30,
"createdDate" : "2022-07-17T22:00:54Z",
"disableScreenshot" : false,
"createdBy" : "user@user.com",
"testId" : "281474976710706",
"chromeOptions" : "--disable-gpu",
"desiredStatusCode" : "200",
"httpTargetTime" : 100,
"sslVersionId" : "0",
"username" : "username",
"targetTime" : 1
}
"""
web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json)
aid = '1234'
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 0
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(404)
) as context:
self.api.create_web_transaction_instant_test(
web_transaction_instant_test_request=web_transaction_instant_test_request,
aid=aid,
expand=expand,
_headers=self.te_headers("create_web_transaction_instant_test", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_web_transaction_instant_test_error_429(self) -> None:
"""Integration test for create_web_transaction_instant_test error path (HTTP 429)"""
request_body_json = """
{
"clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n",
"mtuMeasurements" : false,
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"dnsOverride" : "8.8.8.8",
"bandwidthMeasurements" : true,
"probeMode" : "auto",
"includeHeaders" : true,
"type" : "web-transactions",
"oAuth" : {
"testUrl" : "https://api.thousandeyes.com/v7/status",
"requestMethod" : "post",
"postBody" : "client_id: ************",
"headers" : "Authorization: Basic ************",
"authType" : "none",
"username" : "user123",
"password" : "*******"
},
"password" : "password",
"protocol" : "tcp",
"followRedirects" : true,
"chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}",
"contentRegex" : "(regex)+",
"pageLoadingStrategy" : "normal",
"testName" : "ThousandEyes Test",
"allowMicAndCamera" : false,
"browserLanguage" : "en-US",
"verifyCertificate" : false,
"overrideAgentProxy" : false,
"liveShare" : false,
"agentInterfaces" : {
"agentId" : "2954",
"ipAddress" : "192.1.1.0"
},
"labels" : [ "9842", "1283" ],
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
"randomizedStartTime" : false,
"modifiedDate" : "2022-07-17T22:00:54Z",
"emulatedDeviceId" : "2",
"sharedWithAccounts" : [ "1234", "12345" ],
"overrideProxyId" : "281474976710706",
"sslVersion" : "Auto",
"useNtlm" : false,
"credentials" : [ "3247", "1051" ],
"downloadLimit" : 2048,
"description" : "ThousandEyes Test",
"httpTimeLimit" : 5,
"blockDomains" : "domain.com/",
"vaultCredentials" : [ {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
}, {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
} ],
"allowGeolocation" : false,
"allowUnsafeLegacyRenegotiation" : true,
"fixedPacketRate" : 50,
"httpVersion" : 2,
"collectProxyNetworkData" : false,
"pathTraceMode" : "classic",
"modifiedBy" : "user@user.com",
"authType" : "none",
"customHeaders" : {
"root" : {
"header1" : "value1"
},
"domains" : {
"domain1.com" : {
"header2" : "value2"
}
},
"all" : {
"header3" : "value3"
}
},
"numPathTraces" : 3,
"transactionScript" : "if (true) { return true; }",
"distributedTracing" : false,
"savedEvent" : true,
"userAgent" : "curl",
"identifyAgentTrafficWithUserAgent" : false,
"networkMeasurements" : true,
"url" : "www.thousandeyes.com",
"agents" : [ {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
}, {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
} ],
"timeLimit" : 30,
"createdDate" : "2022-07-17T22:00:54Z",
"disableScreenshot" : false,
"createdBy" : "user@user.com",
"testId" : "281474976710706",
"chromeOptions" : "--disable-gpu",
"desiredStatusCode" : "200",
"httpTargetTime" : 100,
"sslVersionId" : "0",
"username" : "username",
"targetTime" : 1
}
"""
web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json)
aid = '1234'
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 0
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(429)
) as context:
self.api.create_web_transaction_instant_test(
web_transaction_instant_test_request=web_transaction_instant_test_request,
aid=aid,
expand=expand,
_headers=self.te_headers("create_web_transaction_instant_test", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_web_transaction_instant_test_error_500(self) -> None:
"""Integration test for create_web_transaction_instant_test error path (HTTP 500)"""
request_body_json = """
{
"clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n",
"mtuMeasurements" : false,
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"dnsOverride" : "8.8.8.8",
"bandwidthMeasurements" : true,
"probeMode" : "auto",
"includeHeaders" : true,
"type" : "web-transactions",
"oAuth" : {
"testUrl" : "https://api.thousandeyes.com/v7/status",
"requestMethod" : "post",
"postBody" : "client_id: ************",
"headers" : "Authorization: Basic ************",
"authType" : "none",
"username" : "user123",
"password" : "*******"
},
"password" : "password",
"protocol" : "tcp",
"followRedirects" : true,
"chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}",
"contentRegex" : "(regex)+",
"pageLoadingStrategy" : "normal",
"testName" : "ThousandEyes Test",
"allowMicAndCamera" : false,
"browserLanguage" : "en-US",
"verifyCertificate" : false,
"overrideAgentProxy" : false,
"liveShare" : false,
"agentInterfaces" : {
"agentId" : "2954",
"ipAddress" : "192.1.1.0"
},
"labels" : [ "9842", "1283" ],
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
"randomizedStartTime" : false,
"modifiedDate" : "2022-07-17T22:00:54Z",
"emulatedDeviceId" : "2",
"sharedWithAccounts" : [ "1234", "12345" ],
"overrideProxyId" : "281474976710706",
"sslVersion" : "Auto",
"useNtlm" : false,
"credentials" : [ "3247", "1051" ],
"downloadLimit" : 2048,
"description" : "ThousandEyes Test",
"httpTimeLimit" : 5,
"blockDomains" : "domain.com/",
"vaultCredentials" : [ {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
}, {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
} ],
"allowGeolocation" : false,
"allowUnsafeLegacyRenegotiation" : true,
"fixedPacketRate" : 50,
"httpVersion" : 2,
"collectProxyNetworkData" : false,
"pathTraceMode" : "classic",
"modifiedBy" : "user@user.com",
"authType" : "none",
"customHeaders" : {
"root" : {
"header1" : "value1"
},
"domains" : {
"domain1.com" : {
"header2" : "value2"
}
},
"all" : {
"header3" : "value3"
}
},
"numPathTraces" : 3,
"transactionScript" : "if (true) { return true; }",
"distributedTracing" : false,
"savedEvent" : true,
"userAgent" : "curl",
"identifyAgentTrafficWithUserAgent" : false,
"networkMeasurements" : true,
"url" : "www.thousandeyes.com",
"agents" : [ {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
}, {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
} ],
"timeLimit" : 30,
"createdDate" : "2022-07-17T22:00:54Z",
"disableScreenshot" : false,
"createdBy" : "user@user.com",
"testId" : "281474976710706",
"chromeOptions" : "--disable-gpu",
"desiredStatusCode" : "200",
"httpTargetTime" : 100,
"sslVersionId" : "0",
"username" : "username",
"targetTime" : 1
}
"""
web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json)
aid = '1234'
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 0
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(500)
) as context:
self.api.create_web_transaction_instant_test(
web_transaction_instant_test_request=web_transaction_instant_test_request,
aid=aid,
expand=expand,
_headers=self.te_headers("create_web_transaction_instant_test", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_web_transaction_instant_test_error_502(self) -> None:
"""Integration test for create_web_transaction_instant_test error path (HTTP 502)"""
request_body_json = """
{
"clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n",
"mtuMeasurements" : false,
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"dnsOverride" : "8.8.8.8",
"bandwidthMeasurements" : true,
"probeMode" : "auto",
"includeHeaders" : true,
"type" : "web-transactions",
"oAuth" : {
"testUrl" : "https://api.thousandeyes.com/v7/status",
"requestMethod" : "post",
"postBody" : "client_id: ************",
"headers" : "Authorization: Basic ************",
"authType" : "none",
"username" : "user123",
"password" : "*******"
},
"password" : "password",
"protocol" : "tcp",
"followRedirects" : true,
"chromePolicies" : "{\\"ProxyMode\\":\\"direct\\"}",
"contentRegex" : "(regex)+",
"pageLoadingStrategy" : "normal",
"testName" : "ThousandEyes Test",
"allowMicAndCamera" : false,
"browserLanguage" : "en-US",
"verifyCertificate" : false,
"overrideAgentProxy" : false,
"liveShare" : false,
"agentInterfaces" : {
"agentId" : "2954",
"ipAddress" : "192.1.1.0"
},
"labels" : [ "9842", "1283" ],
"tags" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "c6b78e57-81a2-4c5f-a11a-d96c3c664d55" ],
"randomizedStartTime" : false,
"modifiedDate" : "2022-07-17T22:00:54Z",
"emulatedDeviceId" : "2",
"sharedWithAccounts" : [ "1234", "12345" ],
"overrideProxyId" : "281474976710706",
"sslVersion" : "Auto",
"useNtlm" : false,
"credentials" : [ "3247", "1051" ],
"downloadLimit" : 2048,
"description" : "ThousandEyes Test",
"httpTimeLimit" : 5,
"blockDomains" : "domain.com/",
"vaultCredentials" : [ {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
}, {
"secretId" : "f27e85b2-318b-4145-b5aa-c9dc8d8b0819",
"target" : "username"
} ],
"allowGeolocation" : false,
"allowUnsafeLegacyRenegotiation" : true,
"fixedPacketRate" : 50,
"httpVersion" : 2,
"collectProxyNetworkData" : false,
"pathTraceMode" : "classic",
"modifiedBy" : "user@user.com",
"authType" : "none",
"customHeaders" : {
"root" : {
"header1" : "value1"
},
"domains" : {
"domain1.com" : {
"header2" : "value2"
}
},
"all" : {
"header3" : "value3"
}
},
"numPathTraces" : 3,
"transactionScript" : "if (true) { return true; }",
"distributedTracing" : false,
"savedEvent" : true,
"userAgent" : "curl",
"identifyAgentTrafficWithUserAgent" : false,
"networkMeasurements" : true,
"url" : "www.thousandeyes.com",
"agents" : [ {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
}, {
"agentId" : "125",
"sourceIpAddress" : "1.1.1.1"
} ],
"timeLimit" : 30,
"createdDate" : "2022-07-17T22:00:54Z",
"disableScreenshot" : false,
"createdBy" : "user@user.com",
"testId" : "281474976710706",
"chromeOptions" : "--disable-gpu",
"desiredStatusCode" : "200",
"httpTargetTime" : 100,
"sslVersionId" : "0",
"username" : "username",
"targetTime" : 1
}
"""
web_transaction_instant_test_request = thousandeyes_sdk.instant_tests.models.WebTransactionInstantTestRequest.from_json(request_body_json)
aid = '1234'
expand = [thousandeyes_sdk.instant_tests.ExpandInstantTestOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 0
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(502)
) as context:
self.api.create_web_transaction_instant_test(
web_transaction_instant_test_request=web_transaction_instant_test_request,
aid=aid,
expand=expand,
_headers=self.te_headers("create_web_transaction_instant_test", error_status="502"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
if __name__ == '__main__':
unittest.main()