thousandeyes-sdk-python/thousandeyes-sdk-dashboards/test/test_dashboards_api.py
Miguel Pragosa d44cc6b392
Some checks failed
Python CI / build (push) Has been cancelled
[GitHub Bot] Generated python SDK (#116)
Co-authored-by: API Team <api-team@thousandeyes.com>
2025-10-21 16:42:32 +01:00

1512 lines
64 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 .test_utils import assert_constructed_model_matches_example_json
from thousandeyes_sdk.dashboards.api.dashboards_api import DashboardsApi
class TestDashboardsApi(unittest.TestCase):
"""DashboardsApi unit test stubs"""
def setUp(self) -> None:
self.api = DashboardsApi()
def tearDown(self) -> None:
pass
def test_create_dashboard_models_validation(self) -> None:
"""Test case for create_dashboard request and response models"""
request_body_json = """
{
"isMigratedReport" : false,
"_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"
}
},
"isDefaultForAccount" : false,
"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.0,
"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.0,
"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"
} ],
"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"
},
"globalFilterId" : "65babd9bb90bf55b17c96c8d",
"dashboardId" : "5e1f7a99143ae6004fdc3bb4",
"createdBy" : "1",
"modifiedDate" : "2023-05-16T10:14:28Z",
"modifiedBy" : "1",
"isGlobalOverride" : true,
"aid" : "1234"
}"""
request_loaded_json = json.loads(request_body_json)
request_from_json = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json)
assert_constructed_model_matches_example_json(request_from_json, request_loaded_json)
response_body_json = """
{
"isMigratedReport" : false,
"_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"
}
},
"isDefaultForAccount" : false,
"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.0,
"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.0,
"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"
} ],
"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"
},
"globalFilterId" : "65babd9bb90bf55b17c96c8d",
"dashboardId" : "5e1f7a99143ae6004fdc3bb4",
"createdBy" : "1",
"modifiedDate" : "2023-05-16T10:14:28Z",
"modifiedBy" : "1",
"isGlobalOverride" : true,
"aid" : "1234"
}"""
response_loaded_json = json.loads(response_body_json)
response_from_json = thousandeyes_sdk.dashboards.models.Dashboard.from_json(response_body_json)
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
def test_delete_dashboard_models_validation(self) -> None:
"""Test case for delete_dashboard request and response models"""
def test_get_dashboard_models_validation(self) -> None:
"""Test case for get_dashboard request and response models"""
response_body_json = """
{
"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"
}
},
"dashboardModifiedBy" : "1",
"migratedReport" : false,
"isDefaultForAccount" : false,
"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.0,
"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.0,
"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"
} ],
"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"
},
"globalFilterId" : "65babd9bb90bf55b17c96c8d",
"accountId" : 1234,
"apiLink" : [ {
"key" : ""
}, {
"key" : ""
} ],
"dashboardId" : "5e1f7a99143ae6004fdc3bb4",
"createdBy" : 1,
"globalOverride" : true,
"modifiedDate" : "2023-05-16 10:14:28",
"modifiedBy" : 1,
"isGlobalOverride" : true,
"aid" : "1234",
"dashboardModifiedDate" : "2023-05-16T10:14:28Z"
}"""
response_loaded_json = json.loads(response_body_json)
response_from_json = thousandeyes_sdk.dashboards.models.ApiDashboard.from_json(response_body_json)
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
def test_get_dashboard_widget_data_models_validation(self) -> None:
"""Test case for get_dashboard_widget_data request and response models"""
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,
"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.0,
"value" : 100.0,
"startDate" : "2023-05-16T10:14:28Z",
"timestamp" : 1567620000,
"status" : "No data"
}, {
"numberOfDataPoints" : 24192,
"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.0,
"value" : 100.0,
"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.0,
"timestamp" : 1567620000
}, {
"numberOfDataPoints" : 23304,
"groups" : [ {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
}, {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
} ],
"value" : 100.0,
"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.0,
"timestamp" : 1567620000
}, {
"numberOfDataPoints" : 23304,
"groups" : [ {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
}, {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
} ],
"value" : 100.0,
"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.0,
"timestamp" : 1567620000
}, {
"numberOfDataPoints" : 23304,
"groups" : [ {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
}, {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
} ],
"value" : 100.0,
"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" : {
"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"
}
},
"binSize" : 3600,
"startDate" : "2022-07-17T22:00:54Z"
}"""
response_loaded_json = json.loads(response_body_json)
response_from_json = thousandeyes_sdk.dashboards.models.ApiWidgetDataResponse.from_json(response_body_json)
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
def test_get_dashboards_models_validation(self) -> None:
"""Test case for get_dashboards request and response models"""
response_body_json = """
[ {
"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"
}
},
"dashboardModifiedBy" : "1",
"migratedReport" : false,
"isDefaultForAccount" : false,
"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.0,
"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.0,
"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"
} ],
"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"
},
"globalFilterId" : "65babd9bb90bf55b17c96c8d",
"accountId" : 1234,
"apiLink" : [ {
"key" : ""
}, {
"key" : ""
} ],
"dashboardId" : "5e1f7a99143ae6004fdc3bb4",
"createdBy" : 1,
"globalOverride" : true,
"modifiedDate" : "2023-05-16 10:14:28",
"modifiedBy" : 1,
"isGlobalOverride" : true,
"aid" : "1234",
"dashboardModifiedDate" : "2023-05-16T10:14:28Z"
}, {
"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"
}
},
"dashboardModifiedBy" : "1",
"migratedReport" : false,
"isDefaultForAccount" : false,
"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.0,
"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.0,
"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"
} ],
"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"
},
"globalFilterId" : "65babd9bb90bf55b17c96c8d",
"accountId" : 1234,
"apiLink" : [ {
"key" : ""
}, {
"key" : ""
} ],
"dashboardId" : "5e1f7a99143ae6004fdc3bb4",
"createdBy" : 1,
"globalOverride" : true,
"modifiedDate" : "2023-05-16 10:14:28",
"modifiedBy" : 1,
"isGlobalOverride" : true,
"aid" : "1234",
"dashboardModifiedDate" : "2023-05-16T10:14:28Z"
} ]"""
response_loaded_json = json.loads(response_body_json)
response_from_dict = [thousandeyes_sdk.dashboards.models.ApiDashboard.from_dict(value) for value in response_loaded_json]
self.assertGreater(response_from_dict.__len__(), 0)
for index, element in enumerate(response_from_dict):
self.assertIsNotNone(element)
assert_constructed_model_matches_example_json(element, response_loaded_json[index])
def test_get_individual_card_data_models_validation(self) -> None:
"""Test case for get_individual_card_data request and response models"""
response_body_json = """
{
"numberOfDataPoints" : 24192,
"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.0,
"value" : 100.0,
"startDate" : "2023-05-16T10:14:28Z",
"timestamp" : 1567620000,
"status" : "No data"
}"""
response_loaded_json = json.loads(response_body_json)
response_from_json = thousandeyes_sdk.dashboards.models.ApiNumbersCardData.from_json(response_body_json)
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
def test_get_individual_column_data_models_validation(self) -> None:
"""Test case for get_individual_column_data request and response models"""
response_body_json = """
{
"_links" : {
"self" : {
"hreflang" : "hreflang",
"templated" : true,
"profile" : "profile",
"name" : "name",
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
"type" : "type",
"deprecation" : "deprecation",
"title" : "title"
}
},
"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.0,
"timestamp" : 1567620000
}, {
"numberOfDataPoints" : 23304,
"groups" : [ {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
}, {
"groupProperty" : "COUNTRY",
"groupValue" : "US"
} ],
"value" : 100.0,
"timestamp" : 1567620000
} ],
"status" : "No data"
}"""
response_loaded_json = json.loads(response_body_json)
response_from_json = thousandeyes_sdk.dashboards.models.ApiMultiMetricColumnData.from_json(response_body_json)
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
def test_update_dashboard_models_validation(self) -> None:
"""Test case for update_dashboard request and response models"""
request_body_json = """
{
"isMigratedReport" : false,
"_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"
}
},
"isDefaultForAccount" : false,
"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.0,
"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.0,
"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"
} ],
"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"
},
"globalFilterId" : "65babd9bb90bf55b17c96c8d",
"dashboardId" : "5e1f7a99143ae6004fdc3bb4",
"createdBy" : "1",
"modifiedDate" : "2023-05-16T10:14:28Z",
"modifiedBy" : "1",
"isGlobalOverride" : true,
"aid" : "1234"
}"""
request_loaded_json = json.loads(request_body_json)
request_from_json = thousandeyes_sdk.dashboards.models.Dashboard.from_json(request_body_json)
assert_constructed_model_matches_example_json(request_from_json, request_loaded_json)
response_body_json = """
{
"isMigratedReport" : false,
"_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"
}
},
"isDefaultForAccount" : false,
"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.0,
"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.0,
"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"
} ],
"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"
},
"globalFilterId" : "65babd9bb90bf55b17c96c8d",
"dashboardId" : "5e1f7a99143ae6004fdc3bb4",
"createdBy" : "1",
"modifiedDate" : "2023-05-16T10:14:28Z",
"modifiedBy" : "1",
"isGlobalOverride" : true,
"aid" : "1234"
}"""
response_loaded_json = json.loads(response_body_json)
response_from_json = thousandeyes_sdk.dashboards.models.Dashboard.from_json(response_body_json)
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
if __name__ == '__main__':
unittest.main()