thousandeyes-sdk-python/thousandeyes-sdk-dashboards/test/test_dashboard_snapshots_api_integration.py
2026-08-03 16:04:35 +00:00

2611 lines
103 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 = """
{
"snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c",
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
}
}
"""
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 = """
{
"snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c",
"_links" : {
"appLink" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
},
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"apiLinks" : [ {
"key" : ""
}, {
"key" : ""
} ],
"snapshotExpirationDate" : "2023-05-16T10:14:28Z",
"isScheduled" : true,
"widgets" : [ {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
}, {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
} ],
"accountId" : 1234,
"createdDate" : "2023-05-16 10:14:28",
"snapshotName" : "HTTP Server Dashboard Snapshot",
"timeSpan" : {
"duration" : 60,
"start" : "2023-05-16T10:14:28Z",
"startDate" : "2023-05-16 10:14:28"
},
"permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c",
"aid" : "1234",
"snapshotCreatedDate" : "2023-05-16T10:14:28Z",
"isShared" : true,
"dashboard" : {
"isMigratedReport" : false,
"dashboardCreatedBy" : "1",
"_links" : {
"snapshots" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
},
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"isDefaultForUser" : true,
"description" : "HTTP Server Widgets",
"isPrivate" : true,
"title" : "HTTP Server Widgets",
"isBuiltIn" : true,
"widgets" : [ {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
}, {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
} ],
"globalFilterId" : "65babd9bb90bf55b17c96c8d",
"modifiedBy" : 1,
"dashboardModifiedBy" : "1",
"migratedReport" : false,
"isDefaultForAccount" : false,
"defaultTimespan" : {
"duration" : 7200,
"timespanDuration" : 7200,
"start" : "2023-05-16T10:14:28Z",
"end" : "2023-05-16T11:14:28Z",
"timespanStart" : "2023-05-16 10:14:28",
"timespanEnd" : "2023-05-16 11:14:28"
},
"layout" : {
"layoutId" : "grid-layout-1",
"type" : "grid",
"details" : {
"widgetPositioning" : [ {
"x" : 0,
"y" : 0,
"w" : 9,
"h" : 5,
"id" : "widgetId-71lbb"
} ]
}
},
"accountId" : 1234,
"apiLink" : [ {
"key" : ""
}, {
"key" : ""
} ],
"dashboardId" : "5e1f7a99143ae6004fdc3bb4",
"createdBy" : 1,
"globalOverride" : true,
"modifiedDate" : "2023-05-16 10:14:28",
"isGlobalOverride" : true,
"aid" : "1234",
"dashboardModifiedDate" : "2023-05-16T10:14:28Z"
},
"expirationDate" : "2023-05-16 10:14:28"
}
"""
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 = """
{
"groupLabels" : [ {
"groupProperty" : "AGENT",
"groupLabels" : [ {
"groupId" : "2565",
"groupLabel" : "San Francisco, CA"
}, {
"groupId" : "2565",
"groupLabel" : "San Francisco, CA"
} ]
}, {
"groupProperty" : "AGENT",
"groupLabels" : [ {
"groupId" : "2565",
"groupLabel" : "San Francisco, CA"
}, {
"groupId" : "2565",
"groupLabel" : "San Francisco, CA"
} ]
} ],
"data" : {
"alerts" : [ {
"alertType" : "network-end-to-end-server",
"durationInSeconds" : 25,
"alertSource" : "Http Test",
"active" : true,
"testId" : "56512",
"startTime" : "2023-06-02T08:54:00Z",
"alertId" : "2004945",
"ruleId" : "281724",
"alertRule" : "Http Test Rule"
}, {
"alertType" : "network-end-to-end-server",
"durationInSeconds" : 25,
"alertSource" : "Http Test",
"active" : true,
"testId" : "56512",
"startTime" : "2023-06-02T08:54:00Z",
"alertId" : "2004945",
"ruleId" : "281724",
"alertRule" : "Http Test Rule"
} ],
"summary" : {
"offline" : 2,
"online" : 10,
"disabled" : 3
},
"totalAlerts" : 500,
"cards" : [ {
"numberOfDataPoints" : 24192,
"cardName" : "Card Name",
"endDate" : "2023-05-16T10:14:28Z",
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"cardId" : "lrxxr",
"alertSuppressionWindows" : [ {
"testIds" : [ "281474976710661" ],
"repeatUnit" : "week",
"durationInSeconds" : 7200,
"repeat" : "custom",
"name" : "Test dashboards",
"repeatEvery" : 5,
"id" : "281474976710662",
"startTimes" : [ "2023-05-16T10:14:28Z" ]
}, {
"testIds" : [ "281474976710661" ],
"repeatUnit" : "week",
"durationInSeconds" : 7200,
"repeat" : "custom",
"name" : "Test dashboards",
"repeatEvery" : 5,
"id" : "281474976710662",
"startTimes" : [ "2023-05-16T10:14:28Z" ]
} ],
"binSize" : 3600,
"previousValue" : 500,
"value" : 100,
"startDate" : "2023-05-16T10:14:28Z",
"timestamp" : 1567620000,
"status" : "No data"
}, {
"numberOfDataPoints" : 24192,
"cardName" : "Card Name",
"endDate" : "2023-05-16T10:14:28Z",
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"cardId" : "lrxxr",
"alertSuppressionWindows" : [ {
"testIds" : [ "281474976710661" ],
"repeatUnit" : "week",
"durationInSeconds" : 7200,
"repeat" : "custom",
"name" : "Test dashboards",
"repeatEvery" : 5,
"id" : "281474976710662",
"startTimes" : [ "2023-05-16T10:14:28Z" ]
}, {
"testIds" : [ "281474976710661" ],
"repeatUnit" : "week",
"durationInSeconds" : 7200,
"repeat" : "custom",
"name" : "Test dashboards",
"repeatEvery" : 5,
"id" : "281474976710662",
"startTimes" : [ "2023-05-16T10:14:28Z" ]
} ],
"binSize" : 3600,
"previousValue" : 500,
"value" : 100,
"startDate" : "2023-05-16T10:14:28Z",
"timestamp" : 1567620000,
"status" : "No data"
} ],
"tests" : [ {
"graphlets" : [ {
"metric" : "Availability",
"testId" : "68257",
"points" : [ {
"x" : 1580403900,
"y" : 128.249
}, {
"x" : 1580403900,
"y" : 128.249
} ]
}, {
"metric" : "Availability",
"testId" : "68257",
"points" : [ {
"x" : 1580403900,
"y" : 128.249
}, {
"x" : 1580403900,
"y" : 128.249
} ]
} ],
"alertCount" : 398,
"testType" : "Web - HTTP Server",
"testId" : "68256",
"isShared" : true,
"testName" : "Http Test Name",
"target" : "www.google.com"
}, {
"graphlets" : [ {
"metric" : "Availability",
"testId" : "68257",
"points" : [ {
"x" : 1580403900,
"y" : 128.249
}, {
"x" : 1580403900,
"y" : 128.249
} ]
}, {
"metric" : "Availability",
"testId" : "68257",
"points" : [ {
"x" : 1580403900,
"y" : 128.249
}, {
"x" : 1580403900,
"y" : 128.249
} ]
} ],
"alertCount" : 398,
"testType" : "Web - HTTP Server",
"testId" : "68256",
"isShared" : true,
"testName" : "Http Test Name",
"target" : "www.google.com"
} ],
"columns" : [ {
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"columnId" : "938to",
"alertSuppressionWindows" : [ {
"testIds" : [ "281474976710661" ],
"repeatUnit" : "week",
"durationInSeconds" : 7200,
"repeat" : "custom",
"name" : "Test dashboards",
"repeatEvery" : 5,
"id" : "281474976710662",
"startTimes" : [ "2023-05-16T10:14:28Z" ]
}, {
"testIds" : [ "281474976710661" ],
"repeatUnit" : "week",
"durationInSeconds" : 7200,
"repeat" : "custom",
"name" : "Test dashboards",
"repeatEvery" : 5,
"id" : "281474976710662",
"startTimes" : [ "2023-05-16T10:14:28Z" ]
} ],
"binSize" : 3600,
"points" : [ {
"numberOfDataPoints" : 23304,
"groups" : [ {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
}, {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
} ],
"value" : 100,
"timestamp" : 1567620000
}, {
"numberOfDataPoints" : 23304,
"groups" : [ {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
}, {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
} ],
"value" : 100,
"timestamp" : 1567620000
} ],
"status" : "No data"
}, {
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"columnId" : "938to",
"alertSuppressionWindows" : [ {
"testIds" : [ "281474976710661" ],
"repeatUnit" : "week",
"durationInSeconds" : 7200,
"repeat" : "custom",
"name" : "Test dashboards",
"repeatEvery" : 5,
"id" : "281474976710662",
"startTimes" : [ "2023-05-16T10:14:28Z" ]
}, {
"testIds" : [ "281474976710661" ],
"repeatUnit" : "week",
"durationInSeconds" : 7200,
"repeat" : "custom",
"name" : "Test dashboards",
"repeatEvery" : 5,
"id" : "281474976710662",
"startTimes" : [ "2023-05-16T10:14:28Z" ]
} ],
"binSize" : 3600,
"points" : [ {
"numberOfDataPoints" : 23304,
"groups" : [ {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
}, {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
} ],
"value" : 100,
"timestamp" : 1567620000
}, {
"numberOfDataPoints" : 23304,
"groups" : [ {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
}, {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
} ],
"value" : 100,
"timestamp" : 1567620000
} ],
"status" : "No data"
} ],
"alertSuppressionWindows" : [ {
"testIds" : [ "281474976710661" ],
"repeatUnit" : "week",
"durationInSeconds" : 7200,
"repeat" : "custom",
"name" : "Test dashboards",
"repeatEvery" : 5,
"id" : "281474976710662",
"startTimes" : [ "2023-05-16T10:14:28Z" ]
}, {
"testIds" : [ "281474976710661" ],
"repeatUnit" : "week",
"durationInSeconds" : 7200,
"repeat" : "custom",
"name" : "Test dashboards",
"repeatEvery" : 5,
"id" : "281474976710662",
"startTimes" : [ "2023-05-16T10:14:28Z" ]
} ],
"activeAlerts" : 483,
"startRound" : 1384309800,
"points" : [ {
"numberOfDataPoints" : 23304,
"groups" : [ {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
}, {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
} ],
"value" : 100,
"timestamp" : 1567620000
}, {
"numberOfDataPoints" : 23304,
"groups" : [ {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
}, {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
} ],
"value" : 100,
"timestamp" : 1567620000
} ],
"agents" : [ {
"agentId" : "6522",
"agentName" : "0c3898000117",
"location" : {
"locationName" : "San Francisco, California, US",
"latitude" : 37.77493,
"longitude" : -122.41942
},
"ipInfo" : {
"ipv6" : "ipv6",
"privateIp" : "172.58.92.31",
"operativeSystemVersion" : "operativeSystemVersion",
"publicIp" : "172.58.92.31"
},
"status" : "online"
}, {
"agentId" : "6522",
"agentName" : "0c3898000117",
"location" : {
"locationName" : "San Francisco, California, US",
"latitude" : 37.77493,
"longitude" : -122.41942
},
"ipInfo" : {
"ipv6" : "ipv6",
"privateIp" : "172.58.92.31",
"operativeSystemVersion" : "operativeSystemVersion",
"publicIp" : "172.58.92.31"
},
"status" : "online"
} ],
"status" : "No data"
},
"endDate" : "2022-07-18T22:00:54Z",
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"binSize" : 3600,
"startDate" : "2022-07-17T22:00:54Z"
}
"""
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 = """
{
"pages" : {
"key" : ""
},
"_links" : {
"next" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
},
"previous" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
},
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"dashboardSnapshots" : [ {
"snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c",
"_links" : {
"appLink" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
},
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"apiLinks" : [ {
"key" : ""
}, {
"key" : ""
} ],
"snapshotExpirationDate" : "2023-05-16T10:14:28Z",
"isScheduled" : true,
"widgets" : [ {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
}, {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
} ],
"accountId" : 1234,
"createdDate" : "2023-05-16 10:14:28",
"snapshotName" : "HTTP Server Dashboard Snapshot",
"timeSpan" : {
"duration" : 60,
"start" : "2023-05-16T10:14:28Z",
"startDate" : "2023-05-16 10:14:28"
},
"permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c",
"aid" : "1234",
"snapshotCreatedDate" : "2023-05-16T10:14:28Z",
"isShared" : true,
"dashboard" : {
"isMigratedReport" : false,
"dashboardCreatedBy" : "1",
"_links" : {
"snapshots" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
},
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"isDefaultForUser" : true,
"description" : "HTTP Server Widgets",
"isPrivate" : true,
"title" : "HTTP Server Widgets",
"isBuiltIn" : true,
"widgets" : [ {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
}, {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
} ],
"globalFilterId" : "65babd9bb90bf55b17c96c8d",
"modifiedBy" : 1,
"dashboardModifiedBy" : "1",
"migratedReport" : false,
"isDefaultForAccount" : false,
"defaultTimespan" : {
"duration" : 7200,
"timespanDuration" : 7200,
"start" : "2023-05-16T10:14:28Z",
"end" : "2023-05-16T11:14:28Z",
"timespanStart" : "2023-05-16 10:14:28",
"timespanEnd" : "2023-05-16 11:14:28"
},
"layout" : {
"layoutId" : "grid-layout-1",
"type" : "grid",
"details" : {
"widgetPositioning" : [ {
"x" : 0,
"y" : 0,
"w" : 9,
"h" : 5,
"id" : "widgetId-71lbb"
} ]
}
},
"accountId" : 1234,
"apiLink" : [ {
"key" : ""
}, {
"key" : ""
} ],
"dashboardId" : "5e1f7a99143ae6004fdc3bb4",
"createdBy" : 1,
"globalOverride" : true,
"modifiedDate" : "2023-05-16 10:14:28",
"isGlobalOverride" : true,
"aid" : "1234",
"dashboardModifiedDate" : "2023-05-16T10:14:28Z"
},
"expirationDate" : "2023-05-16 10:14:28"
}, {
"snapshotId" : "d28bb71f-5a47-4783-8f12-d4b115e61b0c",
"_links" : {
"appLink" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
},
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"apiLinks" : [ {
"key" : ""
}, {
"key" : ""
} ],
"snapshotExpirationDate" : "2023-05-16T10:14:28Z",
"isScheduled" : true,
"widgets" : [ {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
}, {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
} ],
"accountId" : 1234,
"createdDate" : "2023-05-16 10:14:28",
"snapshotName" : "HTTP Server Dashboard Snapshot",
"timeSpan" : {
"duration" : 60,
"start" : "2023-05-16T10:14:28Z",
"startDate" : "2023-05-16 10:14:28"
},
"permalink" : "https://app.thousandeyes.com/dashboard/?snapshotId=d28bb71f-5a47-4783-8f12-d4b115e61b0c",
"aid" : "1234",
"snapshotCreatedDate" : "2023-05-16T10:14:28Z",
"isShared" : true,
"dashboard" : {
"isMigratedReport" : false,
"dashboardCreatedBy" : "1",
"_links" : {
"snapshots" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
},
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"isDefaultForUser" : true,
"description" : "HTTP Server Widgets",
"isPrivate" : true,
"title" : "HTTP Server Widgets",
"isBuiltIn" : true,
"widgets" : [ {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
}, {
"embedUrl" : "https://embed.thousandeyes.com/e/00aa:3039802d-5c76-42d2-9a93-c6e5f9d3122f",
"shouldExcludeAlertSuppressionWindows" : true,
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"visualMode" : "Full",
"filters" : {
"TEST" : [ 5187, 5227 ],
"ENDPOINT_MACHINE_ID" : [ "fbd0050c-07f7-43f7-9631-14b32f096962" ]
},
"title" : "Widget Title",
"type" : "Agent Status",
"metricGroup" : "BGP",
"measure" : {
"percentileValue" : 95,
"type" : "MEAN"
},
"apiLink" : "apiLink",
"metric" : "ENDPOINT_GATEWAY_CPU_LOAD_PERCENT",
"isEmbedded" : true,
"id" : "1234",
"fixedTimespan" : {
"unit" : "Days",
"value" : 10
},
"dataSource" : "ENDPOINT_AGENTS",
"direction" : "FROM_TARGET"
} ],
"globalFilterId" : "65babd9bb90bf55b17c96c8d",
"modifiedBy" : 1,
"dashboardModifiedBy" : "1",
"migratedReport" : false,
"isDefaultForAccount" : false,
"defaultTimespan" : {
"duration" : 7200,
"timespanDuration" : 7200,
"start" : "2023-05-16T10:14:28Z",
"end" : "2023-05-16T11:14:28Z",
"timespanStart" : "2023-05-16 10:14:28",
"timespanEnd" : "2023-05-16 11:14:28"
},
"layout" : {
"layoutId" : "grid-layout-1",
"type" : "grid",
"details" : {
"widgetPositioning" : [ {
"x" : 0,
"y" : 0,
"w" : 9,
"h" : 5,
"id" : "widgetId-71lbb"
} ]
}
},
"accountId" : 1234,
"apiLink" : [ {
"key" : ""
}, {
"key" : ""
} ],
"dashboardId" : "5e1f7a99143ae6004fdc3bb4",
"createdBy" : 1,
"globalOverride" : true,
"modifiedDate" : "2023-05-16 10:14:28",
"isGlobalOverride" : true,
"aid" : "1234",
"dashboardModifiedDate" : "2023-05-16T10:14:28Z"
},
"expirationDate" : "2023-05-16 10:14:28"
} ]
}
"""
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()