# coding: utf-8

"""
    Endpoint Tests API

    Manage endpoint agent dynamic and scheduled tests using the Endpoint Tests API. 

    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


import json
import unittest
import thousandeyes_sdk.endpoint_tests.models

from thousandeyes_sdk.core.exceptions import ApiException
from thousandeyes_sdk.endpoint_tests.api.agent_to_server_endpoint_dynamic_tests_api import AgentToServerEndpointDynamicTestsApi
from .integration_test_utils import IntegrationTestBase
from .test_utils import assert_constructed_model_matches_example_json


class TestAgentToServerEndpointDynamicTestsApiIntegration(IntegrationTestBase):
    """AgentToServerEndpointDynamicTestsApi integration test stubs"""

    def setUp(self) -> None:
        super().setUp()
        self.api = AgentToServerEndpointDynamicTestsApi(self.api_client)


    def test_create_agent_to_server_endpoint_dynamic_test_happy_path(self) -> None:
        """Integration test for create_agent_to_server_endpoint_dynamic_test success path"""
        request_body_json = """
        
                {
                  "agentSelectorType" : "all-agents",
                  "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
                  "isPrioritized" : false,
                  "maxMachines" : 25,
                  "endpointAgentLabels" : [ "567", "214" ],
                  "tcpProbeMode" : "auto",
                  "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
                  "protocol" : "icmp",
                  "ipVersion" : "V4_ONLY",
                  "application" : "webex",
                  "interval" : 60,
                  "hasPathTraceInSession" : true,
                  "testName" : "Test name"
                }
        
                """
        dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.from_json(request_body_json)
        aid = '1234'
        response_body_json = """
                {
                  "hasPing" : true,
                  "_links" : {
                    "testResults" : [ {
                      "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter"
                    }, {
                      "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis"
                    } ],
                    "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"
                    }
                  },
                  "isPrioritized" : false,
                  "networkMeasurements" : true,
                  "tcpProbeMode" : "auto",
                  "labels" : [ {
                    "labelId" : "961",
                    "name" : "Artem label",
                    "isBuiltin" : false
                  }, {
                    "labelId" : "961",
                    "name" : "Artem label",
                    "isBuiltin" : false
                  } ],
                  "protocol" : "icmp",
                  "createdDate" : "2022-07-17T22:00:54Z",
                  "ipVersion" : "V4_ONLY",
                  "application" : "webex",
                  "hasTraceroute" : true,
                  "isEnabled" : true,
                  "modifiedDate" : "2022-07-17T22:00:54Z",
                  "interval" : 60,
                  "testId" : "281474976710706",
                  "aid" : "1234",
                  "agentSelectorConfig" : {
                    "agentSelectorType" : "all-agents",
                    "maxMachines" : 25
                  },
                  "hasPathTraceInSession" : true,
                  "testName" : "Test name"
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.create_agent_to_server_endpoint_dynamic_test(

            dynamic_test_request=dynamic_test_request,

            aid=aid,

            _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test"),
        )
        assert_constructed_model_matches_example_json(response, expected_response)


    def test_create_agent_to_server_endpoint_dynamic_test_error_400(self) -> None:
        """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 400)"""
        request_body_json = """
        
                {
                  "agentSelectorType" : "all-agents",
                  "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
                  "isPrioritized" : false,
                  "maxMachines" : 25,
                  "endpointAgentLabels" : [ "567", "214" ],
                  "tcpProbeMode" : "auto",
                  "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
                  "protocol" : "icmp",
                  "ipVersion" : "V4_ONLY",
                  "application" : "webex",
                  "interval" : 60,
                  "hasPathTraceInSession" : true,
                  "testName" : "Test name"
                }
        
                """
        dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_agent_to_server_endpoint_dynamic_test(

                dynamic_test_request=dynamic_test_request,

                aid=aid,

                _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="400"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_create_agent_to_server_endpoint_dynamic_test_error_401(self) -> None:
        """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "agentSelectorType" : "all-agents",
                  "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
                  "isPrioritized" : false,
                  "maxMachines" : 25,
                  "endpointAgentLabels" : [ "567", "214" ],
                  "tcpProbeMode" : "auto",
                  "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
                  "protocol" : "icmp",
                  "ipVersion" : "V4_ONLY",
                  "application" : "webex",
                  "interval" : 60,
                  "hasPathTraceInSession" : true,
                  "testName" : "Test name"
                }
        
                """
        dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_agent_to_server_endpoint_dynamic_test(

                dynamic_test_request=dynamic_test_request,

                aid=aid,

                _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="401"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_create_agent_to_server_endpoint_dynamic_test_error_403(self) -> None:
        """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "agentSelectorType" : "all-agents",
                  "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
                  "isPrioritized" : false,
                  "maxMachines" : 25,
                  "endpointAgentLabels" : [ "567", "214" ],
                  "tcpProbeMode" : "auto",
                  "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
                  "protocol" : "icmp",
                  "ipVersion" : "V4_ONLY",
                  "application" : "webex",
                  "interval" : 60,
                  "hasPathTraceInSession" : true,
                  "testName" : "Test name"
                }
        
                """
        dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_agent_to_server_endpoint_dynamic_test(

                dynamic_test_request=dynamic_test_request,

                aid=aid,

                _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="403"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_create_agent_to_server_endpoint_dynamic_test_error_404(self) -> None:
        """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "agentSelectorType" : "all-agents",
                  "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
                  "isPrioritized" : false,
                  "maxMachines" : 25,
                  "endpointAgentLabels" : [ "567", "214" ],
                  "tcpProbeMode" : "auto",
                  "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
                  "protocol" : "icmp",
                  "ipVersion" : "V4_ONLY",
                  "application" : "webex",
                  "interval" : 60,
                  "hasPathTraceInSession" : true,
                  "testName" : "Test name"
                }
        
                """
        dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_agent_to_server_endpoint_dynamic_test(

                dynamic_test_request=dynamic_test_request,

                aid=aid,

                _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="404"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_create_agent_to_server_endpoint_dynamic_test_error_429(self) -> None:
        """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "agentSelectorType" : "all-agents",
                  "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
                  "isPrioritized" : false,
                  "maxMachines" : 25,
                  "endpointAgentLabels" : [ "567", "214" ],
                  "tcpProbeMode" : "auto",
                  "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
                  "protocol" : "icmp",
                  "ipVersion" : "V4_ONLY",
                  "application" : "webex",
                  "interval" : 60,
                  "hasPathTraceInSession" : true,
                  "testName" : "Test name"
                }
        
                """
        dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_agent_to_server_endpoint_dynamic_test(

                dynamic_test_request=dynamic_test_request,

                aid=aid,

                _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="429"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_create_agent_to_server_endpoint_dynamic_test_error_500(self) -> None:
        """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "agentSelectorType" : "all-agents",
                  "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
                  "isPrioritized" : false,
                  "maxMachines" : 25,
                  "endpointAgentLabels" : [ "567", "214" ],
                  "tcpProbeMode" : "auto",
                  "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
                  "protocol" : "icmp",
                  "ipVersion" : "V4_ONLY",
                  "application" : "webex",
                  "interval" : 60,
                  "hasPathTraceInSession" : true,
                  "testName" : "Test name"
                }
        
                """
        dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_agent_to_server_endpoint_dynamic_test(

                dynamic_test_request=dynamic_test_request,

                aid=aid,

                _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="500"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_create_agent_to_server_endpoint_dynamic_test_error_502(self) -> None:
        """Integration test for create_agent_to_server_endpoint_dynamic_test error path (HTTP 502)"""
        request_body_json = """
        
                {
                  "agentSelectorType" : "all-agents",
                  "tagIds" : [ "c6b78e57-81a2-4c5f-a11a-d96c3c664d55", "5aeab5d5-0d34-4d44-a7ac-fb440185295c" ],
                  "isPrioritized" : false,
                  "maxMachines" : 25,
                  "endpointAgentLabels" : [ "567", "214" ],
                  "tcpProbeMode" : "auto",
                  "agents" : [ "0a3b9998-dc3a-4ff2-b50d-ac4a7cd986e1", "66eec0f1-72b4-4755-aa83-3aed61d17f3c" ],
                  "protocol" : "icmp",
                  "ipVersion" : "V4_ONLY",
                  "application" : "webex",
                  "interval" : 60,
                  "hasPathTraceInSession" : true,
                  "testName" : "Test name"
                }
        
                """
        dynamic_test_request = thousandeyes_sdk.endpoint_tests.models.DynamicTestRequest.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_agent_to_server_endpoint_dynamic_test(

                dynamic_test_request=dynamic_test_request,

                aid=aid,

                _headers=self.te_headers("create_agent_to_server_endpoint_dynamic_test", error_status="502"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)




    def test_delete_agent_to_server_endpoint_dynamic_test_happy_path(self) -> None:
        """Integration test for delete_agent_to_server_endpoint_dynamic_test success path"""
        test_id = '584739201'
        aid = '1234'
        response = self.api.delete_agent_to_server_endpoint_dynamic_test_with_http_info(

            test_id=test_id,

            aid=aid,

            _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test"),
        )
        self.assertEqual(204, response.status_code)
        self.assertIsNone(response.data)


    def test_delete_agent_to_server_endpoint_dynamic_test_error_400(self) -> None:
        """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 400)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="400"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_delete_agent_to_server_endpoint_dynamic_test_error_401(self) -> None:
        """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 401)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="401"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_delete_agent_to_server_endpoint_dynamic_test_error_403(self) -> None:
        """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 403)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="403"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_delete_agent_to_server_endpoint_dynamic_test_error_404(self) -> None:
        """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 404)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="404"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_delete_agent_to_server_endpoint_dynamic_test_error_429(self) -> None:
        """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 429)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="429"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_delete_agent_to_server_endpoint_dynamic_test_error_500(self) -> None:
        """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 500)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="500"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_delete_agent_to_server_endpoint_dynamic_test_error_502(self) -> None:
        """Integration test for delete_agent_to_server_endpoint_dynamic_test error path (HTTP 502)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("delete_agent_to_server_endpoint_dynamic_test", error_status="502"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)




    def test_get_agent_to_server_endpoint_dynamic_test_happy_path(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_test success path"""
        test_id = '584739201'
        aid = '1234'
        response_body_json = """
                {
                  "hasPing" : true,
                  "_links" : {
                    "testResults" : [ {
                      "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter"
                    }, {
                      "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis"
                    } ],
                    "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"
                    }
                  },
                  "isPrioritized" : false,
                  "networkMeasurements" : true,
                  "tcpProbeMode" : "auto",
                  "labels" : [ {
                    "labelId" : "961",
                    "name" : "Artem label",
                    "isBuiltin" : false
                  }, {
                    "labelId" : "961",
                    "name" : "Artem label",
                    "isBuiltin" : false
                  } ],
                  "protocol" : "icmp",
                  "createdDate" : "2022-07-17T22:00:54Z",
                  "ipVersion" : "V4_ONLY",
                  "application" : "webex",
                  "hasTraceroute" : true,
                  "isEnabled" : true,
                  "modifiedDate" : "2022-07-17T22:00:54Z",
                  "interval" : 60,
                  "testId" : "281474976710706",
                  "aid" : "1234",
                  "agentSelectorConfig" : {
                    "agentSelectorType" : "all-agents",
                    "maxMachines" : 25
                  },
                  "hasPathTraceInSession" : true,
                  "testName" : "Test name"
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.get_agent_to_server_endpoint_dynamic_test(

            test_id=test_id,

            aid=aid,

            _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test"),
        )
        assert_constructed_model_matches_example_json(response, expected_response)


    def test_get_agent_to_server_endpoint_dynamic_test_error_401(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 401)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="401"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_get_agent_to_server_endpoint_dynamic_test_error_403(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 403)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="403"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_get_agent_to_server_endpoint_dynamic_test_error_404(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 404)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="404"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_get_agent_to_server_endpoint_dynamic_test_error_429(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 429)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="429"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_get_agent_to_server_endpoint_dynamic_test_error_500(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 500)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="500"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_get_agent_to_server_endpoint_dynamic_test_error_502(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_test error path (HTTP 502)"""
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                aid=aid,

                _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_test", error_status="502"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)




    def test_get_agent_to_server_endpoint_dynamic_tests_happy_path(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_tests success path"""
        aid = '1234'
        response_body_json = """
                {
                  "tests" : [ {
                    "hasPing" : true,
                    "_links" : {
                      "testResults" : [ {
                        "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter"
                      }, {
                        "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis"
                      } ],
                      "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"
                      }
                    },
                    "isPrioritized" : false,
                    "networkMeasurements" : true,
                    "tcpProbeMode" : "auto",
                    "labels" : [ {
                      "labelId" : "961",
                      "name" : "Artem label",
                      "isBuiltin" : false
                    }, {
                      "labelId" : "961",
                      "name" : "Artem label",
                      "isBuiltin" : false
                    } ],
                    "protocol" : "icmp",
                    "createdDate" : "2022-07-17T22:00:54Z",
                    "ipVersion" : "V4_ONLY",
                    "application" : "webex",
                    "hasTraceroute" : true,
                    "isEnabled" : true,
                    "modifiedDate" : "2022-07-17T22:00:54Z",
                    "interval" : 60,
                    "testId" : "281474976710706",
                    "aid" : "1234",
                    "agentSelectorConfig" : {
                      "agentSelectorType" : "all-agents",
                      "maxMachines" : 25
                    },
                    "hasPathTraceInSession" : true,
                    "testName" : "Test name"
                  }, {
                    "hasPing" : true,
                    "_links" : {
                      "testResults" : [ {
                        "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter"
                      }, {
                        "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis"
                      } ],
                      "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"
                      }
                    },
                    "isPrioritized" : false,
                    "networkMeasurements" : true,
                    "tcpProbeMode" : "auto",
                    "labels" : [ {
                      "labelId" : "961",
                      "name" : "Artem label",
                      "isBuiltin" : false
                    }, {
                      "labelId" : "961",
                      "name" : "Artem label",
                      "isBuiltin" : false
                    } ],
                    "protocol" : "icmp",
                    "createdDate" : "2022-07-17T22:00:54Z",
                    "ipVersion" : "V4_ONLY",
                    "application" : "webex",
                    "hasTraceroute" : true,
                    "isEnabled" : true,
                    "modifiedDate" : "2022-07-17T22:00:54Z",
                    "interval" : 60,
                    "testId" : "281474976710706",
                    "aid" : "1234",
                    "agentSelectorConfig" : {
                      "agentSelectorType" : "all-agents",
                      "maxMachines" : 25
                    },
                    "hasPathTraceInSession" : true,
                    "testName" : "Test name"
                  } ],
                  "_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_agent_to_server_endpoint_dynamic_tests(

            aid=aid,

            _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests"),
        )
        assert_constructed_model_matches_example_json(response, expected_response)


    def test_get_agent_to_server_endpoint_dynamic_tests_error_401(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_tests 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_agent_to_server_endpoint_dynamic_tests(

                aid=aid,

                _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="401"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_get_agent_to_server_endpoint_dynamic_tests_error_403(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_tests 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_agent_to_server_endpoint_dynamic_tests(

                aid=aid,

                _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="403"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_get_agent_to_server_endpoint_dynamic_tests_error_429(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_tests 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_agent_to_server_endpoint_dynamic_tests(

                aid=aid,

                _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="429"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_get_agent_to_server_endpoint_dynamic_tests_error_500(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_tests 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_agent_to_server_endpoint_dynamic_tests(

                aid=aid,

                _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="500"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_get_agent_to_server_endpoint_dynamic_tests_error_502(self) -> None:
        """Integration test for get_agent_to_server_endpoint_dynamic_tests 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_agent_to_server_endpoint_dynamic_tests(

                aid=aid,

                _headers=self.te_headers("get_agent_to_server_endpoint_dynamic_tests", error_status="502"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)




    def test_update_agent_to_server_endpoint_dynamic_test_happy_path(self) -> None:
        """Integration test for update_agent_to_server_endpoint_dynamic_test success path"""
        request_body_json = """
        
                {
                  "protocol" : "icmp",
                  "application" : "webex",
                  "isEnabled" : true,
                  "interval" : 60,
                  "tcpProbeMode" : "auto",
                  "testName" : "Test name"
                }
        
                """
        endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json)
        test_id = '584739201'
        aid = '1234'
        response_body_json = """
                {
                  "hasPing" : true,
                  "_links" : {
                    "testResults" : [ {
                      "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/network/filter"
                    }, {
                      "href" : "https://api.thousandeyes.com/v7/endpoint/test-results/dynamic-tests/281474976710706/pathvis"
                    } ],
                    "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"
                    }
                  },
                  "isPrioritized" : false,
                  "networkMeasurements" : true,
                  "tcpProbeMode" : "auto",
                  "labels" : [ {
                    "labelId" : "961",
                    "name" : "Artem label",
                    "isBuiltin" : false
                  }, {
                    "labelId" : "961",
                    "name" : "Artem label",
                    "isBuiltin" : false
                  } ],
                  "protocol" : "icmp",
                  "createdDate" : "2022-07-17T22:00:54Z",
                  "ipVersion" : "V4_ONLY",
                  "application" : "webex",
                  "hasTraceroute" : true,
                  "isEnabled" : true,
                  "modifiedDate" : "2022-07-17T22:00:54Z",
                  "interval" : 60,
                  "testId" : "281474976710706",
                  "aid" : "1234",
                  "agentSelectorConfig" : {
                    "agentSelectorType" : "all-agents",
                    "maxMachines" : 25
                  },
                  "hasPathTraceInSession" : true,
                  "testName" : "Test name"
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.update_agent_to_server_endpoint_dynamic_test(

            test_id=test_id,

            endpoint_dynamic_test_update=endpoint_dynamic_test_update,

            aid=aid,

            _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test"),
        )
        assert_constructed_model_matches_example_json(response, expected_response)


    def test_update_agent_to_server_endpoint_dynamic_test_error_400(self) -> None:
        """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 400)"""
        request_body_json = """
        
                {
                  "protocol" : "icmp",
                  "application" : "webex",
                  "isEnabled" : true,
                  "interval" : 60,
                  "tcpProbeMode" : "auto",
                  "testName" : "Test name"
                }
        
                """
        endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json)
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                endpoint_dynamic_test_update=endpoint_dynamic_test_update,

                aid=aid,

                _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="400"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_update_agent_to_server_endpoint_dynamic_test_error_401(self) -> None:
        """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "protocol" : "icmp",
                  "application" : "webex",
                  "isEnabled" : true,
                  "interval" : 60,
                  "tcpProbeMode" : "auto",
                  "testName" : "Test name"
                }
        
                """
        endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json)
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                endpoint_dynamic_test_update=endpoint_dynamic_test_update,

                aid=aid,

                _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="401"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_update_agent_to_server_endpoint_dynamic_test_error_403(self) -> None:
        """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "protocol" : "icmp",
                  "application" : "webex",
                  "isEnabled" : true,
                  "interval" : 60,
                  "tcpProbeMode" : "auto",
                  "testName" : "Test name"
                }
        
                """
        endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json)
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                endpoint_dynamic_test_update=endpoint_dynamic_test_update,

                aid=aid,

                _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="403"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_update_agent_to_server_endpoint_dynamic_test_error_404(self) -> None:
        """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "protocol" : "icmp",
                  "application" : "webex",
                  "isEnabled" : true,
                  "interval" : 60,
                  "tcpProbeMode" : "auto",
                  "testName" : "Test name"
                }
        
                """
        endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json)
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                endpoint_dynamic_test_update=endpoint_dynamic_test_update,

                aid=aid,

                _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="404"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_update_agent_to_server_endpoint_dynamic_test_error_429(self) -> None:
        """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "protocol" : "icmp",
                  "application" : "webex",
                  "isEnabled" : true,
                  "interval" : 60,
                  "tcpProbeMode" : "auto",
                  "testName" : "Test name"
                }
        
                """
        endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json)
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                endpoint_dynamic_test_update=endpoint_dynamic_test_update,

                aid=aid,

                _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="429"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_update_agent_to_server_endpoint_dynamic_test_error_500(self) -> None:
        """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "protocol" : "icmp",
                  "application" : "webex",
                  "isEnabled" : true,
                  "interval" : 60,
                  "tcpProbeMode" : "auto",
                  "testName" : "Test name"
                }
        
                """
        endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json)
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                endpoint_dynamic_test_update=endpoint_dynamic_test_update,

                aid=aid,

                _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="500"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)


    def test_update_agent_to_server_endpoint_dynamic_test_error_502(self) -> None:
        """Integration test for update_agent_to_server_endpoint_dynamic_test error path (HTTP 502)"""
        request_body_json = """
        
                {
                  "protocol" : "icmp",
                  "application" : "webex",
                  "isEnabled" : true,
                  "interval" : 60,
                  "tcpProbeMode" : "auto",
                  "testName" : "Test name"
                }
        
                """
        endpoint_dynamic_test_update = thousandeyes_sdk.endpoint_tests.models.EndpointDynamicTestUpdate.from_json(request_body_json)
        test_id = '584739201'
        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_agent_to_server_endpoint_dynamic_test(

                test_id=test_id,

                endpoint_dynamic_test_update=endpoint_dynamic_test_update,

                aid=aid,

                _headers=self.te_headers("update_agent_to_server_endpoint_dynamic_test", error_status="502"),
            )
        assert_constructed_model_matches_example_json(context.exception.data, expected_error)






if __name__ == '__main__':
    unittest.main()
