thousandeyes-sdk-python/thousandeyes-sdk-tests/test/test_bgp_tests_api.py
2024-09-25 12:41:31 +00:00

522 lines
22 KiB
Python

# coding: utf-8
"""
Tests API
This API supports listing, creating, editing, and deleting Cloud and Enterprise Agent (CEA) based tests.
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import json
import unittest
import thousandeyes_sdk.tests.models
from .test_utils import assert_constructed_model_matches_example_json
from thousandeyes_sdk.tests.api.bgp_tests_api import BGPTestsApi
class TestBGPTestsApi(unittest.TestCase):
"""BGPTestsApi unit test stubs"""
def setUp(self) -> None:
self.api = BGPTestsApi()
def tearDown(self) -> None:
pass
def test_create_bgp_test_models_validation(self) -> None:
"""Test case for create_bgp_test request and response models"""
request_body_json = """
{
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"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"
}
},
"liveShare" : false,
"prefix" : "prefix",
"savedEvent" : true,
"includeCoveredPrefixes" : true,
"alertRules" : [ "344753", "212697" ],
"description" : "ThousandEyes Test",
"type" : "bgp",
"usePublicBgp" : true,
"enabled" : true,
"labels" : [ "9842", "1283" ],
"createdDate" : "2022-07-17T22:00:54Z",
"createdBy" : "user@user.com",
"modifiedDate" : "2022-07-17T22:00:54Z",
"modifiedBy" : "user@user.com",
"testId" : "281474976710706",
"sharedWithAccounts" : [ "1234", "12345" ],
"alertsEnabled" : true,
"testName" : "ThousandEyes Test",
"monitors" : [ "17410", "5" ]
}"""
request_loaded_json = json.loads(request_body_json)
request_from_json = thousandeyes_sdk.tests.models.BgpTestRequest.from_json(request_body_json)
assert_constructed_model_matches_example_json(request_from_json, request_loaded_json)
response_body_json = """
{
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"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"
}
},
"liveShare" : false,
"prefix" : "prefix",
"savedEvent" : true,
"includeCoveredPrefixes" : true,
"alertRules" : [ {
"severity" : "major",
"expression" : "((hops((hopDelay >= 100 ms))))",
"alertType" : "http-server",
"roundsViolatingMode" : "exact",
"sensitivityLevel" : "medium",
"roundsViolatingOutOf" : 5,
"roundsViolatingRequired" : 2,
"isDefault" : true,
"minimumSourcesPct" : 99,
"ruleName" : "The End of the Internet",
"minimumSources" : 10,
"ruleId" : "127094",
"direction" : "to-target"
}, {
"severity" : "major",
"expression" : "((hops((hopDelay >= 100 ms))))",
"alertType" : "http-server",
"roundsViolatingMode" : "exact",
"sensitivityLevel" : "medium",
"roundsViolatingOutOf" : 5,
"roundsViolatingRequired" : 2,
"isDefault" : true,
"minimumSourcesPct" : 99,
"ruleName" : "The End of the Internet",
"minimumSources" : 10,
"ruleId" : "127094",
"direction" : "to-target"
} ],
"description" : "ThousandEyes Test",
"type" : "bgp",
"usePublicBgp" : true,
"enabled" : true,
"labels" : [ {
"labelId" : "961",
"name" : "Artem label",
"isBuiltin" : false
}, {
"labelId" : "961",
"name" : "Artem label",
"isBuiltin" : false
} ],
"createdDate" : "2022-07-17T22:00:54Z",
"createdBy" : "user@user.com",
"modifiedDate" : "2022-07-17T22:00:54Z",
"modifiedBy" : "user@user.com",
"testId" : "281474976710706",
"sharedWithAccounts" : [ {
"name" : "Account name",
"aid" : "1234"
}, {
"name" : "Account name",
"aid" : "1234"
} ],
"alertsEnabled" : true,
"testName" : "ThousandEyes Test",
"monitors" : [ {
"monitorType" : "public",
"monitorId" : "1234",
"monitorName" : "Seattle, WA",
"ipAddress" : "4.69.184.193",
"countryId" : "GB",
"network" : "Level 3 Communications, Inc. (AS 3356)"
}, {
"monitorType" : "public",
"monitorId" : "1234",
"monitorName" : "Seattle, WA",
"ipAddress" : "4.69.184.193",
"countryId" : "GB",
"network" : "Level 3 Communications, Inc. (AS 3356)"
} ]
}"""
response_loaded_json = json.loads(response_body_json)
response_from_json = thousandeyes_sdk.tests.models.BgpTestResponse.from_json(response_body_json)
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
def test_delete_bgp_test_models_validation(self) -> None:
"""Test case for delete_bgp_test request and response models"""
def test_get_bgp_test_models_validation(self) -> None:
"""Test case for get_bgp_test request and response models"""
response_body_json = """
{
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"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"
}
},
"liveShare" : false,
"prefix" : "prefix",
"savedEvent" : true,
"includeCoveredPrefixes" : true,
"alertRules" : [ {
"severity" : "major",
"expression" : "((hops((hopDelay >= 100 ms))))",
"alertType" : "http-server",
"roundsViolatingMode" : "exact",
"sensitivityLevel" : "medium",
"roundsViolatingOutOf" : 5,
"roundsViolatingRequired" : 2,
"isDefault" : true,
"minimumSourcesPct" : 99,
"ruleName" : "The End of the Internet",
"minimumSources" : 10,
"ruleId" : "127094",
"direction" : "to-target"
}, {
"severity" : "major",
"expression" : "((hops((hopDelay >= 100 ms))))",
"alertType" : "http-server",
"roundsViolatingMode" : "exact",
"sensitivityLevel" : "medium",
"roundsViolatingOutOf" : 5,
"roundsViolatingRequired" : 2,
"isDefault" : true,
"minimumSourcesPct" : 99,
"ruleName" : "The End of the Internet",
"minimumSources" : 10,
"ruleId" : "127094",
"direction" : "to-target"
} ],
"description" : "ThousandEyes Test",
"type" : "bgp",
"usePublicBgp" : true,
"enabled" : true,
"labels" : [ {
"labelId" : "961",
"name" : "Artem label",
"isBuiltin" : false
}, {
"labelId" : "961",
"name" : "Artem label",
"isBuiltin" : false
} ],
"createdDate" : "2022-07-17T22:00:54Z",
"createdBy" : "user@user.com",
"modifiedDate" : "2022-07-17T22:00:54Z",
"modifiedBy" : "user@user.com",
"testId" : "281474976710706",
"sharedWithAccounts" : [ {
"name" : "Account name",
"aid" : "1234"
}, {
"name" : "Account name",
"aid" : "1234"
} ],
"alertsEnabled" : true,
"testName" : "ThousandEyes Test",
"monitors" : [ {
"monitorType" : "public",
"monitorId" : "1234",
"monitorName" : "Seattle, WA",
"ipAddress" : "4.69.184.193",
"countryId" : "GB",
"network" : "Level 3 Communications, Inc. (AS 3356)"
}, {
"monitorType" : "public",
"monitorId" : "1234",
"monitorName" : "Seattle, WA",
"ipAddress" : "4.69.184.193",
"countryId" : "GB",
"network" : "Level 3 Communications, Inc. (AS 3356)"
} ]
}"""
response_loaded_json = json.loads(response_body_json)
response_from_json = thousandeyes_sdk.tests.models.BgpTestResponse.from_json(response_body_json)
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
def test_get_bgp_tests_models_validation(self) -> None:
"""Test case for get_bgp_tests request and response models"""
response_body_json = """
{
"tests" : [ {
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"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"
}
},
"liveShare" : false,
"prefix" : "prefix",
"savedEvent" : true,
"includeCoveredPrefixes" : true,
"description" : "ThousandEyes Test",
"type" : "bgp",
"usePublicBgp" : true,
"enabled" : true,
"createdDate" : "2022-07-17T22:00:54Z",
"createdBy" : "user@user.com",
"modifiedDate" : "2022-07-17T22:00:54Z",
"modifiedBy" : "user@user.com",
"testId" : "281474976710706",
"alertsEnabled" : true,
"testName" : "ThousandEyes Test"
}, {
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"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"
}
},
"liveShare" : false,
"prefix" : "prefix",
"savedEvent" : true,
"includeCoveredPrefixes" : true,
"description" : "ThousandEyes Test",
"type" : "bgp",
"usePublicBgp" : true,
"enabled" : true,
"createdDate" : "2022-07-17T22:00:54Z",
"createdBy" : "user@user.com",
"modifiedDate" : "2022-07-17T22:00:54Z",
"modifiedBy" : "user@user.com",
"testId" : "281474976710706",
"alertsEnabled" : true,
"testName" : "ThousandEyes Test"
} ],
"_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"
}
}
}"""
response_loaded_json = json.loads(response_body_json)
response_from_json = thousandeyes_sdk.tests.models.BgpTests.from_json(response_body_json)
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
def test_update_bgp_test_models_validation(self) -> None:
"""Test case for update_bgp_test request and response models"""
request_body_json = """
{
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"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"
}
},
"liveShare" : false,
"savedEvent" : true,
"includeCoveredPrefixes" : true,
"alertRules" : [ "344753", "212697" ],
"description" : "ThousandEyes Test",
"type" : "bgp",
"usePublicBgp" : true,
"enabled" : true,
"labels" : [ "9842", "1283" ],
"createdDate" : "2022-07-17T22:00:54Z",
"createdBy" : "user@user.com",
"modifiedDate" : "2022-07-17T22:00:54Z",
"modifiedBy" : "user@user.com",
"testId" : "281474976710706",
"sharedWithAccounts" : [ "1234", "12345" ],
"alertsEnabled" : true,
"testName" : "ThousandEyes Test",
"monitors" : [ "17410", "5" ]
}"""
request_loaded_json = json.loads(request_body_json)
request_from_json = thousandeyes_sdk.tests.models.UpdateBgpTestRequest.from_json(request_body_json)
assert_constructed_model_matches_example_json(request_from_json, request_loaded_json)
response_body_json = """
{
"_links" : {
"testResults" : [ {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
}, {
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
} ],
"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"
}
},
"liveShare" : false,
"prefix" : "prefix",
"savedEvent" : true,
"includeCoveredPrefixes" : true,
"alertRules" : [ {
"severity" : "major",
"expression" : "((hops((hopDelay >= 100 ms))))",
"alertType" : "http-server",
"roundsViolatingMode" : "exact",
"sensitivityLevel" : "medium",
"roundsViolatingOutOf" : 5,
"roundsViolatingRequired" : 2,
"isDefault" : true,
"minimumSourcesPct" : 99,
"ruleName" : "The End of the Internet",
"minimumSources" : 10,
"ruleId" : "127094",
"direction" : "to-target"
}, {
"severity" : "major",
"expression" : "((hops((hopDelay >= 100 ms))))",
"alertType" : "http-server",
"roundsViolatingMode" : "exact",
"sensitivityLevel" : "medium",
"roundsViolatingOutOf" : 5,
"roundsViolatingRequired" : 2,
"isDefault" : true,
"minimumSourcesPct" : 99,
"ruleName" : "The End of the Internet",
"minimumSources" : 10,
"ruleId" : "127094",
"direction" : "to-target"
} ],
"description" : "ThousandEyes Test",
"type" : "bgp",
"usePublicBgp" : true,
"enabled" : true,
"labels" : [ {
"labelId" : "961",
"name" : "Artem label",
"isBuiltin" : false
}, {
"labelId" : "961",
"name" : "Artem label",
"isBuiltin" : false
} ],
"createdDate" : "2022-07-17T22:00:54Z",
"createdBy" : "user@user.com",
"modifiedDate" : "2022-07-17T22:00:54Z",
"modifiedBy" : "user@user.com",
"testId" : "281474976710706",
"sharedWithAccounts" : [ {
"name" : "Account name",
"aid" : "1234"
}, {
"name" : "Account name",
"aid" : "1234"
} ],
"alertsEnabled" : true,
"testName" : "ThousandEyes Test",
"monitors" : [ {
"monitorType" : "public",
"monitorId" : "1234",
"monitorName" : "Seattle, WA",
"ipAddress" : "4.69.184.193",
"countryId" : "GB",
"network" : "Level 3 Communications, Inc. (AS 3356)"
}, {
"monitorType" : "public",
"monitorId" : "1234",
"monitorName" : "Seattle, WA",
"ipAddress" : "4.69.184.193",
"countryId" : "GB",
"network" : "Level 3 Communications, Inc. (AS 3356)"
} ]
}"""
response_loaded_json = json.loads(response_body_json)
response_from_json = thousandeyes_sdk.tests.models.BgpTestResponse.from_json(response_body_json)
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
if __name__ == '__main__':
unittest.main()