thousandeyes-sdk-python/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_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

2467 lines
119 KiB
Python

# coding: utf-8
"""
Dashboards API
Manage ThousandEyes Dashboards.
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import json
import unittest
import thousandeyes_sdk.dashboards.models
from thousandeyes_sdk.core.exceptions import ApiException
from thousandeyes_sdk.dashboards.api.dashboard_snapshots_api import DashboardSnapshotsApi
from .integration_test_utils import IntegrationTestBase
from .test_utils import assert_constructed_model_matches_example_json
class TestDashboardSnapshotsApiIntegration(IntegrationTestBase):
"""DashboardSnapshotsApi integration test stubs"""
def setUp(self) -> None:
super().setUp()
self.api = DashboardSnapshotsApi(self.api_client)
def test_create_dashboard_snapshot_happy_path(self) -> None:
"""Integration test for create_dashboard_snapshot success path"""
request_body_json = """
{
"endDate" : "2023-05-16T10:14:28Z",
"dashboardId" : "646f4d2ce3c99b0536c3821e",
"displayName" : "snapshot from API",
"anonymizeData" : true,
"timezone" : "PST",
"startDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16T10:14:28Z"
}
"""
generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json)
aid = '1234'
response_body_json = """
{
&quot;snapshotId&quot; : &quot;d28bb71f-5a47-4783-8f12-d4b115e61b0c&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.create_dashboard_snapshot(
generate_dashboard_snapshot_request=generate_dashboard_snapshot_request,
aid=aid,
_headers=self.te_headers("create_dashboard_snapshot"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_create_dashboard_snapshot_error_400(self) -> None:
"""Integration test for create_dashboard_snapshot error path (HTTP 400)"""
request_body_json = """
{
"endDate" : "2023-05-16T10:14:28Z",
"dashboardId" : "646f4d2ce3c99b0536c3821e",
"displayName" : "snapshot from API",
"anonymizeData" : true,
"timezone" : "PST",
"startDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16T10:14:28Z"
}
"""
generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json)
aid = '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.create_dashboard_snapshot(
generate_dashboard_snapshot_request=generate_dashboard_snapshot_request,
aid=aid,
_headers=self.te_headers("create_dashboard_snapshot", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_dashboard_snapshot_error_401(self) -> None:
"""Integration test for create_dashboard_snapshot error path (HTTP 401)"""
request_body_json = """
{
"endDate" : "2023-05-16T10:14:28Z",
"dashboardId" : "646f4d2ce3c99b0536c3821e",
"displayName" : "snapshot from API",
"anonymizeData" : true,
"timezone" : "PST",
"startDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16T10:14:28Z"
}
"""
generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json)
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.create_dashboard_snapshot(
generate_dashboard_snapshot_request=generate_dashboard_snapshot_request,
aid=aid,
_headers=self.te_headers("create_dashboard_snapshot", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_dashboard_snapshot_error_403(self) -> None:
"""Integration test for create_dashboard_snapshot error path (HTTP 403)"""
request_body_json = """
{
"endDate" : "2023-05-16T10:14:28Z",
"dashboardId" : "646f4d2ce3c99b0536c3821e",
"displayName" : "snapshot from API",
"anonymizeData" : true,
"timezone" : "PST",
"startDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16T10:14:28Z"
}
"""
generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json)
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.create_dashboard_snapshot(
generate_dashboard_snapshot_request=generate_dashboard_snapshot_request,
aid=aid,
_headers=self.te_headers("create_dashboard_snapshot", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_dashboard_snapshot_error_404(self) -> None:
"""Integration test for create_dashboard_snapshot error path (HTTP 404)"""
request_body_json = """
{
"endDate" : "2023-05-16T10:14:28Z",
"dashboardId" : "646f4d2ce3c99b0536c3821e",
"displayName" : "snapshot from API",
"anonymizeData" : true,
"timezone" : "PST",
"startDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16T10:14:28Z"
}
"""
generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json)
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.create_dashboard_snapshot(
generate_dashboard_snapshot_request=generate_dashboard_snapshot_request,
aid=aid,
_headers=self.te_headers("create_dashboard_snapshot", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_create_dashboard_snapshot_error_500(self) -> None:
"""Integration test for create_dashboard_snapshot error path (HTTP 500)"""
request_body_json = """
{
"endDate" : "2023-05-16T10:14:28Z",
"dashboardId" : "646f4d2ce3c99b0536c3821e",
"displayName" : "snapshot from API",
"anonymizeData" : true,
"timezone" : "PST",
"startDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16T10:14:28Z"
}
"""
generate_dashboard_snapshot_request = thousandeyes_sdk.dashboards.models.GenerateDashboardSnapshotRequest.from_json(request_body_json)
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(500)
) as context:
self.api.create_dashboard_snapshot(
generate_dashboard_snapshot_request=generate_dashboard_snapshot_request,
aid=aid,
_headers=self.te_headers("create_dashboard_snapshot", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_dashboard_snapshot_happy_path(self) -> None:
"""Integration test for delete_dashboard_snapshot success path"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
aid = '1234'
response = self.api.delete_dashboard_snapshot_with_http_info(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("delete_dashboard_snapshot"),
)
self.assertEqual(204, response.status_code)
self.assertIsNone(response.data)
def test_delete_dashboard_snapshot_error_400(self) -> None:
"""Integration test for delete_dashboard_snapshot error path (HTTP 400)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
aid = '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_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("delete_dashboard_snapshot", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_dashboard_snapshot_error_401(self) -> None:
"""Integration test for delete_dashboard_snapshot error path (HTTP 401)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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.delete_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("delete_dashboard_snapshot", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_dashboard_snapshot_error_403(self) -> None:
"""Integration test for delete_dashboard_snapshot error path (HTTP 403)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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.delete_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("delete_dashboard_snapshot", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_dashboard_snapshot_error_404(self) -> None:
"""Integration test for delete_dashboard_snapshot error path (HTTP 404)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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.delete_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("delete_dashboard_snapshot", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_dashboard_snapshot_error_429(self) -> None:
"""Integration test for delete_dashboard_snapshot error path (HTTP 429)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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.delete_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("delete_dashboard_snapshot", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_delete_dashboard_snapshot_error_500(self) -> None:
"""Integration test for delete_dashboard_snapshot error path (HTTP 500)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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(500)
) as context:
self.api.delete_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("delete_dashboard_snapshot", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_happy_path(self) -> None:
"""Integration test for get_dashboard_snapshot success path"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
aid = '1234'
response_body_json = """
{
&quot;snapshotId&quot; : &quot;d28bb71f-5a47-4783-8f12-d4b115e61b0c&quot;,
&quot;_links&quot; : {
&quot;appLink&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;apiLinks&quot; : [ {
&quot;key&quot; : &quot;&quot;
}, {
&quot;key&quot; : &quot;&quot;
} ],
&quot;snapshotExpirationDate&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;isScheduled&quot; : true,
&quot;widgets&quot; : [ {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
}, {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
} ],
&quot;accountId&quot; : 1234,
&quot;createdDate&quot; : &quot;2023-05-16 10:14:28&quot;,
&quot;snapshotName&quot; : &quot;HTTP Server Dashboard Snapshot&quot;,
&quot;timeSpan&quot; : {
&quot;duration&quot; : 60,
&quot;start&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;startDate&quot; : &quot;2023-05-16 10:14:28&quot;
},
&quot;permalink&quot; : &quot;https://app.thousandeyes.com/dashboard/?snapshotId&#x3D;d28bb71f-5a47-4783-8f12-d4b115e61b0c&quot;,
&quot;aid&quot; : &quot;1234&quot;,
&quot;snapshotCreatedDate&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;isShared&quot; : true,
&quot;dashboard&quot; : {
&quot;isMigratedReport&quot; : false,
&quot;dashboardCreatedBy&quot; : &quot;1&quot;,
&quot;_links&quot; : {
&quot;snapshots&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;isDefaultForUser&quot; : true,
&quot;description&quot; : &quot;HTTP Server Widgets&quot;,
&quot;isPrivate&quot; : true,
&quot;title&quot; : &quot;HTTP Server Widgets&quot;,
&quot;isBuiltIn&quot; : true,
&quot;widgets&quot; : [ {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
}, {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
} ],
&quot;globalFilterId&quot; : &quot;65babd9bb90bf55b17c96c8d&quot;,
&quot;modifiedBy&quot; : 1,
&quot;dashboardModifiedBy&quot; : &quot;1&quot;,
&quot;migratedReport&quot; : false,
&quot;isDefaultForAccount&quot; : false,
&quot;defaultTimespan&quot; : {
&quot;duration&quot; : 7200,
&quot;timespanDuration&quot; : 7200,
&quot;start&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;end&quot; : &quot;2023-05-16T11:14:28Z&quot;,
&quot;timespanStart&quot; : &quot;2023-05-16 10:14:28&quot;,
&quot;timespanEnd&quot; : &quot;2023-05-16 11:14:28&quot;
},
&quot;layout&quot; : {
&quot;layoutId&quot; : &quot;grid-layout-1&quot;,
&quot;type&quot; : &quot;grid&quot;,
&quot;details&quot; : {
&quot;widgetPositioning&quot; : [ {
&quot;x&quot; : 0,
&quot;y&quot; : 0,
&quot;w&quot; : 9,
&quot;h&quot; : 5,
&quot;id&quot; : &quot;widgetId-71lbb&quot;
} ]
}
},
&quot;accountId&quot; : 1234,
&quot;apiLink&quot; : [ {
&quot;key&quot; : &quot;&quot;
}, {
&quot;key&quot; : &quot;&quot;
} ],
&quot;dashboardId&quot; : &quot;5e1f7a99143ae6004fdc3bb4&quot;,
&quot;createdBy&quot; : 1,
&quot;globalOverride&quot; : true,
&quot;modifiedDate&quot; : &quot;2023-05-16 10:14:28&quot;,
&quot;isGlobalOverride&quot; : true,
&quot;aid&quot; : &quot;1234&quot;,
&quot;dashboardModifiedDate&quot; : &quot;2023-05-16T10:14:28Z&quot;
},
&quot;expirationDate&quot; : &quot;2023-05-16 10:14:28&quot;
}
"""
expected_response = json.loads(response_body_json)
response = self.api.get_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_get_dashboard_snapshot_error_400(self) -> None:
"""Integration test for get_dashboard_snapshot error path (HTTP 400)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
aid = '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.get_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_error_401(self) -> None:
"""Integration test for get_dashboard_snapshot error path (HTTP 401)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_error_403(self) -> None:
"""Integration test for get_dashboard_snapshot error path (HTTP 403)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_error_404(self) -> None:
"""Integration test for get_dashboard_snapshot error path (HTTP 404)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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.get_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_error_429(self) -> None:
"""Integration test for get_dashboard_snapshot error path (HTTP 429)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_error_500(self) -> None:
"""Integration test for get_dashboard_snapshot error path (HTTP 500)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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(500)
) as context:
self.api.get_dashboard_snapshot(
snapshot_id=snapshot_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_widget_data_happy_path(self) -> None:
"""Integration test for get_dashboard_snapshot_widget_data success path"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
widget_id = 'unpmg'
aid = '1234'
response_body_json = """
{
&quot;groupLabels&quot; : [ {
&quot;groupProperty&quot; : &quot;AGENT&quot;,
&quot;groupLabels&quot; : [ {
&quot;groupId&quot; : &quot;2565&quot;,
&quot;groupLabel&quot; : &quot;San Francisco, CA&quot;
}, {
&quot;groupId&quot; : &quot;2565&quot;,
&quot;groupLabel&quot; : &quot;San Francisco, CA&quot;
} ]
}, {
&quot;groupProperty&quot; : &quot;AGENT&quot;,
&quot;groupLabels&quot; : [ {
&quot;groupId&quot; : &quot;2565&quot;,
&quot;groupLabel&quot; : &quot;San Francisco, CA&quot;
}, {
&quot;groupId&quot; : &quot;2565&quot;,
&quot;groupLabel&quot; : &quot;San Francisco, CA&quot;
} ]
} ],
&quot;data&quot; : {
&quot;alerts&quot; : [ {
&quot;alertType&quot; : &quot;network-end-to-end-server&quot;,
&quot;durationInSeconds&quot; : 25,
&quot;alertSource&quot; : &quot;Http Test&quot;,
&quot;active&quot; : true,
&quot;testId&quot; : &quot;56512&quot;,
&quot;startTime&quot; : &quot;2023-06-02T08:54:00Z&quot;,
&quot;alertId&quot; : &quot;2004945&quot;,
&quot;ruleId&quot; : &quot;281724&quot;,
&quot;alertRule&quot; : &quot;Http Test Rule&quot;
}, {
&quot;alertType&quot; : &quot;network-end-to-end-server&quot;,
&quot;durationInSeconds&quot; : 25,
&quot;alertSource&quot; : &quot;Http Test&quot;,
&quot;active&quot; : true,
&quot;testId&quot; : &quot;56512&quot;,
&quot;startTime&quot; : &quot;2023-06-02T08:54:00Z&quot;,
&quot;alertId&quot; : &quot;2004945&quot;,
&quot;ruleId&quot; : &quot;281724&quot;,
&quot;alertRule&quot; : &quot;Http Test Rule&quot;
} ],
&quot;summary&quot; : {
&quot;offline&quot; : 2,
&quot;online&quot; : 10,
&quot;disabled&quot; : 3
},
&quot;totalAlerts&quot; : 500,
&quot;cards&quot; : [ {
&quot;numberOfDataPoints&quot; : 24192,
&quot;cardName&quot; : &quot;Card Name&quot;,
&quot;endDate&quot; : &quot;2023-05-16T10:14:28Z&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;cardId&quot; : &quot;lrxxr&quot;,
&quot;alertSuppressionWindows&quot; : [ {
&quot;testIds&quot; : [ &quot;281474976710661&quot; ],
&quot;repeatUnit&quot; : &quot;week&quot;,
&quot;durationInSeconds&quot; : 7200,
&quot;repeat&quot; : &quot;custom&quot;,
&quot;name&quot; : &quot;Test dashboards&quot;,
&quot;repeatEvery&quot; : 5,
&quot;id&quot; : &quot;281474976710662&quot;,
&quot;startTimes&quot; : [ &quot;2023-05-16T10:14:28Z&quot; ]
}, {
&quot;testIds&quot; : [ &quot;281474976710661&quot; ],
&quot;repeatUnit&quot; : &quot;week&quot;,
&quot;durationInSeconds&quot; : 7200,
&quot;repeat&quot; : &quot;custom&quot;,
&quot;name&quot; : &quot;Test dashboards&quot;,
&quot;repeatEvery&quot; : 5,
&quot;id&quot; : &quot;281474976710662&quot;,
&quot;startTimes&quot; : [ &quot;2023-05-16T10:14:28Z&quot; ]
} ],
&quot;binSize&quot; : 3600,
&quot;previousValue&quot; : 500,
&quot;value&quot; : 100,
&quot;startDate&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;timestamp&quot; : 1567620000,
&quot;status&quot; : &quot;No data&quot;
}, {
&quot;numberOfDataPoints&quot; : 24192,
&quot;cardName&quot; : &quot;Card Name&quot;,
&quot;endDate&quot; : &quot;2023-05-16T10:14:28Z&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;cardId&quot; : &quot;lrxxr&quot;,
&quot;alertSuppressionWindows&quot; : [ {
&quot;testIds&quot; : [ &quot;281474976710661&quot; ],
&quot;repeatUnit&quot; : &quot;week&quot;,
&quot;durationInSeconds&quot; : 7200,
&quot;repeat&quot; : &quot;custom&quot;,
&quot;name&quot; : &quot;Test dashboards&quot;,
&quot;repeatEvery&quot; : 5,
&quot;id&quot; : &quot;281474976710662&quot;,
&quot;startTimes&quot; : [ &quot;2023-05-16T10:14:28Z&quot; ]
}, {
&quot;testIds&quot; : [ &quot;281474976710661&quot; ],
&quot;repeatUnit&quot; : &quot;week&quot;,
&quot;durationInSeconds&quot; : 7200,
&quot;repeat&quot; : &quot;custom&quot;,
&quot;name&quot; : &quot;Test dashboards&quot;,
&quot;repeatEvery&quot; : 5,
&quot;id&quot; : &quot;281474976710662&quot;,
&quot;startTimes&quot; : [ &quot;2023-05-16T10:14:28Z&quot; ]
} ],
&quot;binSize&quot; : 3600,
&quot;previousValue&quot; : 500,
&quot;value&quot; : 100,
&quot;startDate&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;timestamp&quot; : 1567620000,
&quot;status&quot; : &quot;No data&quot;
} ],
&quot;tests&quot; : [ {
&quot;graphlets&quot; : [ {
&quot;metric&quot; : &quot;Availability&quot;,
&quot;testId&quot; : &quot;68257&quot;,
&quot;points&quot; : [ {
&quot;x&quot; : 1580403900,
&quot;y&quot; : 128.249
}, {
&quot;x&quot; : 1580403900,
&quot;y&quot; : 128.249
} ]
}, {
&quot;metric&quot; : &quot;Availability&quot;,
&quot;testId&quot; : &quot;68257&quot;,
&quot;points&quot; : [ {
&quot;x&quot; : 1580403900,
&quot;y&quot; : 128.249
}, {
&quot;x&quot; : 1580403900,
&quot;y&quot; : 128.249
} ]
} ],
&quot;alertCount&quot; : 398,
&quot;testType&quot; : &quot;Web - HTTP Server&quot;,
&quot;testId&quot; : &quot;68256&quot;,
&quot;isShared&quot; : true,
&quot;testName&quot; : &quot;Http Test Name&quot;,
&quot;target&quot; : &quot;www.google.com&quot;
}, {
&quot;graphlets&quot; : [ {
&quot;metric&quot; : &quot;Availability&quot;,
&quot;testId&quot; : &quot;68257&quot;,
&quot;points&quot; : [ {
&quot;x&quot; : 1580403900,
&quot;y&quot; : 128.249
}, {
&quot;x&quot; : 1580403900,
&quot;y&quot; : 128.249
} ]
}, {
&quot;metric&quot; : &quot;Availability&quot;,
&quot;testId&quot; : &quot;68257&quot;,
&quot;points&quot; : [ {
&quot;x&quot; : 1580403900,
&quot;y&quot; : 128.249
}, {
&quot;x&quot; : 1580403900,
&quot;y&quot; : 128.249
} ]
} ],
&quot;alertCount&quot; : 398,
&quot;testType&quot; : &quot;Web - HTTP Server&quot;,
&quot;testId&quot; : &quot;68256&quot;,
&quot;isShared&quot; : true,
&quot;testName&quot; : &quot;Http Test Name&quot;,
&quot;target&quot; : &quot;www.google.com&quot;
} ],
&quot;columns&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;columnId&quot; : &quot;938to&quot;,
&quot;alertSuppressionWindows&quot; : [ {
&quot;testIds&quot; : [ &quot;281474976710661&quot; ],
&quot;repeatUnit&quot; : &quot;week&quot;,
&quot;durationInSeconds&quot; : 7200,
&quot;repeat&quot; : &quot;custom&quot;,
&quot;name&quot; : &quot;Test dashboards&quot;,
&quot;repeatEvery&quot; : 5,
&quot;id&quot; : &quot;281474976710662&quot;,
&quot;startTimes&quot; : [ &quot;2023-05-16T10:14:28Z&quot; ]
}, {
&quot;testIds&quot; : [ &quot;281474976710661&quot; ],
&quot;repeatUnit&quot; : &quot;week&quot;,
&quot;durationInSeconds&quot; : 7200,
&quot;repeat&quot; : &quot;custom&quot;,
&quot;name&quot; : &quot;Test dashboards&quot;,
&quot;repeatEvery&quot; : 5,
&quot;id&quot; : &quot;281474976710662&quot;,
&quot;startTimes&quot; : [ &quot;2023-05-16T10:14:28Z&quot; ]
} ],
&quot;binSize&quot; : 3600,
&quot;points&quot; : [ {
&quot;numberOfDataPoints&quot; : 23304,
&quot;groups&quot; : [ {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
}, {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
} ],
&quot;value&quot; : 100,
&quot;timestamp&quot; : 1567620000
}, {
&quot;numberOfDataPoints&quot; : 23304,
&quot;groups&quot; : [ {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
}, {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
} ],
&quot;value&quot; : 100,
&quot;timestamp&quot; : 1567620000
} ],
&quot;status&quot; : &quot;No data&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;columnId&quot; : &quot;938to&quot;,
&quot;alertSuppressionWindows&quot; : [ {
&quot;testIds&quot; : [ &quot;281474976710661&quot; ],
&quot;repeatUnit&quot; : &quot;week&quot;,
&quot;durationInSeconds&quot; : 7200,
&quot;repeat&quot; : &quot;custom&quot;,
&quot;name&quot; : &quot;Test dashboards&quot;,
&quot;repeatEvery&quot; : 5,
&quot;id&quot; : &quot;281474976710662&quot;,
&quot;startTimes&quot; : [ &quot;2023-05-16T10:14:28Z&quot; ]
}, {
&quot;testIds&quot; : [ &quot;281474976710661&quot; ],
&quot;repeatUnit&quot; : &quot;week&quot;,
&quot;durationInSeconds&quot; : 7200,
&quot;repeat&quot; : &quot;custom&quot;,
&quot;name&quot; : &quot;Test dashboards&quot;,
&quot;repeatEvery&quot; : 5,
&quot;id&quot; : &quot;281474976710662&quot;,
&quot;startTimes&quot; : [ &quot;2023-05-16T10:14:28Z&quot; ]
} ],
&quot;binSize&quot; : 3600,
&quot;points&quot; : [ {
&quot;numberOfDataPoints&quot; : 23304,
&quot;groups&quot; : [ {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
}, {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
} ],
&quot;value&quot; : 100,
&quot;timestamp&quot; : 1567620000
}, {
&quot;numberOfDataPoints&quot; : 23304,
&quot;groups&quot; : [ {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
}, {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
} ],
&quot;value&quot; : 100,
&quot;timestamp&quot; : 1567620000
} ],
&quot;status&quot; : &quot;No data&quot;
} ],
&quot;alertSuppressionWindows&quot; : [ {
&quot;testIds&quot; : [ &quot;281474976710661&quot; ],
&quot;repeatUnit&quot; : &quot;week&quot;,
&quot;durationInSeconds&quot; : 7200,
&quot;repeat&quot; : &quot;custom&quot;,
&quot;name&quot; : &quot;Test dashboards&quot;,
&quot;repeatEvery&quot; : 5,
&quot;id&quot; : &quot;281474976710662&quot;,
&quot;startTimes&quot; : [ &quot;2023-05-16T10:14:28Z&quot; ]
}, {
&quot;testIds&quot; : [ &quot;281474976710661&quot; ],
&quot;repeatUnit&quot; : &quot;week&quot;,
&quot;durationInSeconds&quot; : 7200,
&quot;repeat&quot; : &quot;custom&quot;,
&quot;name&quot; : &quot;Test dashboards&quot;,
&quot;repeatEvery&quot; : 5,
&quot;id&quot; : &quot;281474976710662&quot;,
&quot;startTimes&quot; : [ &quot;2023-05-16T10:14:28Z&quot; ]
} ],
&quot;activeAlerts&quot; : 483,
&quot;startRound&quot; : 1384309800,
&quot;points&quot; : [ {
&quot;numberOfDataPoints&quot; : 23304,
&quot;groups&quot; : [ {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
}, {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
} ],
&quot;value&quot; : 100,
&quot;timestamp&quot; : 1567620000
}, {
&quot;numberOfDataPoints&quot; : 23304,
&quot;groups&quot; : [ {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
}, {
&quot;groupProperty&quot; : &quot;COUNTRY&quot;,
&quot;groupValue&quot; : &quot;US&quot;
} ],
&quot;value&quot; : 100,
&quot;timestamp&quot; : 1567620000
} ],
&quot;agents&quot; : [ {
&quot;agentId&quot; : &quot;6522&quot;,
&quot;agentName&quot; : &quot;0c3898000117&quot;,
&quot;location&quot; : {
&quot;locationName&quot; : &quot;San Francisco, California, US&quot;,
&quot;latitude&quot; : 37.77493,
&quot;longitude&quot; : -122.41942
},
&quot;ipInfo&quot; : {
&quot;ipv6&quot; : &quot;ipv6&quot;,
&quot;privateIp&quot; : &quot;172.58.92.31&quot;,
&quot;operativeSystemVersion&quot; : &quot;operativeSystemVersion&quot;,
&quot;publicIp&quot; : &quot;172.58.92.31&quot;
},
&quot;status&quot; : &quot;online&quot;
}, {
&quot;agentId&quot; : &quot;6522&quot;,
&quot;agentName&quot; : &quot;0c3898000117&quot;,
&quot;location&quot; : {
&quot;locationName&quot; : &quot;San Francisco, California, US&quot;,
&quot;latitude&quot; : 37.77493,
&quot;longitude&quot; : -122.41942
},
&quot;ipInfo&quot; : {
&quot;ipv6&quot; : &quot;ipv6&quot;,
&quot;privateIp&quot; : &quot;172.58.92.31&quot;,
&quot;operativeSystemVersion&quot; : &quot;operativeSystemVersion&quot;,
&quot;publicIp&quot; : &quot;172.58.92.31&quot;
},
&quot;status&quot; : &quot;online&quot;
} ],
&quot;status&quot; : &quot;No data&quot;
},
&quot;endDate&quot; : &quot;2022-07-18T22:00:54Z&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;binSize&quot; : 3600,
&quot;startDate&quot; : &quot;2022-07-17T22:00:54Z&quot;
}
"""
expected_response = json.loads(response_body_json)
response = self.api.get_dashboard_snapshot_widget_data(
snapshot_id=snapshot_id,
widget_id=widget_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot_widget_data"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_get_dashboard_snapshot_widget_data_error_400(self) -> None:
"""Integration test for get_dashboard_snapshot_widget_data error path (HTTP 400)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
widget_id = 'unpmg'
aid = '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.get_dashboard_snapshot_widget_data(
snapshot_id=snapshot_id,
widget_id=widget_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_widget_data_error_401(self) -> None:
"""Integration test for get_dashboard_snapshot_widget_data error path (HTTP 401)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
widget_id = 'unpmg'
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_dashboard_snapshot_widget_data(
snapshot_id=snapshot_id,
widget_id=widget_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_widget_data_error_403(self) -> None:
"""Integration test for get_dashboard_snapshot_widget_data error path (HTTP 403)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
widget_id = 'unpmg'
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_dashboard_snapshot_widget_data(
snapshot_id=snapshot_id,
widget_id=widget_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_widget_data_error_404(self) -> None:
"""Integration test for get_dashboard_snapshot_widget_data error path (HTTP 404)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
widget_id = 'unpmg'
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.get_dashboard_snapshot_widget_data(
snapshot_id=snapshot_id,
widget_id=widget_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_widget_data_error_429(self) -> None:
"""Integration test for get_dashboard_snapshot_widget_data error path (HTTP 429)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
widget_id = 'unpmg'
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_dashboard_snapshot_widget_data(
snapshot_id=snapshot_id,
widget_id=widget_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshot_widget_data_error_500(self) -> None:
"""Integration test for get_dashboard_snapshot_widget_data error path (HTTP 500)"""
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
widget_id = 'unpmg'
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(500)
) as context:
self.api.get_dashboard_snapshot_widget_data(
snapshot_id=snapshot_id,
widget_id=widget_id,
aid=aid,
_headers=self.te_headers("get_dashboard_snapshot_widget_data", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshots_happy_path(self) -> None:
"""Integration test for get_dashboard_snapshots success path"""
aid = '1234'
dashboard_id = '646f4d2ce3c99b0536c3821e'
cursor = 'cursor_example'
response_body_json = """
{
&quot;pages&quot; : {
&quot;key&quot; : &quot;&quot;
},
&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;previous&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;dashboardSnapshots&quot; : [ {
&quot;snapshotId&quot; : &quot;d28bb71f-5a47-4783-8f12-d4b115e61b0c&quot;,
&quot;_links&quot; : {
&quot;appLink&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;apiLinks&quot; : [ {
&quot;key&quot; : &quot;&quot;
}, {
&quot;key&quot; : &quot;&quot;
} ],
&quot;snapshotExpirationDate&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;isScheduled&quot; : true,
&quot;widgets&quot; : [ {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
}, {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
} ],
&quot;accountId&quot; : 1234,
&quot;createdDate&quot; : &quot;2023-05-16 10:14:28&quot;,
&quot;snapshotName&quot; : &quot;HTTP Server Dashboard Snapshot&quot;,
&quot;timeSpan&quot; : {
&quot;duration&quot; : 60,
&quot;start&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;startDate&quot; : &quot;2023-05-16 10:14:28&quot;
},
&quot;permalink&quot; : &quot;https://app.thousandeyes.com/dashboard/?snapshotId&#x3D;d28bb71f-5a47-4783-8f12-d4b115e61b0c&quot;,
&quot;aid&quot; : &quot;1234&quot;,
&quot;snapshotCreatedDate&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;isShared&quot; : true,
&quot;dashboard&quot; : {
&quot;isMigratedReport&quot; : false,
&quot;dashboardCreatedBy&quot; : &quot;1&quot;,
&quot;_links&quot; : {
&quot;snapshots&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;isDefaultForUser&quot; : true,
&quot;description&quot; : &quot;HTTP Server Widgets&quot;,
&quot;isPrivate&quot; : true,
&quot;title&quot; : &quot;HTTP Server Widgets&quot;,
&quot;isBuiltIn&quot; : true,
&quot;widgets&quot; : [ {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
}, {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
} ],
&quot;globalFilterId&quot; : &quot;65babd9bb90bf55b17c96c8d&quot;,
&quot;modifiedBy&quot; : 1,
&quot;dashboardModifiedBy&quot; : &quot;1&quot;,
&quot;migratedReport&quot; : false,
&quot;isDefaultForAccount&quot; : false,
&quot;defaultTimespan&quot; : {
&quot;duration&quot; : 7200,
&quot;timespanDuration&quot; : 7200,
&quot;start&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;end&quot; : &quot;2023-05-16T11:14:28Z&quot;,
&quot;timespanStart&quot; : &quot;2023-05-16 10:14:28&quot;,
&quot;timespanEnd&quot; : &quot;2023-05-16 11:14:28&quot;
},
&quot;layout&quot; : {
&quot;layoutId&quot; : &quot;grid-layout-1&quot;,
&quot;type&quot; : &quot;grid&quot;,
&quot;details&quot; : {
&quot;widgetPositioning&quot; : [ {
&quot;x&quot; : 0,
&quot;y&quot; : 0,
&quot;w&quot; : 9,
&quot;h&quot; : 5,
&quot;id&quot; : &quot;widgetId-71lbb&quot;
} ]
}
},
&quot;accountId&quot; : 1234,
&quot;apiLink&quot; : [ {
&quot;key&quot; : &quot;&quot;
}, {
&quot;key&quot; : &quot;&quot;
} ],
&quot;dashboardId&quot; : &quot;5e1f7a99143ae6004fdc3bb4&quot;,
&quot;createdBy&quot; : 1,
&quot;globalOverride&quot; : true,
&quot;modifiedDate&quot; : &quot;2023-05-16 10:14:28&quot;,
&quot;isGlobalOverride&quot; : true,
&quot;aid&quot; : &quot;1234&quot;,
&quot;dashboardModifiedDate&quot; : &quot;2023-05-16T10:14:28Z&quot;
},
&quot;expirationDate&quot; : &quot;2023-05-16 10:14:28&quot;
}, {
&quot;snapshotId&quot; : &quot;d28bb71f-5a47-4783-8f12-d4b115e61b0c&quot;,
&quot;_links&quot; : {
&quot;appLink&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;apiLinks&quot; : [ {
&quot;key&quot; : &quot;&quot;
}, {
&quot;key&quot; : &quot;&quot;
} ],
&quot;snapshotExpirationDate&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;isScheduled&quot; : true,
&quot;widgets&quot; : [ {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
}, {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
} ],
&quot;accountId&quot; : 1234,
&quot;createdDate&quot; : &quot;2023-05-16 10:14:28&quot;,
&quot;snapshotName&quot; : &quot;HTTP Server Dashboard Snapshot&quot;,
&quot;timeSpan&quot; : {
&quot;duration&quot; : 60,
&quot;start&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;startDate&quot; : &quot;2023-05-16 10:14:28&quot;
},
&quot;permalink&quot; : &quot;https://app.thousandeyes.com/dashboard/?snapshotId&#x3D;d28bb71f-5a47-4783-8f12-d4b115e61b0c&quot;,
&quot;aid&quot; : &quot;1234&quot;,
&quot;snapshotCreatedDate&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;isShared&quot; : true,
&quot;dashboard&quot; : {
&quot;isMigratedReport&quot; : false,
&quot;dashboardCreatedBy&quot; : &quot;1&quot;,
&quot;_links&quot; : {
&quot;snapshots&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;isDefaultForUser&quot; : true,
&quot;description&quot; : &quot;HTTP Server Widgets&quot;,
&quot;isPrivate&quot; : true,
&quot;title&quot; : &quot;HTTP Server Widgets&quot;,
&quot;isBuiltIn&quot; : true,
&quot;widgets&quot; : [ {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
}, {
&quot;embedUrl&quot; : &quot;https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f&quot;,
&quot;shouldExcludeAlertSuppressionWindows&quot; : true,
&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;visualMode&quot; : &quot;Full&quot;,
&quot;filters&quot; : {
&quot;TEST&quot; : [ 5187, 5227 ],
&quot;ENDPOINT_MACHINE_ID&quot; : [ &quot;fbd0050c-07f7-43f7-9631-14b32f096962&quot; ]
},
&quot;title&quot; : &quot;Widget Title&quot;,
&quot;type&quot; : &quot;Agent Status&quot;,
&quot;metricGroup&quot; : &quot;BGP&quot;,
&quot;measure&quot; : {
&quot;percentileValue&quot; : 95,
&quot;type&quot; : &quot;MEAN&quot;
},
&quot;apiLink&quot; : &quot;apiLink&quot;,
&quot;metric&quot; : &quot;ENDPOINT_GATEWAY_CPU_LOAD_PERCENT&quot;,
&quot;isEmbedded&quot; : true,
&quot;id&quot; : &quot;1234&quot;,
&quot;fixedTimespan&quot; : {
&quot;unit&quot; : &quot;Days&quot;,
&quot;value&quot; : 10
},
&quot;dataSource&quot; : &quot;ENDPOINT_AGENTS&quot;,
&quot;direction&quot; : &quot;FROM_TARGET&quot;
} ],
&quot;globalFilterId&quot; : &quot;65babd9bb90bf55b17c96c8d&quot;,
&quot;modifiedBy&quot; : 1,
&quot;dashboardModifiedBy&quot; : &quot;1&quot;,
&quot;migratedReport&quot; : false,
&quot;isDefaultForAccount&quot; : false,
&quot;defaultTimespan&quot; : {
&quot;duration&quot; : 7200,
&quot;timespanDuration&quot; : 7200,
&quot;start&quot; : &quot;2023-05-16T10:14:28Z&quot;,
&quot;end&quot; : &quot;2023-05-16T11:14:28Z&quot;,
&quot;timespanStart&quot; : &quot;2023-05-16 10:14:28&quot;,
&quot;timespanEnd&quot; : &quot;2023-05-16 11:14:28&quot;
},
&quot;layout&quot; : {
&quot;layoutId&quot; : &quot;grid-layout-1&quot;,
&quot;type&quot; : &quot;grid&quot;,
&quot;details&quot; : {
&quot;widgetPositioning&quot; : [ {
&quot;x&quot; : 0,
&quot;y&quot; : 0,
&quot;w&quot; : 9,
&quot;h&quot; : 5,
&quot;id&quot; : &quot;widgetId-71lbb&quot;
} ]
}
},
&quot;accountId&quot; : 1234,
&quot;apiLink&quot; : [ {
&quot;key&quot; : &quot;&quot;
}, {
&quot;key&quot; : &quot;&quot;
} ],
&quot;dashboardId&quot; : &quot;5e1f7a99143ae6004fdc3bb4&quot;,
&quot;createdBy&quot; : 1,
&quot;globalOverride&quot; : true,
&quot;modifiedDate&quot; : &quot;2023-05-16 10:14:28&quot;,
&quot;isGlobalOverride&quot; : true,
&quot;aid&quot; : &quot;1234&quot;,
&quot;dashboardModifiedDate&quot; : &quot;2023-05-16T10:14:28Z&quot;
},
&quot;expirationDate&quot; : &quot;2023-05-16 10:14:28&quot;
} ]
}
"""
expected_response = json.loads(response_body_json)
response = self.api.get_dashboard_snapshots(
aid=aid,
dashboard_id=dashboard_id,
cursor=cursor,
_headers=self.te_headers("get_dashboard_snapshots"),
)
assert_constructed_model_matches_example_json(response, expected_response)
def test_get_dashboard_snapshots_error_400(self) -> None:
"""Integration test for get_dashboard_snapshots error path (HTTP 400)"""
aid = '1234'
dashboard_id = '646f4d2ce3c99b0536c3821e'
cursor = 'cursor_example'
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_dashboard_snapshots(
aid=aid,
dashboard_id=dashboard_id,
cursor=cursor,
_headers=self.te_headers("get_dashboard_snapshots", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshots_error_401(self) -> None:
"""Integration test for get_dashboard_snapshots error path (HTTP 401)"""
aid = '1234'
dashboard_id = '646f4d2ce3c99b0536c3821e'
cursor = 'cursor_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_dashboard_snapshots(
aid=aid,
dashboard_id=dashboard_id,
cursor=cursor,
_headers=self.te_headers("get_dashboard_snapshots", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshots_error_403(self) -> None:
"""Integration test for get_dashboard_snapshots error path (HTTP 403)"""
aid = '1234'
dashboard_id = '646f4d2ce3c99b0536c3821e'
cursor = 'cursor_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_dashboard_snapshots(
aid=aid,
dashboard_id=dashboard_id,
cursor=cursor,
_headers=self.te_headers("get_dashboard_snapshots", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshots_error_404(self) -> None:
"""Integration test for get_dashboard_snapshots error path (HTTP 404)"""
aid = '1234'
dashboard_id = '646f4d2ce3c99b0536c3821e'
cursor = 'cursor_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(404)
) as context:
self.api.get_dashboard_snapshots(
aid=aid,
dashboard_id=dashboard_id,
cursor=cursor,
_headers=self.te_headers("get_dashboard_snapshots", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshots_error_429(self) -> None:
"""Integration test for get_dashboard_snapshots error path (HTTP 429)"""
aid = '1234'
dashboard_id = '646f4d2ce3c99b0536c3821e'
cursor = 'cursor_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_dashboard_snapshots(
aid=aid,
dashboard_id=dashboard_id,
cursor=cursor,
_headers=self.te_headers("get_dashboard_snapshots", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_get_dashboard_snapshots_error_500(self) -> None:
"""Integration test for get_dashboard_snapshots error path (HTTP 500)"""
aid = '1234'
dashboard_id = '646f4d2ce3c99b0536c3821e'
cursor = 'cursor_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(500)
) as context:
self.api.get_dashboard_snapshots(
aid=aid,
dashboard_id=dashboard_id,
cursor=cursor,
_headers=self.te_headers("get_dashboard_snapshots", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_dashboard_snapshot_expiration_date_happy_path(self) -> None:
"""Integration test for update_dashboard_snapshot_expiration_date success path"""
request_body_json = """
{
"snapshotExpirationDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16 10:14:28"
}
"""
update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json)
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
aid = '1234'
response = self.api.update_dashboard_snapshot_expiration_date_with_http_info(
snapshot_id=snapshot_id,
update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request,
aid=aid,
_headers=self.te_headers("update_dashboard_snapshot_expiration_date"),
)
self.assertEqual(204, response.status_code)
self.assertIsNone(response.data)
def test_update_dashboard_snapshot_expiration_date_error_400(self) -> None:
"""Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 400)"""
request_body_json = """
{
"snapshotExpirationDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16 10:14:28"
}
"""
update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json)
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
aid = '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.update_dashboard_snapshot_expiration_date(
snapshot_id=snapshot_id,
update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request,
aid=aid,
_headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="400"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_dashboard_snapshot_expiration_date_error_401(self) -> None:
"""Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 401)"""
request_body_json = """
{
"snapshotExpirationDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16 10:14:28"
}
"""
update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json)
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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.update_dashboard_snapshot_expiration_date(
snapshot_id=snapshot_id,
update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request,
aid=aid,
_headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="401"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_dashboard_snapshot_expiration_date_error_403(self) -> None:
"""Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 403)"""
request_body_json = """
{
"snapshotExpirationDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16 10:14:28"
}
"""
update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json)
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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.update_dashboard_snapshot_expiration_date(
snapshot_id=snapshot_id,
update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request,
aid=aid,
_headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="403"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_dashboard_snapshot_expiration_date_error_404(self) -> None:
"""Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 404)"""
request_body_json = """
{
"snapshotExpirationDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16 10:14:28"
}
"""
update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json)
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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.update_dashboard_snapshot_expiration_date(
snapshot_id=snapshot_id,
update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request,
aid=aid,
_headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="404"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_dashboard_snapshot_expiration_date_error_429(self) -> None:
"""Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 429)"""
request_body_json = """
{
"snapshotExpirationDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16 10:14:28"
}
"""
update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json)
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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.update_dashboard_snapshot_expiration_date(
snapshot_id=snapshot_id,
update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request,
aid=aid,
_headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="429"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
def test_update_dashboard_snapshot_expiration_date_error_500(self) -> None:
"""Integration test for update_dashboard_snapshot_expiration_date error path (HTTP 500)"""
request_body_json = """
{
"snapshotExpirationDate" : "2023-05-16T10:14:28Z",
"expirationDate" : "2023-05-16 10:14:28"
}
"""
update_snapshot_expiration_date_api_request = thousandeyes_sdk.dashboards.models.UpdateSnapshotExpirationDateApiRequest.from_json(request_body_json)
snapshot_id = 'd28bb71f-5a47-4783-8f12-d4b115e61b0c'
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(500)
) as context:
self.api.update_dashboard_snapshot_expiration_date(
snapshot_id=snapshot_id,
update_snapshot_expiration_date_api_request=update_snapshot_expiration_date_api_request,
aid=aid,
_headers=self.te_headers("update_dashboard_snapshot_expiration_date", error_status="500"),
)
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
if __name__ == '__main__':
unittest.main()