thousandeyes-sdk-python/thousandeyes-sdk-endpoint-agents/test/test_endpoint_agents_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

2768 lines
135 KiB
Python

# coding: utf-8
"""
Endpoint Agents API
**Note:** The Endpoint Agents Transfer APIs are not available for ThousandEyes for Government instance. Manage ThousandEyes Endpoint Agents using this API. For more information about Endpoint Agents, see [Endpoint Agents](https://docs.thousandeyes.com/product-documentation/global-vantage-points/endpoint-agents).
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import json
import unittest
import thousandeyes_sdk.endpoint_agents.models
from thousandeyes_sdk.core.exceptions import ApiException
from thousandeyes_sdk.endpoint_agents.api.endpoint_agents_api import EndpointAgentsApi
from .integration_test_utils import IntegrationTestBase
from .test_utils import assert_constructed_model_matches_example_json
class TestEndpointAgentsApiIntegration(IntegrationTestBase):
"""EndpointAgentsApi integration test stubs"""
def setUp(self) -> None:
super().setUp()
self.api = EndpointAgentsApi(self.api_client)
def test_delete_endpoint_agent_happy_path(self) -> None:
"""Integration test for delete_endpoint_agent success path"""
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
response = self.api.delete_endpoint_agent_with_http_info(
agent_id=agent_id,
aid=aid,
expand=expand,
_headers=self.te_headers("delete_endpoint_agent"),
)
self.assertEqual(204, response.status_code)
self.assertIsNone(response.data)
def test_delete_endpoint_agent_error_401(self) -> None:
"""Integration test for delete_endpoint_agent error path (HTTP 401)"""
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
_headers=self.te_headers("delete_endpoint_agent", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_endpoint_agent_error_403(self) -> None:
"""Integration test for delete_endpoint_agent error path (HTTP 403)"""
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
_headers=self.te_headers("delete_endpoint_agent", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_endpoint_agent_error_404(self) -> None:
"""Integration test for delete_endpoint_agent error path (HTTP 404)"""
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
_headers=self.te_headers("delete_endpoint_agent", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_endpoint_agent_error_429(self) -> None:
"""Integration test for delete_endpoint_agent error path (HTTP 429)"""
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
_headers=self.te_headers("delete_endpoint_agent", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_disable_endpoint_agent_happy_path(self) -> None:
"""Integration test for disable_endpoint_agent success path"""
agent_id = 'agent_id_example'
aid = '1234'
response_body_json = """
{
&quot;npcapVersion&quot; : &quot;npcapVersion&quot;,
&quot;asnDetails&quot; : {
&quot;asName&quot; : &quot;Virgin Media Limited&quot;,
&quot;asNumber&quot; : 5089
},
&quot;clients&quot; : [ {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
}, {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
} ],
&quot;agentType&quot; : &quot;endpoint&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;batteryMetrics&quot; : {
&quot;batteryHealthNormalizedPercent&quot; : 0.92,
&quot;batteryLevel&quot; : &quot;medium&quot;,
&quot;batteryLevelNormalizedPercent&quot; : 0.3
},
&quot;publicIP&quot; : &quot;88.45.2.123&quot;,
&quot;tcpDriverAvailable&quot; : true,
&quot;platform&quot; : &quot;mac&quot;,
&quot;manufacturer&quot; : &quot;Apple, Inc.&quot;,
&quot;targetVersion&quot; : &quot;0.123.4&quot;,
&quot;cellularProfile&quot; : {
&quot;rssi&quot; : -10,
&quot;advertisedNetworkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;carrierName&quot; : &quot;T-Mobile&quot;,
&quot;rsrq&quot; : -30,
&quot;rsrp&quot; : -30,
&quot;advertisedNetworkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;rscp&quot; : -30,
&quot;networkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;networkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;sinr&quot; : 20
},
&quot;nicModel&quot; : &quot;Intel(R) Wi-Fi 6 AX200 160MHz&quot;,
&quot;createdAt&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;numberOfClients&quot; : 3,
&quot;licenseType&quot; : &quot;essentials&quot;,
&quot;osVersion&quot; : &quot;Version 10.15.2 (Build 19C57)&quot;,
&quot;computerName&quot; : &quot;DESKJET-123&quot;,
&quot;freeDiskSpaceNormalized&quot; : 0.41,
&quot;model&quot; : &quot;MacBookAir7,2&quot;,
&quot;id&quot; : &quot;861b7557-cd57-4bbb-b648-00bddf88ef49&quot;,
&quot;nicDriverVersion&quot; : &quot;22.250.0.9&quot;,
&quot;serialNumber&quot; : &quot;xaab2ba4-d40f-4e80-9363-7e4826556055&quot;,
&quot;externalMetadata&quot; : [ {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
}, {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
} ],
&quot;version&quot; : &quot;0.123.4&quot;,
&quot;vpnProfiles&quot; : [ {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
}, {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
} ],
&quot;lastSeen&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;deleted&quot; : true,
&quot;totalMemory&quot; : &quot;16384 MB&quot;,
&quot;kernelVersion&quot; : &quot;Darwin 19.2.0&quot;,
&quot;name&quot; : &quot;Office Printer&quot;,
&quot;location&quot; : {
&quot;locationName&quot; : &quot;London&quot;,
&quot;latitude&quot; : 51.51279,
&quot;longitude&quot; : -0.09184
},
&quot;aid&quot; : &quot;&quot;,
&quot;status&quot; : &quot;enabled&quot;,
&quot;networkInterfaceProfiles&quot; : [ {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
}, {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
} ]
}
"""
expected_response = json.loads(response_body_json)
response = self.api.disable_endpoint_agent(
agent_id=agent_id,
aid=aid,
_headers=self.te_headers("disable_endpoint_agent"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_disable_endpoint_agent_error_401(self) -> None:
"""Integration test for disable_endpoint_agent error path (HTTP 401)"""
agent_id = 'agent_id_example'
aid = '1234'
error_body_json = """
{
"error_description" : "Invalid access token",
"error" : "invalid_token"
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(401)
) as context:
self.api.disable_endpoint_agent(
agent_id=agent_id,
aid=aid,
_headers=self.te_headers("disable_endpoint_agent", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_disable_endpoint_agent_error_403(self) -> None:
"""Integration test for disable_endpoint_agent error path (HTTP 403)"""
agent_id = 'agent_id_example'
aid = '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.disable_endpoint_agent(
agent_id=agent_id,
aid=aid,
_headers=self.te_headers("disable_endpoint_agent", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_disable_endpoint_agent_error_404(self) -> None:
"""Integration test for disable_endpoint_agent error path (HTTP 404)"""
agent_id = 'agent_id_example'
aid = '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.disable_endpoint_agent(
agent_id=agent_id,
aid=aid,
_headers=self.te_headers("disable_endpoint_agent", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_disable_endpoint_agent_error_429(self) -> None:
"""Integration test for disable_endpoint_agent error path (HTTP 429)"""
agent_id = 'agent_id_example'
aid = '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.disable_endpoint_agent(
agent_id=agent_id,
aid=aid,
_headers=self.te_headers("disable_endpoint_agent", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_enable_endpoint_agent_happy_path(self) -> None:
"""Integration test for enable_endpoint_agent success path"""
agent_id = 'agent_id_example'
aid = '1234'
response_body_json = """
{
&quot;npcapVersion&quot; : &quot;npcapVersion&quot;,
&quot;asnDetails&quot; : {
&quot;asName&quot; : &quot;Virgin Media Limited&quot;,
&quot;asNumber&quot; : 5089
},
&quot;clients&quot; : [ {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
}, {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
} ],
&quot;agentType&quot; : &quot;endpoint&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;batteryMetrics&quot; : {
&quot;batteryHealthNormalizedPercent&quot; : 0.92,
&quot;batteryLevel&quot; : &quot;medium&quot;,
&quot;batteryLevelNormalizedPercent&quot; : 0.3
},
&quot;publicIP&quot; : &quot;88.45.2.123&quot;,
&quot;tcpDriverAvailable&quot; : true,
&quot;platform&quot; : &quot;mac&quot;,
&quot;manufacturer&quot; : &quot;Apple, Inc.&quot;,
&quot;targetVersion&quot; : &quot;0.123.4&quot;,
&quot;cellularProfile&quot; : {
&quot;rssi&quot; : -10,
&quot;advertisedNetworkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;carrierName&quot; : &quot;T-Mobile&quot;,
&quot;rsrq&quot; : -30,
&quot;rsrp&quot; : -30,
&quot;advertisedNetworkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;rscp&quot; : -30,
&quot;networkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;networkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;sinr&quot; : 20
},
&quot;nicModel&quot; : &quot;Intel(R) Wi-Fi 6 AX200 160MHz&quot;,
&quot;createdAt&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;numberOfClients&quot; : 3,
&quot;licenseType&quot; : &quot;essentials&quot;,
&quot;osVersion&quot; : &quot;Version 10.15.2 (Build 19C57)&quot;,
&quot;computerName&quot; : &quot;DESKJET-123&quot;,
&quot;freeDiskSpaceNormalized&quot; : 0.41,
&quot;model&quot; : &quot;MacBookAir7,2&quot;,
&quot;id&quot; : &quot;861b7557-cd57-4bbb-b648-00bddf88ef49&quot;,
&quot;nicDriverVersion&quot; : &quot;22.250.0.9&quot;,
&quot;serialNumber&quot; : &quot;xaab2ba4-d40f-4e80-9363-7e4826556055&quot;,
&quot;externalMetadata&quot; : [ {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
}, {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
} ],
&quot;version&quot; : &quot;0.123.4&quot;,
&quot;vpnProfiles&quot; : [ {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
}, {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
} ],
&quot;lastSeen&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;deleted&quot; : true,
&quot;totalMemory&quot; : &quot;16384 MB&quot;,
&quot;kernelVersion&quot; : &quot;Darwin 19.2.0&quot;,
&quot;name&quot; : &quot;Office Printer&quot;,
&quot;location&quot; : {
&quot;locationName&quot; : &quot;London&quot;,
&quot;latitude&quot; : 51.51279,
&quot;longitude&quot; : -0.09184
},
&quot;aid&quot; : &quot;&quot;,
&quot;status&quot; : &quot;enabled&quot;,
&quot;networkInterfaceProfiles&quot; : [ {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
}, {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
} ]
}
"""
expected_response = json.loads(response_body_json)
response = self.api.enable_endpoint_agent(
agent_id=agent_id,
aid=aid,
_headers=self.te_headers("enable_endpoint_agent"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_enable_endpoint_agent_error_401(self) -> None:
"""Integration test for enable_endpoint_agent error path (HTTP 401)"""
agent_id = 'agent_id_example'
aid = '1234'
error_body_json = """
{
"error_description" : "Invalid access token",
"error" : "invalid_token"
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(401)
) as context:
self.api.enable_endpoint_agent(
agent_id=agent_id,
aid=aid,
_headers=self.te_headers("enable_endpoint_agent", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_enable_endpoint_agent_error_403(self) -> None:
"""Integration test for enable_endpoint_agent error path (HTTP 403)"""
agent_id = 'agent_id_example'
aid = '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.enable_endpoint_agent(
agent_id=agent_id,
aid=aid,
_headers=self.te_headers("enable_endpoint_agent", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_enable_endpoint_agent_error_404(self) -> None:
"""Integration test for enable_endpoint_agent error path (HTTP 404)"""
agent_id = 'agent_id_example'
aid = '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.enable_endpoint_agent(
agent_id=agent_id,
aid=aid,
_headers=self.te_headers("enable_endpoint_agent", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_enable_endpoint_agent_error_429(self) -> None:
"""Integration test for enable_endpoint_agent error path (HTTP 429)"""
agent_id = 'agent_id_example'
aid = '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.enable_endpoint_agent(
agent_id=agent_id,
aid=aid,
_headers=self.te_headers("enable_endpoint_agent", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_filter_endpoint_agents_happy_path(self) -> None:
"""Integration test for filter_endpoint_agents success path"""
request_body_json = """
{
"searchSort" : [ {
"sort" : "platform",
"order" : "desc"
}, {
"sort" : "platform",
"order" : "desc"
} ],
"searchFilters" : {
"serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ],
"anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ],
"agentName" : [ "myagent-1234", "myagent-1234" ],
"locationSubdivision1Code" : [ "ENG", "ENG" ],
"platform" : [ "mac", "mac" ],
"licenseType" : [ "essentials", "essentials" ],
"osVersion" : [ "Version 10.15.2", "Version 10.15.2" ],
"computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ],
"locationCountryISO" : [ "FR", "FR" ],
"id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ],
"userPrincipalName" : [ "picard@c.com" ],
"locationCity" : [ "Paris", "Paris" ],
"username" : [ "picard" ]
},
"thresholdFilter" : {
"conditionalOperator" : "and",
"filters" : [ {
"name" : "last-seen-ms",
"value" : 0.8008281904610115,
"operator" : "gte"
}, {
"name" : "last-seen-ms",
"value" : 0.8008281904610115,
"operator" : "gte"
} ]
}
}
"""
agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json)
max = 5
cursor = 'cursor_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
response_body_json = """
{
&quot;_links&quot; : {
&quot;next&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;totalAgents&quot; : 1,
&quot;agents&quot; : [ {
&quot;npcapVersion&quot; : &quot;npcapVersion&quot;,
&quot;asnDetails&quot; : {
&quot;asName&quot; : &quot;Virgin Media Limited&quot;,
&quot;asNumber&quot; : 5089
},
&quot;clients&quot; : [ {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
}, {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
} ],
&quot;agentType&quot; : &quot;endpoint&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;batteryMetrics&quot; : {
&quot;batteryHealthNormalizedPercent&quot; : 0.92,
&quot;batteryLevel&quot; : &quot;medium&quot;,
&quot;batteryLevelNormalizedPercent&quot; : 0.3
},
&quot;publicIP&quot; : &quot;88.45.2.123&quot;,
&quot;tcpDriverAvailable&quot; : true,
&quot;platform&quot; : &quot;mac&quot;,
&quot;manufacturer&quot; : &quot;Apple, Inc.&quot;,
&quot;targetVersion&quot; : &quot;0.123.4&quot;,
&quot;cellularProfile&quot; : {
&quot;rssi&quot; : -10,
&quot;advertisedNetworkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;carrierName&quot; : &quot;T-Mobile&quot;,
&quot;rsrq&quot; : -30,
&quot;rsrp&quot; : -30,
&quot;advertisedNetworkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;rscp&quot; : -30,
&quot;networkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;networkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;sinr&quot; : 20
},
&quot;nicModel&quot; : &quot;Intel(R) Wi-Fi 6 AX200 160MHz&quot;,
&quot;createdAt&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;numberOfClients&quot; : 3,
&quot;licenseType&quot; : &quot;essentials&quot;,
&quot;osVersion&quot; : &quot;Version 10.15.2 (Build 19C57)&quot;,
&quot;computerName&quot; : &quot;DESKJET-123&quot;,
&quot;freeDiskSpaceNormalized&quot; : 0.41,
&quot;model&quot; : &quot;MacBookAir7,2&quot;,
&quot;id&quot; : &quot;861b7557-cd57-4bbb-b648-00bddf88ef49&quot;,
&quot;nicDriverVersion&quot; : &quot;22.250.0.9&quot;,
&quot;serialNumber&quot; : &quot;xaab2ba4-d40f-4e80-9363-7e4826556055&quot;,
&quot;externalMetadata&quot; : [ {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
}, {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
} ],
&quot;version&quot; : &quot;0.123.4&quot;,
&quot;vpnProfiles&quot; : [ {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
}, {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
} ],
&quot;lastSeen&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;deleted&quot; : true,
&quot;totalMemory&quot; : &quot;16384 MB&quot;,
&quot;kernelVersion&quot; : &quot;Darwin 19.2.0&quot;,
&quot;name&quot; : &quot;Office Printer&quot;,
&quot;location&quot; : {
&quot;locationName&quot; : &quot;London&quot;,
&quot;latitude&quot; : 51.51279,
&quot;longitude&quot; : -0.09184
},
&quot;aid&quot; : &quot;&quot;,
&quot;status&quot; : &quot;enabled&quot;,
&quot;networkInterfaceProfiles&quot; : [ {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
}, {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
} ]
}, {
&quot;npcapVersion&quot; : &quot;npcapVersion&quot;,
&quot;asnDetails&quot; : {
&quot;asName&quot; : &quot;Virgin Media Limited&quot;,
&quot;asNumber&quot; : 5089
},
&quot;clients&quot; : [ {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
}, {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
} ],
&quot;agentType&quot; : &quot;endpoint&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;batteryMetrics&quot; : {
&quot;batteryHealthNormalizedPercent&quot; : 0.92,
&quot;batteryLevel&quot; : &quot;medium&quot;,
&quot;batteryLevelNormalizedPercent&quot; : 0.3
},
&quot;publicIP&quot; : &quot;88.45.2.123&quot;,
&quot;tcpDriverAvailable&quot; : true,
&quot;platform&quot; : &quot;mac&quot;,
&quot;manufacturer&quot; : &quot;Apple, Inc.&quot;,
&quot;targetVersion&quot; : &quot;0.123.4&quot;,
&quot;cellularProfile&quot; : {
&quot;rssi&quot; : -10,
&quot;advertisedNetworkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;carrierName&quot; : &quot;T-Mobile&quot;,
&quot;rsrq&quot; : -30,
&quot;rsrp&quot; : -30,
&quot;advertisedNetworkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;rscp&quot; : -30,
&quot;networkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;networkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;sinr&quot; : 20
},
&quot;nicModel&quot; : &quot;Intel(R) Wi-Fi 6 AX200 160MHz&quot;,
&quot;createdAt&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;numberOfClients&quot; : 3,
&quot;licenseType&quot; : &quot;essentials&quot;,
&quot;osVersion&quot; : &quot;Version 10.15.2 (Build 19C57)&quot;,
&quot;computerName&quot; : &quot;DESKJET-123&quot;,
&quot;freeDiskSpaceNormalized&quot; : 0.41,
&quot;model&quot; : &quot;MacBookAir7,2&quot;,
&quot;id&quot; : &quot;861b7557-cd57-4bbb-b648-00bddf88ef49&quot;,
&quot;nicDriverVersion&quot; : &quot;22.250.0.9&quot;,
&quot;serialNumber&quot; : &quot;xaab2ba4-d40f-4e80-9363-7e4826556055&quot;,
&quot;externalMetadata&quot; : [ {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
}, {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
} ],
&quot;version&quot; : &quot;0.123.4&quot;,
&quot;vpnProfiles&quot; : [ {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
}, {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
} ],
&quot;lastSeen&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;deleted&quot; : true,
&quot;totalMemory&quot; : &quot;16384 MB&quot;,
&quot;kernelVersion&quot; : &quot;Darwin 19.2.0&quot;,
&quot;name&quot; : &quot;Office Printer&quot;,
&quot;location&quot; : {
&quot;locationName&quot; : &quot;London&quot;,
&quot;latitude&quot; : 51.51279,
&quot;longitude&quot; : -0.09184
},
&quot;aid&quot; : &quot;&quot;,
&quot;status&quot; : &quot;enabled&quot;,
&quot;networkInterfaceProfiles&quot; : [ {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
}, {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
} ]
} ]
}
"""
expected_response = json.loads(response_body_json)
response = self.api.filter_endpoint_agents(
agent_search_request=agent_search_request,
max=max,
cursor=cursor,
aid=aid,
expand=expand,
include_deleted=include_deleted,
_headers=self.te_headers("filter_endpoint_agents"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_filter_endpoint_agents_error_400(self) -> None:
"""Integration test for filter_endpoint_agents error path (HTTP 400)"""
request_body_json = """
{
"searchSort" : [ {
"sort" : "platform",
"order" : "desc"
}, {
"sort" : "platform",
"order" : "desc"
} ],
"searchFilters" : {
"serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ],
"anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ],
"agentName" : [ "myagent-1234", "myagent-1234" ],
"locationSubdivision1Code" : [ "ENG", "ENG" ],
"platform" : [ "mac", "mac" ],
"licenseType" : [ "essentials", "essentials" ],
"osVersion" : [ "Version 10.15.2", "Version 10.15.2" ],
"computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ],
"locationCountryISO" : [ "FR", "FR" ],
"id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ],
"userPrincipalName" : [ "picard@c.com" ],
"locationCity" : [ "Paris", "Paris" ],
"username" : [ "picard" ]
},
"thresholdFilter" : {
"conditionalOperator" : "and",
"filters" : [ {
"name" : "last-seen-ms",
"value" : 0.8008281904610115,
"operator" : "gte"
}, {
"name" : "last-seen-ms",
"value" : 0.8008281904610115,
"operator" : "gte"
} ]
}
}
"""
agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json)
max = 5
cursor = 'cursor_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
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.filter_endpoint_agents(
agent_search_request=agent_search_request,
max=max,
cursor=cursor,
aid=aid,
expand=expand,
include_deleted=include_deleted,
_headers=self.te_headers("filter_endpoint_agents", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_filter_endpoint_agents_error_401(self) -> None:
"""Integration test for filter_endpoint_agents error path (HTTP 401)"""
request_body_json = """
{
"searchSort" : [ {
"sort" : "platform",
"order" : "desc"
}, {
"sort" : "platform",
"order" : "desc"
} ],
"searchFilters" : {
"serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ],
"anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ],
"agentName" : [ "myagent-1234", "myagent-1234" ],
"locationSubdivision1Code" : [ "ENG", "ENG" ],
"platform" : [ "mac", "mac" ],
"licenseType" : [ "essentials", "essentials" ],
"osVersion" : [ "Version 10.15.2", "Version 10.15.2" ],
"computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ],
"locationCountryISO" : [ "FR", "FR" ],
"id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ],
"userPrincipalName" : [ "picard@c.com" ],
"locationCity" : [ "Paris", "Paris" ],
"username" : [ "picard" ]
},
"thresholdFilter" : {
"conditionalOperator" : "and",
"filters" : [ {
"name" : "last-seen-ms",
"value" : 0.8008281904610115,
"operator" : "gte"
}, {
"name" : "last-seen-ms",
"value" : 0.8008281904610115,
"operator" : "gte"
} ]
}
}
"""
agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json)
max = 5
cursor = 'cursor_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
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.filter_endpoint_agents(
agent_search_request=agent_search_request,
max=max,
cursor=cursor,
aid=aid,
expand=expand,
include_deleted=include_deleted,
_headers=self.te_headers("filter_endpoint_agents", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_filter_endpoint_agents_error_403(self) -> None:
"""Integration test for filter_endpoint_agents error path (HTTP 403)"""
request_body_json = """
{
"searchSort" : [ {
"sort" : "platform",
"order" : "desc"
}, {
"sort" : "platform",
"order" : "desc"
} ],
"searchFilters" : {
"serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ],
"anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ],
"agentName" : [ "myagent-1234", "myagent-1234" ],
"locationSubdivision1Code" : [ "ENG", "ENG" ],
"platform" : [ "mac", "mac" ],
"licenseType" : [ "essentials", "essentials" ],
"osVersion" : [ "Version 10.15.2", "Version 10.15.2" ],
"computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ],
"locationCountryISO" : [ "FR", "FR" ],
"id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ],
"userPrincipalName" : [ "picard@c.com" ],
"locationCity" : [ "Paris", "Paris" ],
"username" : [ "picard" ]
},
"thresholdFilter" : {
"conditionalOperator" : "and",
"filters" : [ {
"name" : "last-seen-ms",
"value" : 0.8008281904610115,
"operator" : "gte"
}, {
"name" : "last-seen-ms",
"value" : 0.8008281904610115,
"operator" : "gte"
} ]
}
}
"""
agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json)
max = 5
cursor = 'cursor_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
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.filter_endpoint_agents(
agent_search_request=agent_search_request,
max=max,
cursor=cursor,
aid=aid,
expand=expand,
include_deleted=include_deleted,
_headers=self.te_headers("filter_endpoint_agents", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_filter_endpoint_agents_error_429(self) -> None:
"""Integration test for filter_endpoint_agents error path (HTTP 429)"""
request_body_json = """
{
"searchSort" : [ {
"sort" : "platform",
"order" : "desc"
}, {
"sort" : "platform",
"order" : "desc"
} ],
"searchFilters" : {
"serialNumber" : [ "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055", "xaab2ba4-d40f-4e80-9363-7e4826556055" ],
"anyConnectDeviceId" : [ "JDLKSLFEIJER004334F" ],
"agentName" : [ "myagent-1234", "myagent-1234" ],
"locationSubdivision1Code" : [ "ENG", "ENG" ],
"platform" : [ "mac", "mac" ],
"licenseType" : [ "essentials", "essentials" ],
"osVersion" : [ "Version 10.15.2", "Version 10.15.2" ],
"computerName" : [ "DESKTOP-45AE8", "DESKTOP-45AE8" ],
"locationCountryISO" : [ "FR", "FR" ],
"id" : [ "861b7557-cd57-4bbb-b648-00bddf88ef49", "861b7557-cd57-4bbb-b648-00bddf88ef49" ],
"userPrincipalName" : [ "picard@c.com" ],
"locationCity" : [ "Paris", "Paris" ],
"username" : [ "picard" ]
},
"thresholdFilter" : {
"conditionalOperator" : "and",
"filters" : [ {
"name" : "last-seen-ms",
"value" : 0.8008281904610115,
"operator" : "gte"
}, {
"name" : "last-seen-ms",
"value" : 0.8008281904610115,
"operator" : "gte"
} ]
}
}
"""
agent_search_request = thousandeyes_sdk.endpoint_agents.models.AgentSearchRequest.from_json(request_body_json)
max = 5
cursor = 'cursor_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
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.filter_endpoint_agents(
agent_search_request=agent_search_request,
max=max,
cursor=cursor,
aid=aid,
expand=expand,
include_deleted=include_deleted,
_headers=self.te_headers("filter_endpoint_agents", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_endpoint_agent_happy_path(self) -> None:
"""Integration test for get_endpoint_agent success path"""
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
response_body_json = """
{
&quot;npcapVersion&quot; : &quot;npcapVersion&quot;,
&quot;asnDetails&quot; : {
&quot;asName&quot; : &quot;Virgin Media Limited&quot;,
&quot;asNumber&quot; : 5089
},
&quot;clients&quot; : [ {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
}, {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
} ],
&quot;agentType&quot; : &quot;endpoint&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;batteryMetrics&quot; : {
&quot;batteryHealthNormalizedPercent&quot; : 0.92,
&quot;batteryLevel&quot; : &quot;medium&quot;,
&quot;batteryLevelNormalizedPercent&quot; : 0.3
},
&quot;publicIP&quot; : &quot;88.45.2.123&quot;,
&quot;tcpDriverAvailable&quot; : true,
&quot;platform&quot; : &quot;mac&quot;,
&quot;manufacturer&quot; : &quot;Apple, Inc.&quot;,
&quot;targetVersion&quot; : &quot;0.123.4&quot;,
&quot;cellularProfile&quot; : {
&quot;rssi&quot; : -10,
&quot;advertisedNetworkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;carrierName&quot; : &quot;T-Mobile&quot;,
&quot;rsrq&quot; : -30,
&quot;rsrp&quot; : -30,
&quot;advertisedNetworkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;rscp&quot; : -30,
&quot;networkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;networkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;sinr&quot; : 20
},
&quot;nicModel&quot; : &quot;Intel(R) Wi-Fi 6 AX200 160MHz&quot;,
&quot;createdAt&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;numberOfClients&quot; : 3,
&quot;licenseType&quot; : &quot;essentials&quot;,
&quot;osVersion&quot; : &quot;Version 10.15.2 (Build 19C57)&quot;,
&quot;computerName&quot; : &quot;DESKJET-123&quot;,
&quot;freeDiskSpaceNormalized&quot; : 0.41,
&quot;model&quot; : &quot;MacBookAir7,2&quot;,
&quot;id&quot; : &quot;861b7557-cd57-4bbb-b648-00bddf88ef49&quot;,
&quot;nicDriverVersion&quot; : &quot;22.250.0.9&quot;,
&quot;serialNumber&quot; : &quot;xaab2ba4-d40f-4e80-9363-7e4826556055&quot;,
&quot;externalMetadata&quot; : [ {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
}, {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
} ],
&quot;version&quot; : &quot;0.123.4&quot;,
&quot;vpnProfiles&quot; : [ {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
}, {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
} ],
&quot;lastSeen&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;deleted&quot; : true,
&quot;totalMemory&quot; : &quot;16384 MB&quot;,
&quot;kernelVersion&quot; : &quot;Darwin 19.2.0&quot;,
&quot;name&quot; : &quot;Office Printer&quot;,
&quot;location&quot; : {
&quot;locationName&quot; : &quot;London&quot;,
&quot;latitude&quot; : 51.51279,
&quot;longitude&quot; : -0.09184
},
&quot;aid&quot; : &quot;&quot;,
&quot;status&quot; : &quot;enabled&quot;,
&quot;networkInterfaceProfiles&quot; : [ {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
}, {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
} ]
}
"""
expected_response = json.loads(response_body_json)
response = self.api.get_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
include_deleted=include_deleted,
_headers=self.te_headers("get_endpoint_agent"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_get_endpoint_agent_error_401(self) -> None:
"""Integration test for get_endpoint_agent error path (HTTP 401)"""
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
include_deleted=include_deleted,
_headers=self.te_headers("get_endpoint_agent", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_endpoint_agent_error_403(self) -> None:
"""Integration test for get_endpoint_agent error path (HTTP 403)"""
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
include_deleted=include_deleted,
_headers=self.te_headers("get_endpoint_agent", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_endpoint_agent_error_404(self) -> None:
"""Integration test for get_endpoint_agent error path (HTTP 404)"""
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
include_deleted=include_deleted,
_headers=self.te_headers("get_endpoint_agent", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_endpoint_agent_error_429(self) -> None:
"""Integration test for get_endpoint_agent error path (HTTP 429)"""
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
include_deleted=include_deleted,
_headers=self.te_headers("get_endpoint_agent", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_endpoint_agents_happy_path(self) -> None:
"""Integration test for get_endpoint_agents success path"""
max = 5
cursor = 'cursor_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
use_all_permitted_aids = False
agent_name = 'agent_name_example'
computer_name = 'computer_name_example'
response_body_json = """
{
&quot;_links&quot; : {
&quot;next&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;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;totalAgents&quot; : 1,
&quot;agents&quot; : [ {
&quot;npcapVersion&quot; : &quot;npcapVersion&quot;,
&quot;asnDetails&quot; : {
&quot;asName&quot; : &quot;Virgin Media Limited&quot;,
&quot;asNumber&quot; : 5089
},
&quot;clients&quot; : [ {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
}, {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
} ],
&quot;agentType&quot; : &quot;endpoint&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;batteryMetrics&quot; : {
&quot;batteryHealthNormalizedPercent&quot; : 0.92,
&quot;batteryLevel&quot; : &quot;medium&quot;,
&quot;batteryLevelNormalizedPercent&quot; : 0.3
},
&quot;publicIP&quot; : &quot;88.45.2.123&quot;,
&quot;tcpDriverAvailable&quot; : true,
&quot;platform&quot; : &quot;mac&quot;,
&quot;manufacturer&quot; : &quot;Apple, Inc.&quot;,
&quot;targetVersion&quot; : &quot;0.123.4&quot;,
&quot;cellularProfile&quot; : {
&quot;rssi&quot; : -10,
&quot;advertisedNetworkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;carrierName&quot; : &quot;T-Mobile&quot;,
&quot;rsrq&quot; : -30,
&quot;rsrp&quot; : -30,
&quot;advertisedNetworkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;rscp&quot; : -30,
&quot;networkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;networkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;sinr&quot; : 20
},
&quot;nicModel&quot; : &quot;Intel(R) Wi-Fi 6 AX200 160MHz&quot;,
&quot;createdAt&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;numberOfClients&quot; : 3,
&quot;licenseType&quot; : &quot;essentials&quot;,
&quot;osVersion&quot; : &quot;Version 10.15.2 (Build 19C57)&quot;,
&quot;computerName&quot; : &quot;DESKJET-123&quot;,
&quot;freeDiskSpaceNormalized&quot; : 0.41,
&quot;model&quot; : &quot;MacBookAir7,2&quot;,
&quot;id&quot; : &quot;861b7557-cd57-4bbb-b648-00bddf88ef49&quot;,
&quot;nicDriverVersion&quot; : &quot;22.250.0.9&quot;,
&quot;serialNumber&quot; : &quot;xaab2ba4-d40f-4e80-9363-7e4826556055&quot;,
&quot;externalMetadata&quot; : [ {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
}, {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
} ],
&quot;version&quot; : &quot;0.123.4&quot;,
&quot;vpnProfiles&quot; : [ {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
}, {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
} ],
&quot;lastSeen&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;deleted&quot; : true,
&quot;totalMemory&quot; : &quot;16384 MB&quot;,
&quot;kernelVersion&quot; : &quot;Darwin 19.2.0&quot;,
&quot;name&quot; : &quot;Office Printer&quot;,
&quot;location&quot; : {
&quot;locationName&quot; : &quot;London&quot;,
&quot;latitude&quot; : 51.51279,
&quot;longitude&quot; : -0.09184
},
&quot;aid&quot; : &quot;&quot;,
&quot;status&quot; : &quot;enabled&quot;,
&quot;networkInterfaceProfiles&quot; : [ {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
}, {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
} ]
}, {
&quot;npcapVersion&quot; : &quot;npcapVersion&quot;,
&quot;asnDetails&quot; : {
&quot;asName&quot; : &quot;Virgin Media Limited&quot;,
&quot;asNumber&quot; : 5089
},
&quot;clients&quot; : [ {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
}, {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
} ],
&quot;agentType&quot; : &quot;endpoint&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;batteryMetrics&quot; : {
&quot;batteryHealthNormalizedPercent&quot; : 0.92,
&quot;batteryLevel&quot; : &quot;medium&quot;,
&quot;batteryLevelNormalizedPercent&quot; : 0.3
},
&quot;publicIP&quot; : &quot;88.45.2.123&quot;,
&quot;tcpDriverAvailable&quot; : true,
&quot;platform&quot; : &quot;mac&quot;,
&quot;manufacturer&quot; : &quot;Apple, Inc.&quot;,
&quot;targetVersion&quot; : &quot;0.123.4&quot;,
&quot;cellularProfile&quot; : {
&quot;rssi&quot; : -10,
&quot;advertisedNetworkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;carrierName&quot; : &quot;T-Mobile&quot;,
&quot;rsrq&quot; : -30,
&quot;rsrp&quot; : -30,
&quot;advertisedNetworkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;rscp&quot; : -30,
&quot;networkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;networkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;sinr&quot; : 20
},
&quot;nicModel&quot; : &quot;Intel(R) Wi-Fi 6 AX200 160MHz&quot;,
&quot;createdAt&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;numberOfClients&quot; : 3,
&quot;licenseType&quot; : &quot;essentials&quot;,
&quot;osVersion&quot; : &quot;Version 10.15.2 (Build 19C57)&quot;,
&quot;computerName&quot; : &quot;DESKJET-123&quot;,
&quot;freeDiskSpaceNormalized&quot; : 0.41,
&quot;model&quot; : &quot;MacBookAir7,2&quot;,
&quot;id&quot; : &quot;861b7557-cd57-4bbb-b648-00bddf88ef49&quot;,
&quot;nicDriverVersion&quot; : &quot;22.250.0.9&quot;,
&quot;serialNumber&quot; : &quot;xaab2ba4-d40f-4e80-9363-7e4826556055&quot;,
&quot;externalMetadata&quot; : [ {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
}, {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
} ],
&quot;version&quot; : &quot;0.123.4&quot;,
&quot;vpnProfiles&quot; : [ {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
}, {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
} ],
&quot;lastSeen&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;deleted&quot; : true,
&quot;totalMemory&quot; : &quot;16384 MB&quot;,
&quot;kernelVersion&quot; : &quot;Darwin 19.2.0&quot;,
&quot;name&quot; : &quot;Office Printer&quot;,
&quot;location&quot; : {
&quot;locationName&quot; : &quot;London&quot;,
&quot;latitude&quot; : 51.51279,
&quot;longitude&quot; : -0.09184
},
&quot;aid&quot; : &quot;&quot;,
&quot;status&quot; : &quot;enabled&quot;,
&quot;networkInterfaceProfiles&quot; : [ {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
}, {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
} ]
} ]
}
"""
expected_response = json.loads(response_body_json)
response = self.api.get_endpoint_agents(
max=max,
cursor=cursor,
aid=aid,
expand=expand,
include_deleted=include_deleted,
use_all_permitted_aids=use_all_permitted_aids,
agent_name=agent_name,
computer_name=computer_name,
_headers=self.te_headers("get_endpoint_agents"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_get_endpoint_agents_error_401(self) -> None:
"""Integration test for get_endpoint_agents error path (HTTP 401)"""
max = 5
cursor = 'cursor_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
use_all_permitted_aids = False
agent_name = 'agent_name_example'
computer_name = 'computer_name_example'
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_endpoint_agents(
max=max,
cursor=cursor,
aid=aid,
expand=expand,
include_deleted=include_deleted,
use_all_permitted_aids=use_all_permitted_aids,
agent_name=agent_name,
computer_name=computer_name,
_headers=self.te_headers("get_endpoint_agents", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_endpoint_agents_error_403(self) -> None:
"""Integration test for get_endpoint_agents error path (HTTP 403)"""
max = 5
cursor = 'cursor_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
use_all_permitted_aids = False
agent_name = 'agent_name_example'
computer_name = 'computer_name_example'
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_endpoint_agents(
max=max,
cursor=cursor,
aid=aid,
expand=expand,
include_deleted=include_deleted,
use_all_permitted_aids=use_all_permitted_aids,
agent_name=agent_name,
computer_name=computer_name,
_headers=self.te_headers("get_endpoint_agents", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_endpoint_agents_error_429(self) -> None:
"""Integration test for get_endpoint_agents error path (HTTP 429)"""
max = 5
cursor = 'cursor_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
include_deleted = false
use_all_permitted_aids = False
agent_name = 'agent_name_example'
computer_name = 'computer_name_example'
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_endpoint_agents(
max=max,
cursor=cursor,
aid=aid,
expand=expand,
include_deleted=include_deleted,
use_all_permitted_aids=use_all_permitted_aids,
agent_name=agent_name,
computer_name=computer_name,
_headers=self.te_headers("get_endpoint_agents", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_endpoint_agents_connection_string_happy_path(self) -> None:
"""Integration test for get_endpoint_agents_connection_string success path"""
aid = '1234'
response_body_json = """
{
&quot;connectionString&quot; : &quot;D2xZSLlqo64Xe2EnYisklA&#x3D;&#x3D;&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;
}
}
}
"""
expected_response = json.loads(response_body_json)
response = self.api.get_endpoint_agents_connection_string(
aid=aid,
_headers=self.te_headers("get_endpoint_agents_connection_string"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_get_endpoint_agents_connection_string_error_401(self) -> None:
"""Integration test for get_endpoint_agents_connection_string error path (HTTP 401)"""
aid = '1234'
error_body_json = """
{
"error_description" : "Invalid access token",
"error" : "invalid_token"
}
"""
expected_error = json.loads(error_body_json)
with self.assertRaises(
ApiException.exception_class_for_http_status(401)
) as context:
self.api.get_endpoint_agents_connection_string(
aid=aid,
_headers=self.te_headers("get_endpoint_agents_connection_string", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_endpoint_agents_connection_string_error_403(self) -> None:
"""Integration test for get_endpoint_agents_connection_string error path (HTTP 403)"""
aid = '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.get_endpoint_agents_connection_string(
aid=aid,
_headers=self.te_headers("get_endpoint_agents_connection_string", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_endpoint_agents_connection_string_error_429(self) -> None:
"""Integration test for get_endpoint_agents_connection_string error path (HTTP 429)"""
aid = '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.get_endpoint_agents_connection_string(
aid=aid,
_headers=self.te_headers("get_endpoint_agents_connection_string", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_endpoint_agent_happy_path(self) -> None:
"""Integration test for update_endpoint_agent success path"""
request_body_json = """
{
"licenseType" : "essentials",
"name" : "Office Printer"
}
"""
endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json)
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
response_body_json = """
{
&quot;npcapVersion&quot; : &quot;npcapVersion&quot;,
&quot;asnDetails&quot; : {
&quot;asName&quot; : &quot;Virgin Media Limited&quot;,
&quot;asNumber&quot; : 5089
},
&quot;clients&quot; : [ {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
}, {
&quot;browserExtensions&quot; : [ {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
}, {
&quot;browser&quot; : &quot;edge&quot;,
&quot;profile&quot; : &quot;Profile 1&quot;,
&quot;active&quot; : true,
&quot;error&quot; : &quot;&quot;,
&quot;version&quot; : &quot;0.123.0&quot;,
&quot;enabled&quot; : true
} ],
&quot;userProfile&quot; : {
&quot;userName&quot; : &quot;joeblogs32&quot;,
&quot;userPrincipalName&quot; : &quot;joeblogs32@c.com&quot;
}
} ],
&quot;agentType&quot; : &quot;endpoint&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;batteryMetrics&quot; : {
&quot;batteryHealthNormalizedPercent&quot; : 0.92,
&quot;batteryLevel&quot; : &quot;medium&quot;,
&quot;batteryLevelNormalizedPercent&quot; : 0.3
},
&quot;publicIP&quot; : &quot;88.45.2.123&quot;,
&quot;tcpDriverAvailable&quot; : true,
&quot;platform&quot; : &quot;mac&quot;,
&quot;manufacturer&quot; : &quot;Apple, Inc.&quot;,
&quot;targetVersion&quot; : &quot;0.123.4&quot;,
&quot;cellularProfile&quot; : {
&quot;rssi&quot; : -10,
&quot;advertisedNetworkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;carrierName&quot; : &quot;T-Mobile&quot;,
&quot;rsrq&quot; : -30,
&quot;rsrp&quot; : -30,
&quot;advertisedNetworkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;rscp&quot; : -30,
&quot;networkGen&quot; : &quot;2g, 3g, 4g, 5g&quot;,
&quot;networkSubtype&quot; : &quot;LTE/HSPA&quot;,
&quot;sinr&quot; : 20
},
&quot;nicModel&quot; : &quot;Intel(R) Wi-Fi 6 AX200 160MHz&quot;,
&quot;createdAt&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;numberOfClients&quot; : 3,
&quot;licenseType&quot; : &quot;essentials&quot;,
&quot;osVersion&quot; : &quot;Version 10.15.2 (Build 19C57)&quot;,
&quot;computerName&quot; : &quot;DESKJET-123&quot;,
&quot;freeDiskSpaceNormalized&quot; : 0.41,
&quot;model&quot; : &quot;MacBookAir7,2&quot;,
&quot;id&quot; : &quot;861b7557-cd57-4bbb-b648-00bddf88ef49&quot;,
&quot;nicDriverVersion&quot; : &quot;22.250.0.9&quot;,
&quot;serialNumber&quot; : &quot;xaab2ba4-d40f-4e80-9363-7e4826556055&quot;,
&quot;externalMetadata&quot; : [ {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
}, {
&quot;key&quot; : &quot;anyConnectDeviceId&quot;,
&quot;value&quot; : &quot;DF434343D&quot;
} ],
&quot;version&quot; : &quot;0.123.4&quot;,
&quot;vpnProfiles&quot; : [ {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
}, {
&quot;vpnClientNetworkRange&quot; : [ &quot;10.100.0.0/22&quot; ],
&quot;vpnGatewayAddress&quot; : &quot;vpnGatewayAddress&quot;,
&quot;vpnType&quot; : &quot;cisco-anyconnect&quot;,
&quot;interfaceName&quot; : &quot;interfaceName&quot;,
&quot;vpnClientAddresses&quot; : [ &quot;10.100.0.10&quot; ]
} ],
&quot;lastSeen&quot; : &quot;2022-05-26T23:37:16Z&quot;,
&quot;deleted&quot; : true,
&quot;totalMemory&quot; : &quot;16384 MB&quot;,
&quot;kernelVersion&quot; : &quot;Darwin 19.2.0&quot;,
&quot;name&quot; : &quot;Office Printer&quot;,
&quot;location&quot; : {
&quot;locationName&quot; : &quot;London&quot;,
&quot;latitude&quot; : 51.51279,
&quot;longitude&quot; : -0.09184
},
&quot;aid&quot; : &quot;&quot;,
&quot;status&quot; : &quot;enabled&quot;,
&quot;networkInterfaceProfiles&quot; : [ {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
}, {
&quot;ethernetProfile&quot; : {
&quot;linkSpeed&quot; : 0
},
&quot;hardwareType&quot; : &quot;wireless&quot;,
&quot;interfaceName&quot; : &quot;en0&quot;,
&quot;addressProfiles&quot; : [ {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
}, {
&quot;prefixLength&quot; : 24,
&quot;addressType&quot; : &quot;unique-local&quot;,
&quot;ipAddress&quot; : &quot;2001:db8:3333:4444:5555:6666:7777:8888&quot;,
&quot;routerHardwareAddress&quot; : &quot;5c:b1:3e:46:1c:84&quot;,
&quot;gateway&quot; : &quot;192.168.0.254&quot;
} ],
&quot;wirelessProfile&quot; : {
&quot;rssi&quot; : -36,
&quot;bssid&quot; : &quot;00:11:22:aa:bb:cc&quot;,
&quot;channel&quot; : 48,
&quot;phyMode&quot; : &quot;802.11ac&quot;,
&quot;ssid&quot; : &quot;GuestWiFi&quot;
}
} ]
}
"""
expected_response = json.loads(response_body_json)
response = self.api.update_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
endpoint_agent_update=endpoint_agent_update,
_headers=self.te_headers("update_endpoint_agent"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_update_endpoint_agent_error_401(self) -> None:
"""Integration test for update_endpoint_agent error path (HTTP 401)"""
request_body_json = """
{
"licenseType" : "essentials",
"name" : "Office Printer"
}
"""
endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json)
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
endpoint_agent_update=endpoint_agent_update,
_headers=self.te_headers("update_endpoint_agent", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_endpoint_agent_error_403(self) -> None:
"""Integration test for update_endpoint_agent error path (HTTP 403)"""
request_body_json = """
{
"licenseType" : "essentials",
"name" : "Office Printer"
}
"""
endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json)
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
endpoint_agent_update=endpoint_agent_update,
_headers=self.te_headers("update_endpoint_agent", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_endpoint_agent_error_404(self) -> None:
"""Integration test for update_endpoint_agent error path (HTTP 404)"""
request_body_json = """
{
"licenseType" : "essentials",
"name" : "Office Printer"
}
"""
endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json)
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
endpoint_agent_update=endpoint_agent_update,
_headers=self.te_headers("update_endpoint_agent", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_endpoint_agent_error_429(self) -> None:
"""Integration test for update_endpoint_agent error path (HTTP 429)"""
request_body_json = """
{
"licenseType" : "essentials",
"name" : "Office Printer"
}
"""
endpoint_agent_update = thousandeyes_sdk.endpoint_agents.models.EndpointAgentUpdate.from_json(request_body_json)
agent_id = 'agent_id_example'
aid = '1234'
expand = [thousandeyes_sdk.endpoint_agents.ExpandEndpointAgentOptions()]
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_endpoint_agent(
agent_id=agent_id,
aid=aid,
expand=expand,
endpoint_agent_update=endpoint_agent_update,
_headers=self.te_headers("update_endpoint_agent", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
if __name__ == '__main__':
unittest.main()