mirror of
https://github.com/thousandeyes/thousandeyes-sdk-python.git
synced 2025-12-06 16:05:30 +00:00
310 lines
14 KiB
Python
310 lines
14 KiB
Python
# coding: utf-8
|
|
|
|
"""
|
|
Agents API
|
|
|
|
## Overview Manage all agents available to your account in ThousandEyes, including both Cloud and Enterprise Agents.
|
|
|
|
The version of the OpenAPI document: 7.0.8
|
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
|
|
Do not edit the class manually.
|
|
""" # noqa: E501
|
|
|
|
|
|
import json
|
|
import unittest
|
|
import thousandeyes_sdk.agents.models
|
|
|
|
from .test_utils import assert_constructed_model_matches_example_json
|
|
from thousandeyes_sdk.agents.api.cloud_and_enterprise_agents_api import CloudAndEnterpriseAgentsApi
|
|
|
|
|
|
class TestCloudAndEnterpriseAgentsApi(unittest.TestCase):
|
|
"""CloudAndEnterpriseAgentsApi unit test stubs"""
|
|
|
|
def setUp(self) -> None:
|
|
self.api = CloudAndEnterpriseAgentsApi()
|
|
|
|
def tearDown(self) -> None:
|
|
pass
|
|
|
|
def test_delete_agent_models_validation(self) -> None:
|
|
"""Test case for delete_agent request and response models"""
|
|
|
|
|
|
def test_get_agent_models_validation(self) -> None:
|
|
"""Test case for get_agent request and response models"""
|
|
|
|
response_body_json = """
|
|
{
|
|
"agentId" : "281474976710706",
|
|
"agentType" : "cloud",
|
|
"_links" : {
|
|
"self" : {
|
|
"hreflang" : "hreflang",
|
|
"templated" : true,
|
|
"profile" : "profile",
|
|
"name" : "name",
|
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
|
"type" : "type",
|
|
"deprecation" : "deprecation",
|
|
"title" : "title"
|
|
}
|
|
},
|
|
"prefix" : "99.128.0.0/11",
|
|
"agentName" : "thousandeyes-stg-va-254",
|
|
"countryId" : "US",
|
|
"enabled" : true,
|
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
|
"labels" : [ {
|
|
"labelId" : "11",
|
|
"name" : "Label name"
|
|
}, {
|
|
"labelId" : "11",
|
|
"name" : "Label name"
|
|
} ],
|
|
"tests" : [ {
|
|
"_links" : {
|
|
"testResults" : [ {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
|
}, {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
|
} ],
|
|
"self" : {
|
|
"hreflang" : "hreflang",
|
|
"templated" : true,
|
|
"profile" : "profile",
|
|
"name" : "name",
|
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
|
"type" : "type",
|
|
"deprecation" : "deprecation",
|
|
"title" : "title"
|
|
}
|
|
},
|
|
"liveShare" : false,
|
|
"savedEvent" : true,
|
|
"description" : "ThousandEyes Test",
|
|
"type" : "agent-to-server",
|
|
"enabled" : true,
|
|
"createdDate" : "2022-07-17T22:00:54Z",
|
|
"createdBy" : "user@user.com",
|
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
|
"interval" : 120,
|
|
"modifiedBy" : "user@user.com",
|
|
"testId" : "281474976710706",
|
|
"alertsEnabled" : true,
|
|
"testName" : "ThousandEyes Test"
|
|
}, {
|
|
"_links" : {
|
|
"testResults" : [ {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
|
}, {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
|
} ],
|
|
"self" : {
|
|
"hreflang" : "hreflang",
|
|
"templated" : true,
|
|
"profile" : "profile",
|
|
"name" : "name",
|
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
|
"type" : "type",
|
|
"deprecation" : "deprecation",
|
|
"title" : "title"
|
|
}
|
|
},
|
|
"liveShare" : false,
|
|
"savedEvent" : true,
|
|
"description" : "ThousandEyes Test",
|
|
"type" : "agent-to-server",
|
|
"enabled" : true,
|
|
"createdDate" : "2022-07-17T22:00:54Z",
|
|
"createdBy" : "user@user.com",
|
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
|
"interval" : 120,
|
|
"modifiedBy" : "user@user.com",
|
|
"testId" : "281474976710706",
|
|
"alertsEnabled" : true,
|
|
"testName" : "ThousandEyes Test"
|
|
} ],
|
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
|
"location" : "San Francisco Bay Area",
|
|
"verifySslCertificates" : true
|
|
}"""
|
|
|
|
response_loaded_json = json.loads(response_body_json)
|
|
response_from_json = thousandeyes_sdk.agents.models.AgentDetails.from_json(response_body_json)
|
|
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
|
|
|
def test_get_agents_models_validation(self) -> None:
|
|
"""Test case for get_agents request and response models"""
|
|
|
|
response_body_json = """
|
|
{
|
|
"_links" : {
|
|
"self" : {
|
|
"hreflang" : "hreflang",
|
|
"templated" : true,
|
|
"profile" : "profile",
|
|
"name" : "name",
|
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
|
"type" : "type",
|
|
"deprecation" : "deprecation",
|
|
"title" : "title"
|
|
}
|
|
},
|
|
"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
|
|
} ]
|
|
}"""
|
|
|
|
response_loaded_json = json.loads(response_body_json)
|
|
response_from_json = thousandeyes_sdk.agents.models.CloudEnterpriseAgents.from_json(response_body_json)
|
|
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
|
|
|
def test_update_agent_models_validation(self) -> None:
|
|
"""Test case for update_agent request and response models"""
|
|
request_body_json = """
|
|
{
|
|
"localResolutionPrefixes" : [ "10.2.3.3/24", "10.2.3.3/25" ],
|
|
"tests" : [ "12313145", "12345" ],
|
|
"ipv6Policy" : "force-ipv4",
|
|
"keepBrowserCache" : true,
|
|
"targetForTests" : "1.1.1.1",
|
|
"agentName" : "thousandeyes-stg-va-254",
|
|
"enabled" : true,
|
|
"accountGroups" : [ "1234", "1" ]
|
|
}"""
|
|
|
|
request_loaded_json = json.loads(request_body_json)
|
|
request_from_json = thousandeyes_sdk.agents.models.AgentRequest.from_json(request_body_json)
|
|
assert_constructed_model_matches_example_json(request_from_json, request_loaded_json)
|
|
|
|
response_body_json = """
|
|
{
|
|
"agentId" : "281474976710706",
|
|
"agentType" : "cloud",
|
|
"_links" : {
|
|
"self" : {
|
|
"hreflang" : "hreflang",
|
|
"templated" : true,
|
|
"profile" : "profile",
|
|
"name" : "name",
|
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
|
"type" : "type",
|
|
"deprecation" : "deprecation",
|
|
"title" : "title"
|
|
}
|
|
},
|
|
"prefix" : "99.128.0.0/11",
|
|
"agentName" : "thousandeyes-stg-va-254",
|
|
"countryId" : "US",
|
|
"enabled" : true,
|
|
"network" : "AT&T Services, Inc. (AS 7018)",
|
|
"labels" : [ {
|
|
"labelId" : "11",
|
|
"name" : "Label name"
|
|
}, {
|
|
"labelId" : "11",
|
|
"name" : "Label name"
|
|
} ],
|
|
"tests" : [ {
|
|
"_links" : {
|
|
"testResults" : [ {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
|
}, {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
|
} ],
|
|
"self" : {
|
|
"hreflang" : "hreflang",
|
|
"templated" : true,
|
|
"profile" : "profile",
|
|
"name" : "name",
|
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
|
"type" : "type",
|
|
"deprecation" : "deprecation",
|
|
"title" : "title"
|
|
}
|
|
},
|
|
"liveShare" : false,
|
|
"savedEvent" : true,
|
|
"description" : "ThousandEyes Test",
|
|
"type" : "agent-to-server",
|
|
"enabled" : true,
|
|
"createdDate" : "2022-07-17T22:00:54Z",
|
|
"createdBy" : "user@user.com",
|
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
|
"interval" : 120,
|
|
"modifiedBy" : "user@user.com",
|
|
"testId" : "281474976710706",
|
|
"alertsEnabled" : true,
|
|
"testName" : "ThousandEyes Test"
|
|
}, {
|
|
"_links" : {
|
|
"testResults" : [ {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
|
}, {
|
|
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
|
} ],
|
|
"self" : {
|
|
"hreflang" : "hreflang",
|
|
"templated" : true,
|
|
"profile" : "profile",
|
|
"name" : "name",
|
|
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
|
"type" : "type",
|
|
"deprecation" : "deprecation",
|
|
"title" : "title"
|
|
}
|
|
},
|
|
"liveShare" : false,
|
|
"savedEvent" : true,
|
|
"description" : "ThousandEyes Test",
|
|
"type" : "agent-to-server",
|
|
"enabled" : true,
|
|
"createdDate" : "2022-07-17T22:00:54Z",
|
|
"createdBy" : "user@user.com",
|
|
"modifiedDate" : "2022-07-17T22:00:54Z",
|
|
"interval" : 120,
|
|
"modifiedBy" : "user@user.com",
|
|
"testId" : "281474976710706",
|
|
"alertsEnabled" : true,
|
|
"testName" : "ThousandEyes Test"
|
|
} ],
|
|
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
|
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
|
"location" : "San Francisco Bay Area",
|
|
"verifySslCertificates" : true
|
|
}"""
|
|
|
|
response_loaded_json = json.loads(response_body_json)
|
|
response_from_json = thousandeyes_sdk.agents.models.AgentDetails.from_json(response_body_json)
|
|
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|