thousandeyes-sdk-python/thousandeyes-sdk-administrative/test/test_account_groups_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

1793 lines
88 KiB
Python

# coding: utf-8
"""
Administrative API
Manage users, accounts, and account groups in the ThousandEyes platform using the Administrative API. This API provides the following operations to manage your organization: * `/account-groups`: Account groups are used to divide an organization into different sections. These operations can be used to create, retrieve, update and delete account groups. * `/users`: Create, retrieve, update and delete users within an organization. * `/roles`: Create, retrieve and update roles for the current user. * `/permissions`: Retrieve all assignable permissions. Used in the context of modifying roles. * `/audit-user-events`: Retrieve all activity log events. For more information about the administrative models, see [Account Management](https://docs.thousandeyes.com/product-documentation/user-management).
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import json
import unittest
import thousandeyes_sdk.administrative.models
from thousandeyes_sdk.core.exceptions import ApiException
from thousandeyes_sdk.administrative.api.account_groups_api import AccountGroupsApi
from .integration_test_utils import IntegrationTestBase
from .test_utils import assert_constructed_model_matches_example_json
class TestAccountGroupsApiIntegration(IntegrationTestBase):
"""AccountGroupsApi integration test stubs"""
def setUp(self) -> None:
super().setUp()
self.api = AccountGroupsApi(self.api_client)
def test_create_account_group_happy_path(self) -> None:
"""Integration test for create_account_group success path"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
response_body_json = """
{
&quot;isCurrentAccountGroup&quot; : true,
&quot;organizationName&quot; : &quot;organizationName&quot;,
&quot;_links&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;accountGroupName&quot; : &quot;Account A&quot;,
&quot;isDefaultAccountGroup&quot; : true,
&quot;aid&quot; : &quot;1234&quot;,
&quot;orgId&quot; : &quot;12345&quot;,
&quot;users&quot; : [ {
&quot;uid&quot; : &quot;235&quot;,
&quot;lastLogin&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;roles&quot; : [ {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
}, {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
} ],
&quot;name&quot; : &quot;User X&quot;,
&quot;email&quot; : &quot;userx@thousandeyes.com&quot;,
&quot;dateRegistered&quot; : &quot;2022-07-17T22:00:54Z&quot;
}, {
&quot;uid&quot; : &quot;235&quot;,
&quot;lastLogin&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;roles&quot; : [ {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
}, {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
} ],
&quot;name&quot; : &quot;User X&quot;,
&quot;email&quot; : &quot;userx@thousandeyes.com&quot;,
&quot;dateRegistered&quot; : &quot;2022-07-17T22:00:54Z&quot;
} ]
}
"""
expected_response = json.loads(response_body_json)
response = self.api.create_account_group(
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("create_account_group"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_create_account_group_error_400(self) -> None:
"""Integration test for create_account_group error path (HTTP 400)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"errors" : [ {
"code" : "code",
"field" : "field",
"message" : "message"
}, {
"code" : "code",
"field" : "field",
"message" : "message"
} ],
"status" : 0
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(400)
) as context:
self.api.create_account_group(
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("create_account_group", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_account_group_error_401(self) -> None:
"""Integration test for create_account_group error path (HTTP 401)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"error_description" : "Invalid access token",
"error" : "invalid_token"
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(401)
) as context:
self.api.create_account_group(
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("create_account_group", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_account_group_error_403(self) -> None:
"""Integration test for create_account_group error path (HTTP 403)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(403)
) as context:
self.api.create_account_group(
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("create_account_group", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_account_group_error_404(self) -> None:
"""Integration test for create_account_group error path (HTTP 404)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(404)
) as context:
self.api.create_account_group(
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("create_account_group", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_account_group_error_429(self) -> None:
"""Integration test for create_account_group error path (HTTP 429)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(429)
) as context:
self.api.create_account_group(
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("create_account_group", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_account_group_error_500(self) -> None:
"""Integration test for create_account_group error path (HTTP 500)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(500)
) as context:
self.api.create_account_group(
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("create_account_group", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_account_group_happy_path(self) -> None:
"""Integration test for delete_account_group success path"""
id = '1234'
response = self.api.delete_account_group_with_http_info(
id=id,
_headers=self.te_headers("delete_account_group"),
)
self.assertEqual(204, response.status_code)
self.assertIsNone(response.data)
def test_delete_account_group_error_400(self) -> None:
"""Integration test for delete_account_group error path (HTTP 400)"""
id = '1234'
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"errors" : [ {
"code" : "code",
"field" : "field",
"message" : "message"
}, {
"code" : "code",
"field" : "field",
"message" : "message"
} ],
"status" : 0
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(400)
) as context:
self.api.delete_account_group(
id=id,
_headers=self.te_headers("delete_account_group", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_account_group_error_401(self) -> None:
"""Integration test for delete_account_group error path (HTTP 401)"""
id = '1234'
error_body_json = """
{
"error_description" : "Invalid access token",
"error" : "invalid_token"
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(401)
) as context:
self.api.delete_account_group(
id=id,
_headers=self.te_headers("delete_account_group", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_account_group_error_403(self) -> None:
"""Integration test for delete_account_group error path (HTTP 403)"""
id = '1234'
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(403)
) as context:
self.api.delete_account_group(
id=id,
_headers=self.te_headers("delete_account_group", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_account_group_error_404(self) -> None:
"""Integration test for delete_account_group error path (HTTP 404)"""
id = '1234'
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(404)
) as context:
self.api.delete_account_group(
id=id,
_headers=self.te_headers("delete_account_group", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_account_group_error_429(self) -> None:
"""Integration test for delete_account_group error path (HTTP 429)"""
id = '1234'
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(429)
) as context:
self.api.delete_account_group(
id=id,
_headers=self.te_headers("delete_account_group", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_account_group_error_500(self) -> None:
"""Integration test for delete_account_group error path (HTTP 500)"""
id = '1234'
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(500)
) as context:
self.api.delete_account_group(
id=id,
_headers=self.te_headers("delete_account_group", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_group_happy_path(self) -> None:
"""Integration test for get_account_group success path"""
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
response_body_json = """
{
&quot;isCurrentAccountGroup&quot; : true,
&quot;organizationName&quot; : &quot;organizationName&quot;,
&quot;_links&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;accountGroupName&quot; : &quot;Account A&quot;,
&quot;isDefaultAccountGroup&quot; : true,
&quot;accountToken&quot; : &quot;accountToken&quot;,
&quot;aid&quot; : &quot;1234&quot;,
&quot;orgId&quot; : &quot;12345&quot;,
&quot;users&quot; : [ {
&quot;uid&quot; : &quot;235&quot;,
&quot;lastLogin&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;roles&quot; : [ {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
}, {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
} ],
&quot;name&quot; : &quot;User X&quot;,
&quot;email&quot; : &quot;userx@thousandeyes.com&quot;,
&quot;dateRegistered&quot; : &quot;2022-07-17T22:00:54Z&quot;
}, {
&quot;uid&quot; : &quot;235&quot;,
&quot;lastLogin&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;roles&quot; : [ {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
}, {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
} ],
&quot;name&quot; : &quot;User X&quot;,
&quot;email&quot; : &quot;userx@thousandeyes.com&quot;,
&quot;dateRegistered&quot; : &quot;2022-07-17T22:00:54Z&quot;
} ],
&quot;agents&quot; : [ {
&quot;agentId&quot; : &quot;281474976710706&quot;,
&quot;agentType&quot; : &quot;enterprise-cluster&quot;,
&quot;ipv6Policy&quot; : &quot;force-ipv4&quot;,
&quot;prefix&quot; : &quot;99.128.0.0/11&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;hostname&quot; : &quot;thousandeyes.com&quot;,
&quot;keepBrowserCache&quot; : true,
&quot;agentState&quot; : &quot;online&quot;,
&quot;localResolutionPrefixes&quot; : [ &quot;10.2.3.3/24&quot;, &quot;10.2.3.3/24&quot; ],
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;coordinates&quot; : {
&quot;latitude&quot; : 37.77493,
&quot;longitude&quot; : -122.41942
},
&quot;agentName&quot; : &quot;thousandeyes-stg-va-254&quot;,
&quot;utilization&quot; : 25,
&quot;testIds&quot; : [ 281474976710706 ],
&quot;clusterMembers&quot; : [ {
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;agentState&quot; : &quot;online&quot;,
&quot;targetForTests&quot; : &quot;1.1.1.1&quot;,
&quot;name&quot; : &quot;Cluster member name&quot;,
&quot;ipAddresses&quot; : [ &quot;99.139.65.220&quot;, &quot;9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce&quot; ],
&quot;utilization&quot; : 25,
&quot;network&quot; : &quot;AT&amp;T Services, Inc. (AS 7018)&quot;,
&quot;memberId&quot; : &quot;10&quot;,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
}, {
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;agentState&quot; : &quot;online&quot;,
&quot;targetForTests&quot; : &quot;1.1.1.1&quot;,
&quot;name&quot; : &quot;Cluster member name&quot;,
&quot;ipAddresses&quot; : [ &quot;99.139.65.220&quot;, &quot;9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce&quot; ],
&quot;utilization&quot; : 25,
&quot;network&quot; : &quot;AT&amp;T Services, Inc. (AS 7018)&quot;,
&quot;memberId&quot; : &quot;10&quot;,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
} ],
&quot;tests&quot; : [ {
&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;liveShare&quot; : false,
&quot;savedEvent&quot; : true,
&quot;description&quot; : &quot;ThousandEyes Test&quot;,
&quot;type&quot; : &quot;agent-to-server&quot;,
&quot;enabled&quot; : true,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdBy&quot; : &quot;user@user.com&quot;,
&quot;modifiedDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;interval&quot; : 60,
&quot;modifiedBy&quot; : &quot;user@user.com&quot;,
&quot;testId&quot; : &quot;281474976710706&quot;,
&quot;alertsEnabled&quot; : true,
&quot;testName&quot; : &quot;ThousandEyes Test&quot;
}, {
&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;liveShare&quot; : false,
&quot;savedEvent&quot; : true,
&quot;description&quot; : &quot;ThousandEyes Test&quot;,
&quot;type&quot; : &quot;agent-to-server&quot;,
&quot;enabled&quot; : true,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdBy&quot; : &quot;user@user.com&quot;,
&quot;modifiedDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;interval&quot; : 60,
&quot;modifiedBy&quot; : &quot;user@user.com&quot;,
&quot;testId&quot; : &quot;281474976710706&quot;,
&quot;alertsEnabled&quot; : true,
&quot;testName&quot; : &quot;ThousandEyes Test&quot;
} ],
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;interfaceIpMapping&quot; : [ {
&quot;ipAddresses&quot; : [ &quot;73.252.207.219&quot;, &quot;2601:646:300:3ae0::b977&quot; ],
&quot;interfaceName&quot; : &quot;wlp4s0&quot;
}, {
&quot;ipAddresses&quot; : [ &quot;73.252.207.219&quot;, &quot;2601:646:300:3ae0::b977&quot; ],
&quot;interfaceName&quot; : &quot;wlp4s0&quot;
} ],
&quot;targetForTests&quot; : &quot;1.1.1.1&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;accountGroups&quot; : [ {
&quot;accountGroupName&quot; : &quot;Account A&quot;,
&quot;aid&quot; : &quot;1234&quot;
}, {
&quot;accountGroupName&quot; : &quot;Account A&quot;,
&quot;aid&quot; : &quot;1234&quot;
} ],
&quot;verifySslCertificates&quot; : true,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
}, {
&quot;agentId&quot; : &quot;281474976710706&quot;,
&quot;agentType&quot; : &quot;enterprise-cluster&quot;,
&quot;ipv6Policy&quot; : &quot;force-ipv4&quot;,
&quot;prefix&quot; : &quot;99.128.0.0/11&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;hostname&quot; : &quot;thousandeyes.com&quot;,
&quot;keepBrowserCache&quot; : true,
&quot;agentState&quot; : &quot;online&quot;,
&quot;localResolutionPrefixes&quot; : [ &quot;10.2.3.3/24&quot;, &quot;10.2.3.3/24&quot; ],
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;coordinates&quot; : {
&quot;latitude&quot; : 37.77493,
&quot;longitude&quot; : -122.41942
},
&quot;agentName&quot; : &quot;thousandeyes-stg-va-254&quot;,
&quot;utilization&quot; : 25,
&quot;testIds&quot; : [ 281474976710706 ],
&quot;clusterMembers&quot; : [ {
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;agentState&quot; : &quot;online&quot;,
&quot;targetForTests&quot; : &quot;1.1.1.1&quot;,
&quot;name&quot; : &quot;Cluster member name&quot;,
&quot;ipAddresses&quot; : [ &quot;99.139.65.220&quot;, &quot;9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce&quot; ],
&quot;utilization&quot; : 25,
&quot;network&quot; : &quot;AT&amp;T Services, Inc. (AS 7018)&quot;,
&quot;memberId&quot; : &quot;10&quot;,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
}, {
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;agentState&quot; : &quot;online&quot;,
&quot;targetForTests&quot; : &quot;1.1.1.1&quot;,
&quot;name&quot; : &quot;Cluster member name&quot;,
&quot;ipAddresses&quot; : [ &quot;99.139.65.220&quot;, &quot;9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce&quot; ],
&quot;utilization&quot; : 25,
&quot;network&quot; : &quot;AT&amp;T Services, Inc. (AS 7018)&quot;,
&quot;memberId&quot; : &quot;10&quot;,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
} ],
&quot;tests&quot; : [ {
&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;liveShare&quot; : false,
&quot;savedEvent&quot; : true,
&quot;description&quot; : &quot;ThousandEyes Test&quot;,
&quot;type&quot; : &quot;agent-to-server&quot;,
&quot;enabled&quot; : true,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdBy&quot; : &quot;user@user.com&quot;,
&quot;modifiedDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;interval&quot; : 60,
&quot;modifiedBy&quot; : &quot;user@user.com&quot;,
&quot;testId&quot; : &quot;281474976710706&quot;,
&quot;alertsEnabled&quot; : true,
&quot;testName&quot; : &quot;ThousandEyes Test&quot;
}, {
&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;liveShare&quot; : false,
&quot;savedEvent&quot; : true,
&quot;description&quot; : &quot;ThousandEyes Test&quot;,
&quot;type&quot; : &quot;agent-to-server&quot;,
&quot;enabled&quot; : true,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdBy&quot; : &quot;user@user.com&quot;,
&quot;modifiedDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;interval&quot; : 60,
&quot;modifiedBy&quot; : &quot;user@user.com&quot;,
&quot;testId&quot; : &quot;281474976710706&quot;,
&quot;alertsEnabled&quot; : true,
&quot;testName&quot; : &quot;ThousandEyes Test&quot;
} ],
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;interfaceIpMapping&quot; : [ {
&quot;ipAddresses&quot; : [ &quot;73.252.207.219&quot;, &quot;2601:646:300:3ae0::b977&quot; ],
&quot;interfaceName&quot; : &quot;wlp4s0&quot;
}, {
&quot;ipAddresses&quot; : [ &quot;73.252.207.219&quot;, &quot;2601:646:300:3ae0::b977&quot; ],
&quot;interfaceName&quot; : &quot;wlp4s0&quot;
} ],
&quot;targetForTests&quot; : &quot;1.1.1.1&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;accountGroups&quot; : [ {
&quot;accountGroupName&quot; : &quot;Account A&quot;,
&quot;aid&quot; : &quot;1234&quot;
}, {
&quot;accountGroupName&quot; : &quot;Account A&quot;,
&quot;aid&quot; : &quot;1234&quot;
} ],
&quot;verifySslCertificates&quot; : true,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
} ]
}
"""
expected_response = json.loads(response_body_json)
response = self.api.get_account_group(
id=id,
expand=expand,
_headers=self.te_headers("get_account_group"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_get_account_group_error_400(self) -> None:
"""Integration test for get_account_group error path (HTTP 400)"""
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"errors" : [ {
"code" : "code",
"field" : "field",
"message" : "message"
}, {
"code" : "code",
"field" : "field",
"message" : "message"
} ],
"status" : 0
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(400)
) as context:
self.api.get_account_group(
id=id,
expand=expand,
_headers=self.te_headers("get_account_group", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_group_error_401(self) -> None:
"""Integration test for get_account_group error path (HTTP 401)"""
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"error_description" : "Invalid access token",
"error" : "invalid_token"
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(401)
) as context:
self.api.get_account_group(
id=id,
expand=expand,
_headers=self.te_headers("get_account_group", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_group_error_403(self) -> None:
"""Integration test for get_account_group error path (HTTP 403)"""
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(403)
) as context:
self.api.get_account_group(
id=id,
expand=expand,
_headers=self.te_headers("get_account_group", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_group_error_404(self) -> None:
"""Integration test for get_account_group error path (HTTP 404)"""
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(404)
) as context:
self.api.get_account_group(
id=id,
expand=expand,
_headers=self.te_headers("get_account_group", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_group_error_429(self) -> None:
"""Integration test for get_account_group error path (HTTP 429)"""
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(429)
) as context:
self.api.get_account_group(
id=id,
expand=expand,
_headers=self.te_headers("get_account_group", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_group_error_500(self) -> None:
"""Integration test for get_account_group error path (HTTP 500)"""
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(500)
) as context:
self.api.get_account_group(
id=id,
expand=expand,
_headers=self.te_headers("get_account_group", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_groups_happy_path(self) -> None:
"""Integration test for get_account_groups success path"""
response_body_json = """
{
&quot;_links&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;accountGroups&quot; : [ {
&quot;isCurrentAccountGroup&quot; : true,
&quot;organizationName&quot; : &quot;organizationName&quot;,
&quot;accountGroupName&quot; : &quot;Account A&quot;,
&quot;isDefaultAccountGroup&quot; : true,
&quot;aid&quot; : &quot;1234&quot;,
&quot;orgId&quot; : &quot;12345&quot;
}, {
&quot;isCurrentAccountGroup&quot; : true,
&quot;organizationName&quot; : &quot;organizationName&quot;,
&quot;accountGroupName&quot; : &quot;Account A&quot;,
&quot;isDefaultAccountGroup&quot; : true,
&quot;aid&quot; : &quot;1234&quot;,
&quot;orgId&quot; : &quot;12345&quot;
} ]
}
"""
expected_response = json.loads(response_body_json)
response = self.api.get_account_groups(
_headers=self.te_headers("get_account_groups"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_get_account_groups_error_400(self) -> None:
"""Integration test for get_account_groups error path (HTTP 400)"""
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"errors" : [ {
"code" : "code",
"field" : "field",
"message" : "message"
}, {
"code" : "code",
"field" : "field",
"message" : "message"
} ],
"status" : 0
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(400)
) as context:
self.api.get_account_groups(
_headers=self.te_headers("get_account_groups", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_groups_error_401(self) -> None:
"""Integration test for get_account_groups error path (HTTP 401)"""
error_body_json = """
{
"error_description" : "Invalid access token",
"error" : "invalid_token"
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(401)
) as context:
self.api.get_account_groups(
_headers=self.te_headers("get_account_groups", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_groups_error_403(self) -> None:
"""Integration test for get_account_groups error path (HTTP 403)"""
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(403)
) as context:
self.api.get_account_groups(
_headers=self.te_headers("get_account_groups", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_groups_error_404(self) -> None:
"""Integration test for get_account_groups error path (HTTP 404)"""
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(404)
) as context:
self.api.get_account_groups(
_headers=self.te_headers("get_account_groups", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_groups_error_429(self) -> None:
"""Integration test for get_account_groups error path (HTTP 429)"""
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(429)
) as context:
self.api.get_account_groups(
_headers=self.te_headers("get_account_groups", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_account_groups_error_500(self) -> None:
"""Integration test for get_account_groups error path (HTTP 500)"""
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(500)
) as context:
self.api.get_account_groups(
_headers=self.te_headers("get_account_groups", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_account_group_happy_path(self) -> None:
"""Integration test for update_account_group success path"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
response_body_json = """
{
&quot;isCurrentAccountGroup&quot; : true,
&quot;organizationName&quot; : &quot;organizationName&quot;,
&quot;_links&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;accountGroupName&quot; : &quot;Account A&quot;,
&quot;isDefaultAccountGroup&quot; : true,
&quot;accountToken&quot; : &quot;accountToken&quot;,
&quot;aid&quot; : &quot;1234&quot;,
&quot;orgId&quot; : &quot;12345&quot;,
&quot;users&quot; : [ {
&quot;uid&quot; : &quot;235&quot;,
&quot;lastLogin&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;roles&quot; : [ {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
}, {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
} ],
&quot;name&quot; : &quot;User X&quot;,
&quot;email&quot; : &quot;userx@thousandeyes.com&quot;,
&quot;dateRegistered&quot; : &quot;2022-07-17T22:00:54Z&quot;
}, {
&quot;uid&quot; : &quot;235&quot;,
&quot;lastLogin&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;roles&quot; : [ {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
}, {
&quot;roleId&quot; : &quot;35&quot;,
&quot;name&quot; : &quot;Organization Admin&quot;,
&quot;isBuiltin&quot; : true,
&quot;hasManagementPermissions&quot; : true
} ],
&quot;name&quot; : &quot;User X&quot;,
&quot;email&quot; : &quot;userx@thousandeyes.com&quot;,
&quot;dateRegistered&quot; : &quot;2022-07-17T22:00:54Z&quot;
} ],
&quot;agents&quot; : [ {
&quot;agentId&quot; : &quot;281474976710706&quot;,
&quot;agentType&quot; : &quot;enterprise-cluster&quot;,
&quot;ipv6Policy&quot; : &quot;force-ipv4&quot;,
&quot;prefix&quot; : &quot;99.128.0.0/11&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;hostname&quot; : &quot;thousandeyes.com&quot;,
&quot;keepBrowserCache&quot; : true,
&quot;agentState&quot; : &quot;online&quot;,
&quot;localResolutionPrefixes&quot; : [ &quot;10.2.3.3/24&quot;, &quot;10.2.3.3/24&quot; ],
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;coordinates&quot; : {
&quot;latitude&quot; : 37.77493,
&quot;longitude&quot; : -122.41942
},
&quot;agentName&quot; : &quot;thousandeyes-stg-va-254&quot;,
&quot;utilization&quot; : 25,
&quot;testIds&quot; : [ 281474976710706 ],
&quot;clusterMembers&quot; : [ {
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;agentState&quot; : &quot;online&quot;,
&quot;targetForTests&quot; : &quot;1.1.1.1&quot;,
&quot;name&quot; : &quot;Cluster member name&quot;,
&quot;ipAddresses&quot; : [ &quot;99.139.65.220&quot;, &quot;9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce&quot; ],
&quot;utilization&quot; : 25,
&quot;network&quot; : &quot;AT&amp;T Services, Inc. (AS 7018)&quot;,
&quot;memberId&quot; : &quot;10&quot;,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
}, {
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;agentState&quot; : &quot;online&quot;,
&quot;targetForTests&quot; : &quot;1.1.1.1&quot;,
&quot;name&quot; : &quot;Cluster member name&quot;,
&quot;ipAddresses&quot; : [ &quot;99.139.65.220&quot;, &quot;9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce&quot; ],
&quot;utilization&quot; : 25,
&quot;network&quot; : &quot;AT&amp;T Services, Inc. (AS 7018)&quot;,
&quot;memberId&quot; : &quot;10&quot;,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
} ],
&quot;tests&quot; : [ {
&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;liveShare&quot; : false,
&quot;savedEvent&quot; : true,
&quot;description&quot; : &quot;ThousandEyes Test&quot;,
&quot;type&quot; : &quot;agent-to-server&quot;,
&quot;enabled&quot; : true,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdBy&quot; : &quot;user@user.com&quot;,
&quot;modifiedDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;interval&quot; : 60,
&quot;modifiedBy&quot; : &quot;user@user.com&quot;,
&quot;testId&quot; : &quot;281474976710706&quot;,
&quot;alertsEnabled&quot; : true,
&quot;testName&quot; : &quot;ThousandEyes Test&quot;
}, {
&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;liveShare&quot; : false,
&quot;savedEvent&quot; : true,
&quot;description&quot; : &quot;ThousandEyes Test&quot;,
&quot;type&quot; : &quot;agent-to-server&quot;,
&quot;enabled&quot; : true,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdBy&quot; : &quot;user@user.com&quot;,
&quot;modifiedDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;interval&quot; : 60,
&quot;modifiedBy&quot; : &quot;user@user.com&quot;,
&quot;testId&quot; : &quot;281474976710706&quot;,
&quot;alertsEnabled&quot; : true,
&quot;testName&quot; : &quot;ThousandEyes Test&quot;
} ],
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;interfaceIpMapping&quot; : [ {
&quot;ipAddresses&quot; : [ &quot;73.252.207.219&quot;, &quot;2601:646:300:3ae0::b977&quot; ],
&quot;interfaceName&quot; : &quot;wlp4s0&quot;
}, {
&quot;ipAddresses&quot; : [ &quot;73.252.207.219&quot;, &quot;2601:646:300:3ae0::b977&quot; ],
&quot;interfaceName&quot; : &quot;wlp4s0&quot;
} ],
&quot;targetForTests&quot; : &quot;1.1.1.1&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;accountGroups&quot; : [ {
&quot;accountGroupName&quot; : &quot;Account A&quot;,
&quot;aid&quot; : &quot;1234&quot;
}, {
&quot;accountGroupName&quot; : &quot;Account A&quot;,
&quot;aid&quot; : &quot;1234&quot;
} ],
&quot;verifySslCertificates&quot; : true,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
}, {
&quot;agentId&quot; : &quot;281474976710706&quot;,
&quot;agentType&quot; : &quot;enterprise-cluster&quot;,
&quot;ipv6Policy&quot; : &quot;force-ipv4&quot;,
&quot;prefix&quot; : &quot;99.128.0.0/11&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;hostname&quot; : &quot;thousandeyes.com&quot;,
&quot;keepBrowserCache&quot; : true,
&quot;agentState&quot; : &quot;online&quot;,
&quot;localResolutionPrefixes&quot; : [ &quot;10.2.3.3/24&quot;, &quot;10.2.3.3/24&quot; ],
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;coordinates&quot; : {
&quot;latitude&quot; : 37.77493,
&quot;longitude&quot; : -122.41942
},
&quot;agentName&quot; : &quot;thousandeyes-stg-va-254&quot;,
&quot;utilization&quot; : 25,
&quot;testIds&quot; : [ 281474976710706 ],
&quot;clusterMembers&quot; : [ {
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;agentState&quot; : &quot;online&quot;,
&quot;targetForTests&quot; : &quot;1.1.1.1&quot;,
&quot;name&quot; : &quot;Cluster member name&quot;,
&quot;ipAddresses&quot; : [ &quot;99.139.65.220&quot;, &quot;9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce&quot; ],
&quot;utilization&quot; : 25,
&quot;network&quot; : &quot;AT&amp;T Services, Inc. (AS 7018)&quot;,
&quot;memberId&quot; : &quot;10&quot;,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
}, {
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;serialNumber&quot; : &quot;FOC2218ABCD&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;agentState&quot; : &quot;online&quot;,
&quot;targetForTests&quot; : &quot;1.1.1.1&quot;,
&quot;name&quot; : &quot;Cluster member name&quot;,
&quot;ipAddresses&quot; : [ &quot;99.139.65.220&quot;, &quot;9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce&quot; ],
&quot;utilization&quot; : 25,
&quot;network&quot; : &quot;AT&amp;T Services, Inc. (AS 7018)&quot;,
&quot;memberId&quot; : &quot;10&quot;,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
} ],
&quot;tests&quot; : [ {
&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;liveShare&quot; : false,
&quot;savedEvent&quot; : true,
&quot;description&quot; : &quot;ThousandEyes Test&quot;,
&quot;type&quot; : &quot;agent-to-server&quot;,
&quot;enabled&quot; : true,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdBy&quot; : &quot;user@user.com&quot;,
&quot;modifiedDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;interval&quot; : 60,
&quot;modifiedBy&quot; : &quot;user@user.com&quot;,
&quot;testId&quot; : &quot;281474976710706&quot;,
&quot;alertsEnabled&quot; : true,
&quot;testName&quot; : &quot;ThousandEyes Test&quot;
}, {
&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;liveShare&quot; : false,
&quot;savedEvent&quot; : true,
&quot;description&quot; : &quot;ThousandEyes Test&quot;,
&quot;type&quot; : &quot;agent-to-server&quot;,
&quot;enabled&quot; : true,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdBy&quot; : &quot;user@user.com&quot;,
&quot;modifiedDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;interval&quot; : 60,
&quot;modifiedBy&quot; : &quot;user@user.com&quot;,
&quot;testId&quot; : &quot;281474976710706&quot;,
&quot;alertsEnabled&quot; : true,
&quot;testName&quot; : &quot;ThousandEyes Test&quot;
} ],
&quot;lastSeen&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;createdDate&quot; : &quot;2022-07-17T22:00:54Z&quot;,
&quot;publicIpAddresses&quot; : [ &quot;192.168.1.78&quot;, &quot;f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c&quot; ],
&quot;interfaceIpMapping&quot; : [ {
&quot;ipAddresses&quot; : [ &quot;73.252.207.219&quot;, &quot;2601:646:300:3ae0::b977&quot; ],
&quot;interfaceName&quot; : &quot;wlp4s0&quot;
}, {
&quot;ipAddresses&quot; : [ &quot;73.252.207.219&quot;, &quot;2601:646:300:3ae0::b977&quot; ],
&quot;interfaceName&quot; : &quot;wlp4s0&quot;
} ],
&quot;targetForTests&quot; : &quot;1.1.1.1&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;accountGroups&quot; : [ {
&quot;accountGroupName&quot; : &quot;Account A&quot;,
&quot;aid&quot; : &quot;1234&quot;
}, {
&quot;accountGroupName&quot; : &quot;Account A&quot;,
&quot;aid&quot; : &quot;1234&quot;
} ],
&quot;verifySslCertificates&quot; : true,
&quot;errorDetails&quot; : [ {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
}, {
&quot;code&quot; : &quot;agent-version-outdated&quot;,
&quot;description&quot; : &quot;Agent Version 0.1.1 (latest: 1.0.0)&quot;
} ]
} ]
}
"""
expected_response = json.loads(response_body_json)
response = self.api.update_account_group(
id=id,
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("update_account_group"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_update_account_group_error_400(self) -> None:
"""Integration test for update_account_group error path (HTTP 400)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"errors" : [ {
"code" : "code",
"field" : "field",
"message" : "message"
}, {
"code" : "code",
"field" : "field",
"message" : "message"
} ],
"status" : 0
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(400)
) as context:
self.api.update_account_group(
id=id,
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("update_account_group", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_account_group_error_401(self) -> None:
"""Integration test for update_account_group error path (HTTP 401)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"error_description" : "Invalid access token",
"error" : "invalid_token"
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(401)
) as context:
self.api.update_account_group(
id=id,
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("update_account_group", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_account_group_error_403(self) -> None:
"""Integration test for update_account_group error path (HTTP 403)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(403)
) as context:
self.api.update_account_group(
id=id,
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("update_account_group", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_account_group_error_404(self) -> None:
"""Integration test for update_account_group error path (HTTP 404)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(404)
) as context:
self.api.update_account_group(
id=id,
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("update_account_group", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_account_group_error_429(self) -> None:
"""Integration test for update_account_group error path (HTTP 429)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(429)
) as context:
self.api.update_account_group(
id=id,
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("update_account_group", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_account_group_error_500(self) -> None:
"""Integration test for update_account_group error path (HTTP 500)"""
request_body_json = """
{
"accountGroupName" : "My testing account group",
"agents" : [ "105", "719" ]
}
"""
account_group_request = thousandeyes_sdk.administrative.models.AccountGroupRequest.from_json(request_body_json)
id = '1234'
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()]
error_body_json = """
{
"instance" : "instance",
"detail" : "detail",
"type" : "type",
"title" : "title",
"status" : 6
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(500)
) as context:
self.api.update_account_group(
id=id,
account_group_request=account_group_request,
expand=expand,
_headers=self.te_headers("update_account_group", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
if __name__ == '__main__':
unittest.main()