mirror of
https://github.com/thousandeyes/thousandeyes-sdk-python.git
synced 2025-12-06 14:36:50 +00:00
Some checks failed
Python CI / build (push) Has been cancelled
Co-authored-by: API Team <api-team@thousandeyes.com>
1100 lines
49 KiB
Python
1100 lines
49 KiB
Python
# coding: utf-8
|
|
|
|
"""
|
|
Tests API
|
|
|
|
This API supports listing, creating, editing, and deleting Cloud and Enterprise Agent (CEA) based 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 .test_utils import assert_constructed_model_matches_example_json
|
|
from thousandeyes_sdk.tests.api.web_transaction_api import WebTransactionApi
|
|
|
|
|
|
class TestWebTransactionApi(unittest.TestCase):
|
|
"""WebTransactionApi unit test stubs"""
|
|
|
|
def setUp(self) -> None:
|
|
self.api = WebTransactionApi()
|
|
|
|
def tearDown(self) -> None:
|
|
pass
|
|
|
|
def test_create_web_transactions_test_models_validation(self) -> None:
|
|
"""Test case for create_web_transactions_test request and response models"""
|
|
request_body_json = """
|
|
{
|
|
"clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n",
|
|
"mtuMeasurements" : false,
|
|
"_links" : {
|
|
"testResults" : [ {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
|
}, {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
|
} ],
|
|
"self" : {
|
|
"hreflang" : "hreflang",
|
|
"templated" : true,
|
|
"profile" : "profile",
|
|
"name" : "name",
|
|
"href" : "https://api.thousandeyes.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" : {
|
|
"configId" : "123321123",
|
|
"testUrl" : "https://api.thousandeyes.com/v7/status",
|
|
"requestMethod" : "get",
|
|
"postBody" : "client_id: ************",
|
|
"headers" : "Authorization: Basic ************",
|
|
"authType" : "none",
|
|
"username" : "user123",
|
|
"password" : "*******"
|
|
},
|
|
"password" : "password",
|
|
"protocol" : "tcp",
|
|
"followRedirects" : true,
|
|
"contentRegex" : "(regex)+",
|
|
"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" ],
|
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
|
"interval" : 120,
|
|
"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,
|
|
"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; }",
|
|
"savedEvent" : true,
|
|
"userAgent" : "curl",
|
|
"networkMeasurements" : true,
|
|
"url" : "www.thousandeyes.com",
|
|
"agents" : [ {
|
|
"agentId" : "125",
|
|
"sourceIpAddress" : "1.1.1.1"
|
|
}, {
|
|
"agentId" : "125",
|
|
"sourceIpAddress" : "1.1.1.1"
|
|
} ],
|
|
"timeLimit" : 30,
|
|
"createdDate" : "2022-07-17T22:00:54Z",
|
|
"disableScreenshot" : false,
|
|
"createdBy" : "user@user.com",
|
|
"testId" : "281474976710706",
|
|
"subinterval" : 60,
|
|
"desiredStatusCode" : "200",
|
|
"httpTargetTime" : 100,
|
|
"sslVersionId" : "0",
|
|
"username" : "username",
|
|
"targetTime" : 1
|
|
}"""
|
|
|
|
request_loaded_json = json.loads(request_body_json)
|
|
request_from_json = thousandeyes_sdk.tests.models.UpdateWebTransactionTest.from_json(request_body_json)
|
|
assert_constructed_model_matches_example_json(request_from_json, request_loaded_json)
|
|
|
|
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" : {
|
|
"configId" : "123321123",
|
|
"testUrl" : "https://api.thousandeyes.com/v7/status",
|
|
"requestMethod" : "get",
|
|
"postBody" : "client_id: ************",
|
|
"headers" : "Authorization: Basic ************",
|
|
"authType" : "none",
|
|
"username" : "user123",
|
|
"password" : "*******"
|
|
},
|
|
"password" : "password",
|
|
"protocol" : "tcp",
|
|
"followRedirects" : true,
|
|
"contentRegex" : "(regex)+",
|
|
"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
|
|
} ],
|
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
|
"interval" : 120,
|
|
"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,
|
|
"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; }",
|
|
"savedEvent" : true,
|
|
"userAgent" : "curl",
|
|
"networkMeasurements" : true,
|
|
"url" : "www.thousandeyes.com",
|
|
"agents" : [ {
|
|
"agentId" : "281474976710706",
|
|
"agentType" : "enterprise-cluster",
|
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
|
"prefix" : "99.128.0.0/11",
|
|
"agentName" : "thousandeyes-stg-va-254",
|
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
|
"location" : "San Francisco Bay Area",
|
|
"countryId" : "US",
|
|
"enabled" : true,
|
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
|
"verifySslCertificates" : true
|
|
}, {
|
|
"agentId" : "281474976710706",
|
|
"agentType" : "enterprise-cluster",
|
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
|
"prefix" : "99.128.0.0/11",
|
|
"agentName" : "thousandeyes-stg-va-254",
|
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
|
"location" : "San Francisco Bay Area",
|
|
"countryId" : "US",
|
|
"enabled" : true,
|
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
|
"verifySslCertificates" : true
|
|
} ],
|
|
"timeLimit" : 30,
|
|
"createdDate" : "2022-07-17T22:00:54Z",
|
|
"disableScreenshot" : false,
|
|
"createdBy" : "user@user.com",
|
|
"testId" : "281474976710706",
|
|
"subinterval" : 60,
|
|
"desiredStatusCode" : "200",
|
|
"httpTargetTime" : 100,
|
|
"sslVersionId" : "0",
|
|
"username" : "username",
|
|
"targetTime" : 1
|
|
}"""
|
|
|
|
response_loaded_json = json.loads(response_body_json)
|
|
response_from_json = thousandeyes_sdk.tests.models.WebTransactionTest.from_json(response_body_json)
|
|
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
|
|
|
def test_delete_web_transactions_test_models_validation(self) -> None:
|
|
"""Test case for delete_web_transactions_test request and response models"""
|
|
|
|
|
|
def test_get_web_transactions_test_models_validation(self) -> None:
|
|
"""Test case for get_web_transactions_test request and response models"""
|
|
|
|
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" : {
|
|
"configId" : "123321123",
|
|
"testUrl" : "https://api.thousandeyes.com/v7/status",
|
|
"requestMethod" : "get",
|
|
"postBody" : "client_id: ************",
|
|
"headers" : "Authorization: Basic ************",
|
|
"authType" : "none",
|
|
"username" : "user123",
|
|
"password" : "*******"
|
|
},
|
|
"password" : "password",
|
|
"protocol" : "tcp",
|
|
"followRedirects" : true,
|
|
"contentRegex" : "(regex)+",
|
|
"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
|
|
} ],
|
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
|
"interval" : 120,
|
|
"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,
|
|
"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; }",
|
|
"savedEvent" : true,
|
|
"userAgent" : "curl",
|
|
"networkMeasurements" : true,
|
|
"url" : "www.thousandeyes.com",
|
|
"agents" : [ {
|
|
"agentId" : "281474976710706",
|
|
"agentType" : "enterprise-cluster",
|
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
|
"prefix" : "99.128.0.0/11",
|
|
"agentName" : "thousandeyes-stg-va-254",
|
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
|
"location" : "San Francisco Bay Area",
|
|
"countryId" : "US",
|
|
"enabled" : true,
|
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
|
"verifySslCertificates" : true
|
|
}, {
|
|
"agentId" : "281474976710706",
|
|
"agentType" : "enterprise-cluster",
|
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
|
"prefix" : "99.128.0.0/11",
|
|
"agentName" : "thousandeyes-stg-va-254",
|
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
|
"location" : "San Francisco Bay Area",
|
|
"countryId" : "US",
|
|
"enabled" : true,
|
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
|
"verifySslCertificates" : true
|
|
} ],
|
|
"timeLimit" : 30,
|
|
"createdDate" : "2022-07-17T22:00:54Z",
|
|
"disableScreenshot" : false,
|
|
"createdBy" : "user@user.com",
|
|
"testId" : "281474976710706",
|
|
"subinterval" : 60,
|
|
"desiredStatusCode" : "200",
|
|
"httpTargetTime" : 100,
|
|
"sslVersionId" : "0",
|
|
"username" : "username",
|
|
"targetTime" : 1
|
|
}"""
|
|
|
|
response_loaded_json = json.loads(response_body_json)
|
|
response_from_json = thousandeyes_sdk.tests.models.WebTransactionTest.from_json(response_body_json)
|
|
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
|
|
|
def test_get_web_transactions_tests_models_validation(self) -> None:
|
|
"""Test case for get_web_transactions_tests request and response models"""
|
|
|
|
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" : {
|
|
"configId" : "123321123",
|
|
"testUrl" : "https://api.thousandeyes.com/v7/status",
|
|
"requestMethod" : "get",
|
|
"postBody" : "client_id: ************",
|
|
"headers" : "Authorization: Basic ************",
|
|
"authType" : "none",
|
|
"username" : "user123",
|
|
"password" : "*******"
|
|
},
|
|
"password" : "password",
|
|
"protocol" : "tcp",
|
|
"followRedirects" : true,
|
|
"contentRegex" : "(regex)+",
|
|
"pageLoadingStrategy" : "normal",
|
|
"testName" : "ThousandEyes Test",
|
|
"allowMicAndCamera" : false,
|
|
"browserLanguage" : "en-US",
|
|
"verifyCertificate" : false,
|
|
"overrideAgentProxy" : false,
|
|
"liveShare" : false,
|
|
"agentInterfaces" : {
|
|
"agentId" : "2954",
|
|
"ipAddress" : "192.1.1.0"
|
|
},
|
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
|
"interval" : 120,
|
|
"emulatedDeviceId" : "2",
|
|
"overrideProxyId" : "281474976710706",
|
|
"sslVersion" : "Auto",
|
|
"useNtlm" : false,
|
|
"downloadLimit" : 2048,
|
|
"description" : "ThousandEyes Test",
|
|
"httpTimeLimit" : 5,
|
|
"blockDomains" : "domain.com/",
|
|
"usePublicBgp" : true,
|
|
"enabled" : true,
|
|
"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; }",
|
|
"savedEvent" : true,
|
|
"userAgent" : "curl",
|
|
"networkMeasurements" : true,
|
|
"url" : "www.thousandeyes.com",
|
|
"timeLimit" : 30,
|
|
"createdDate" : "2022-07-17T22:00:54Z",
|
|
"disableScreenshot" : false,
|
|
"createdBy" : "user@user.com",
|
|
"testId" : "281474976710706",
|
|
"subinterval" : 60,
|
|
"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" : {
|
|
"configId" : "123321123",
|
|
"testUrl" : "https://api.thousandeyes.com/v7/status",
|
|
"requestMethod" : "get",
|
|
"postBody" : "client_id: ************",
|
|
"headers" : "Authorization: Basic ************",
|
|
"authType" : "none",
|
|
"username" : "user123",
|
|
"password" : "*******"
|
|
},
|
|
"password" : "password",
|
|
"protocol" : "tcp",
|
|
"followRedirects" : true,
|
|
"contentRegex" : "(regex)+",
|
|
"pageLoadingStrategy" : "normal",
|
|
"testName" : "ThousandEyes Test",
|
|
"allowMicAndCamera" : false,
|
|
"browserLanguage" : "en-US",
|
|
"verifyCertificate" : false,
|
|
"overrideAgentProxy" : false,
|
|
"liveShare" : false,
|
|
"agentInterfaces" : {
|
|
"agentId" : "2954",
|
|
"ipAddress" : "192.1.1.0"
|
|
},
|
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
|
"interval" : 120,
|
|
"emulatedDeviceId" : "2",
|
|
"overrideProxyId" : "281474976710706",
|
|
"sslVersion" : "Auto",
|
|
"useNtlm" : false,
|
|
"downloadLimit" : 2048,
|
|
"description" : "ThousandEyes Test",
|
|
"httpTimeLimit" : 5,
|
|
"blockDomains" : "domain.com/",
|
|
"usePublicBgp" : true,
|
|
"enabled" : true,
|
|
"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; }",
|
|
"savedEvent" : true,
|
|
"userAgent" : "curl",
|
|
"networkMeasurements" : true,
|
|
"url" : "www.thousandeyes.com",
|
|
"timeLimit" : 30,
|
|
"createdDate" : "2022-07-17T22:00:54Z",
|
|
"disableScreenshot" : false,
|
|
"createdBy" : "user@user.com",
|
|
"testId" : "281474976710706",
|
|
"subinterval" : 60,
|
|
"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"
|
|
}
|
|
}
|
|
}"""
|
|
|
|
response_loaded_json = json.loads(response_body_json)
|
|
response_from_json = thousandeyes_sdk.tests.models.WebTransactionTests.from_json(response_body_json)
|
|
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
|
|
|
def test_update_web_transactions_test_models_validation(self) -> None:
|
|
"""Test case for update_web_transactions_test request and response models"""
|
|
request_body_json = """
|
|
{
|
|
"clientCertificate" : "-----BEGIN PRIVATE KEY-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END PRIVATE KEY-----\\n-----BEGIN CERTIFICATE-----\\nMIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL\\n-----END CERTIFICATE-----\\n",
|
|
"mtuMeasurements" : false,
|
|
"_links" : {
|
|
"testResults" : [ {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
|
}, {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
|
} ],
|
|
"self" : {
|
|
"hreflang" : "hreflang",
|
|
"templated" : true,
|
|
"profile" : "profile",
|
|
"name" : "name",
|
|
"href" : "https://api.thousandeyes.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" : {
|
|
"configId" : "123321123",
|
|
"testUrl" : "https://api.thousandeyes.com/v7/status",
|
|
"requestMethod" : "get",
|
|
"postBody" : "client_id: ************",
|
|
"headers" : "Authorization: Basic ************",
|
|
"authType" : "none",
|
|
"username" : "user123",
|
|
"password" : "*******"
|
|
},
|
|
"password" : "password",
|
|
"protocol" : "tcp",
|
|
"followRedirects" : true,
|
|
"contentRegex" : "(regex)+",
|
|
"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" ],
|
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
|
"interval" : 120,
|
|
"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,
|
|
"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; }",
|
|
"savedEvent" : true,
|
|
"userAgent" : "curl",
|
|
"networkMeasurements" : true,
|
|
"url" : "www.thousandeyes.com",
|
|
"agents" : [ {
|
|
"agentId" : "125",
|
|
"sourceIpAddress" : "1.1.1.1"
|
|
}, {
|
|
"agentId" : "125",
|
|
"sourceIpAddress" : "1.1.1.1"
|
|
} ],
|
|
"timeLimit" : 30,
|
|
"createdDate" : "2022-07-17T22:00:54Z",
|
|
"disableScreenshot" : false,
|
|
"createdBy" : "user@user.com",
|
|
"testId" : "281474976710706",
|
|
"subinterval" : 60,
|
|
"desiredStatusCode" : "200",
|
|
"httpTargetTime" : 100,
|
|
"sslVersionId" : "0",
|
|
"username" : "username",
|
|
"targetTime" : 1
|
|
}"""
|
|
|
|
request_loaded_json = json.loads(request_body_json)
|
|
request_from_json = thousandeyes_sdk.tests.models.UpdateWebTransactionTest.from_json(request_body_json)
|
|
assert_constructed_model_matches_example_json(request_from_json, request_loaded_json)
|
|
|
|
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" : {
|
|
"configId" : "123321123",
|
|
"testUrl" : "https://api.thousandeyes.com/v7/status",
|
|
"requestMethod" : "get",
|
|
"postBody" : "client_id: ************",
|
|
"headers" : "Authorization: Basic ************",
|
|
"authType" : "none",
|
|
"username" : "user123",
|
|
"password" : "*******"
|
|
},
|
|
"password" : "password",
|
|
"protocol" : "tcp",
|
|
"followRedirects" : true,
|
|
"contentRegex" : "(regex)+",
|
|
"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
|
|
} ],
|
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
|
"interval" : 120,
|
|
"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,
|
|
"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; }",
|
|
"savedEvent" : true,
|
|
"userAgent" : "curl",
|
|
"networkMeasurements" : true,
|
|
"url" : "www.thousandeyes.com",
|
|
"agents" : [ {
|
|
"agentId" : "281474976710706",
|
|
"agentType" : "enterprise-cluster",
|
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
|
"prefix" : "99.128.0.0/11",
|
|
"agentName" : "thousandeyes-stg-va-254",
|
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
|
"location" : "San Francisco Bay Area",
|
|
"countryId" : "US",
|
|
"enabled" : true,
|
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
|
"verifySslCertificates" : true
|
|
}, {
|
|
"agentId" : "281474976710706",
|
|
"agentType" : "enterprise-cluster",
|
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
|
"prefix" : "99.128.0.0/11",
|
|
"agentName" : "thousandeyes-stg-va-254",
|
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
|
"location" : "San Francisco Bay Area",
|
|
"countryId" : "US",
|
|
"enabled" : true,
|
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
|
"verifySslCertificates" : true
|
|
} ],
|
|
"timeLimit" : 30,
|
|
"createdDate" : "2022-07-17T22:00:54Z",
|
|
"disableScreenshot" : false,
|
|
"createdBy" : "user@user.com",
|
|
"testId" : "281474976710706",
|
|
"subinterval" : 60,
|
|
"desiredStatusCode" : "200",
|
|
"httpTargetTime" : 100,
|
|
"sslVersionId" : "0",
|
|
"username" : "username",
|
|
"targetTime" : 1
|
|
}"""
|
|
|
|
response_loaded_json = json.loads(response_body_json)
|
|
response_from_json = thousandeyes_sdk.tests.models.WebTransactionTest.from_json(response_body_json)
|
|
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|