# coding: utf-8 """ Tests API **Note:** The Page Load Tests, API Tests, and Web Transaction Tests APIs are not available for ThousandEyes for Government instance. This API allows you to list, create, edit, and delete Network and Application Synthetics 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 thousandeyes_sdk.core.exceptions import ApiException from thousandeyes_sdk.tests.api.path_visualization_interface_groups_api import PathVisualizationInterfaceGroupsApi from .integration_test_utils import IntegrationTestBase from .test_utils import assert_constructed_model_matches_example_json class TestPathVisualizationInterfaceGroupsApiIntegration(IntegrationTestBase): """PathVisualizationInterfaceGroupsApi integration test stubs""" def setUp(self) -> None: super().setUp() self.api = PathVisualizationInterfaceGroupsApi(self.api_client) def test_create_path_vis_interface_groups_happy_path(self) -> None: """Integration test for create_path_vis_interface_groups success path""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) aid = '1234' response_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ expected_response = json.loads(response_body_json) response = self.api.create_path_vis_interface_groups( interface_group=interface_group, aid=aid, _headers=self.te_headers("create_path_vis_interface_groups"), ) assert_constructed_model_matches_example_json(response, expected_response) def test_create_path_vis_interface_groups_error_400(self) -> None: """Integration test for create_path_vis_interface_groups error path (HTTP 400)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.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_path_vis_interface_groups( interface_group=interface_group, aid=aid, _headers=self.te_headers("create_path_vis_interface_groups", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_create_path_vis_interface_groups_error_401(self) -> None: """Integration test for create_path_vis_interface_groups error path (HTTP 401)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.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_path_vis_interface_groups( interface_group=interface_group, aid=aid, _headers=self.te_headers("create_path_vis_interface_groups", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_create_path_vis_interface_groups_error_403(self) -> None: """Integration test for create_path_vis_interface_groups error path (HTTP 403)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(403) ) as context: self.api.create_path_vis_interface_groups( interface_group=interface_group, aid=aid, _headers=self.te_headers("create_path_vis_interface_groups", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_create_path_vis_interface_groups_error_404(self) -> None: """Integration test for create_path_vis_interface_groups error path (HTTP 404)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(404) ) as context: self.api.create_path_vis_interface_groups( interface_group=interface_group, aid=aid, _headers=self.te_headers("create_path_vis_interface_groups", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_create_path_vis_interface_groups_error_429(self) -> None: """Integration test for create_path_vis_interface_groups error path (HTTP 429)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(429) ) as context: self.api.create_path_vis_interface_groups( interface_group=interface_group, aid=aid, _headers=self.te_headers("create_path_vis_interface_groups", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_create_path_vis_interface_groups_error_500(self) -> None: """Integration test for create_path_vis_interface_groups error path (HTTP 500)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(500) ) as context: self.api.create_path_vis_interface_groups( interface_group=interface_group, aid=aid, _headers=self.te_headers("create_path_vis_interface_groups", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_create_path_vis_interface_groups_error_502(self) -> None: """Integration test for create_path_vis_interface_groups error path (HTTP 502)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(502) ) as context: self.api.create_path_vis_interface_groups( interface_group=interface_group, aid=aid, _headers=self.te_headers("create_path_vis_interface_groups", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_delete_path_vis_interface_group_happy_path(self) -> None: """Integration test for delete_path_vis_interface_group success path""" interface_group_id = '281474976710706' aid = '1234' response = self.api.delete_path_vis_interface_group_with_http_info( interface_group_id=interface_group_id, aid=aid, _headers=self.te_headers("delete_path_vis_interface_group"), ) self.assertEqual(204, response.status_code) self.assertIsNone(response.data) def test_delete_path_vis_interface_group_error_401(self) -> None: """Integration test for delete_path_vis_interface_group error path (HTTP 401)""" interface_group_id = '281474976710706' 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_path_vis_interface_group( interface_group_id=interface_group_id, aid=aid, _headers=self.te_headers("delete_path_vis_interface_group", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_delete_path_vis_interface_group_error_403(self) -> None: """Integration test for delete_path_vis_interface_group error path (HTTP 403)""" interface_group_id = '281474976710706' aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(403) ) as context: self.api.delete_path_vis_interface_group( interface_group_id=interface_group_id, aid=aid, _headers=self.te_headers("delete_path_vis_interface_group", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_delete_path_vis_interface_group_error_404(self) -> None: """Integration test for delete_path_vis_interface_group error path (HTTP 404)""" interface_group_id = '281474976710706' aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(404) ) as context: self.api.delete_path_vis_interface_group( interface_group_id=interface_group_id, aid=aid, _headers=self.te_headers("delete_path_vis_interface_group", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_delete_path_vis_interface_group_error_429(self) -> None: """Integration test for delete_path_vis_interface_group error path (HTTP 429)""" interface_group_id = '281474976710706' aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(429) ) as context: self.api.delete_path_vis_interface_group( interface_group_id=interface_group_id, aid=aid, _headers=self.te_headers("delete_path_vis_interface_group", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_delete_path_vis_interface_group_error_500(self) -> None: """Integration test for delete_path_vis_interface_group error path (HTTP 500)""" interface_group_id = '281474976710706' aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(500) ) as context: self.api.delete_path_vis_interface_group( interface_group_id=interface_group_id, aid=aid, _headers=self.te_headers("delete_path_vis_interface_group", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_delete_path_vis_interface_group_error_502(self) -> None: """Integration test for delete_path_vis_interface_group error path (HTTP 502)""" interface_group_id = '281474976710706' aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(502) ) as context: self.api.delete_path_vis_interface_group( interface_group_id=interface_group_id, aid=aid, _headers=self.te_headers("delete_path_vis_interface_group", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_get_path_vis_interface_groups_happy_path(self) -> None: """Integration test for get_path_vis_interface_groups success path""" aid = '1234' response_body_json = """ { "pathVisInterfaceGroups" : [ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" }, { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } ], "_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.get_path_vis_interface_groups( aid=aid, _headers=self.te_headers("get_path_vis_interface_groups"), ) assert_constructed_model_matches_example_json(response, expected_response) def test_get_path_vis_interface_groups_error_401(self) -> None: """Integration test for get_path_vis_interface_groups error path (HTTP 401)""" aid = '1234' error_body_json = """ { "error_description" : "Invalid access token", "error" : "invalid_token" } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(401) ) as context: self.api.get_path_vis_interface_groups( aid=aid, _headers=self.te_headers("get_path_vis_interface_groups", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_get_path_vis_interface_groups_error_403(self) -> None: """Integration test for get_path_vis_interface_groups error path (HTTP 403)""" aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(403) ) as context: self.api.get_path_vis_interface_groups( aid=aid, _headers=self.te_headers("get_path_vis_interface_groups", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_get_path_vis_interface_groups_error_404(self) -> None: """Integration test for get_path_vis_interface_groups error path (HTTP 404)""" aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(404) ) as context: self.api.get_path_vis_interface_groups( aid=aid, _headers=self.te_headers("get_path_vis_interface_groups", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_get_path_vis_interface_groups_error_429(self) -> None: """Integration test for get_path_vis_interface_groups error path (HTTP 429)""" aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(429) ) as context: self.api.get_path_vis_interface_groups( aid=aid, _headers=self.te_headers("get_path_vis_interface_groups", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_get_path_vis_interface_groups_error_500(self) -> None: """Integration test for get_path_vis_interface_groups error path (HTTP 500)""" aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(500) ) as context: self.api.get_path_vis_interface_groups( aid=aid, _headers=self.te_headers("get_path_vis_interface_groups", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_get_path_vis_interface_groups_error_502(self) -> None: """Integration test for get_path_vis_interface_groups error path (HTTP 502)""" aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(502) ) as context: self.api.get_path_vis_interface_groups( aid=aid, _headers=self.te_headers("get_path_vis_interface_groups", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_update_path_vis_interface_group_happy_path(self) -> None: """Integration test for update_path_vis_interface_group success path""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) interface_group_id = '281474976710706' aid = '1234' response_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ expected_response = json.loads(response_body_json) response = self.api.update_path_vis_interface_group( interface_group_id=interface_group_id, interface_group=interface_group, aid=aid, _headers=self.te_headers("update_path_vis_interface_group"), ) assert_constructed_model_matches_example_json(response, expected_response) def test_update_path_vis_interface_group_error_400(self) -> None: """Integration test for update_path_vis_interface_group error path (HTTP 400)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) interface_group_id = '281474976710706' 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_path_vis_interface_group( interface_group_id=interface_group_id, interface_group=interface_group, aid=aid, _headers=self.te_headers("update_path_vis_interface_group", error_status="400"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_update_path_vis_interface_group_error_401(self) -> None: """Integration test for update_path_vis_interface_group error path (HTTP 401)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) interface_group_id = '281474976710706' 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_path_vis_interface_group( interface_group_id=interface_group_id, interface_group=interface_group, aid=aid, _headers=self.te_headers("update_path_vis_interface_group", error_status="401"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_update_path_vis_interface_group_error_403(self) -> None: """Integration test for update_path_vis_interface_group error path (HTTP 403)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) interface_group_id = '281474976710706' aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(403) ) as context: self.api.update_path_vis_interface_group( interface_group_id=interface_group_id, interface_group=interface_group, aid=aid, _headers=self.te_headers("update_path_vis_interface_group", error_status="403"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_update_path_vis_interface_group_error_404(self) -> None: """Integration test for update_path_vis_interface_group error path (HTTP 404)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) interface_group_id = '281474976710706' aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(404) ) as context: self.api.update_path_vis_interface_group( interface_group_id=interface_group_id, interface_group=interface_group, aid=aid, _headers=self.te_headers("update_path_vis_interface_group", error_status="404"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_update_path_vis_interface_group_error_429(self) -> None: """Integration test for update_path_vis_interface_group error path (HTTP 429)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) interface_group_id = '281474976710706' aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(429) ) as context: self.api.update_path_vis_interface_group( interface_group_id=interface_group_id, interface_group=interface_group, aid=aid, _headers=self.te_headers("update_path_vis_interface_group", error_status="429"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_update_path_vis_interface_group_error_500(self) -> None: """Integration test for update_path_vis_interface_group error path (HTTP 500)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) interface_group_id = '281474976710706' aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(500) ) as context: self.api.update_path_vis_interface_group( interface_group_id=interface_group_id, interface_group=interface_group, aid=aid, _headers=self.te_headers("update_path_vis_interface_group", error_status="500"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) def test_update_path_vis_interface_group_error_502(self) -> None: """Integration test for update_path_vis_interface_group error path (HTTP 502)""" request_body_json = """ { "groupName" : "PathVis Interface Group", "rdnsRegexes" : [ "aggr403b-1.iad3.rackspace.net", "aggr403c-1.iad3.rackspace.net" ], "groupId" : "281474976710706", "ipAddresses" : [ "1.1.1.1", "8.8.8.8" ], "aid" : "1234" } """ interface_group = thousandeyes_sdk.tests.models.InterfaceGroup.from_json(request_body_json) interface_group_id = '281474976710706' aid = '1234' error_body_json = """ { "instance" : "instance", "detail" : "detail", "type" : "type", "title" : "title", "status" : 0 } """ expected_error = json.loads(error_body_json) with self.assertRaises( ApiException.exception_class_for_http_status(502) ) as context: self.api.update_path_vis_interface_group( interface_group_id=interface_group_id, interface_group=interface_group, aid=aid, _headers=self.te_headers("update_path_vis_interface_group", error_status="502"), ) assert_constructed_model_matches_example_json(context.exception.data, expected_error) if __name__ == '__main__': unittest.main()