# coding: utf-8

"""
    Test Results API

    Get test result metrics for 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.test_results.models

from thousandeyes_sdk.core.exceptions import ApiException
from thousandeyes_sdk.test_results.api.network_test_results_api import NetworkTestResultsApi
from .integration_test_utils import IntegrationTestBase
from .test_utils import assert_constructed_model_matches_example_json


class TestNetworkTestResultsApiIntegration(IntegrationTestBase):
    """NetworkTestResultsApi integration test stubs"""

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


    def test_get_test_network_results_happy_path(self) -> None:
        """Integration test for get_test_network_results success path"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        response_body_json = """
                {
                  "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,
                    "savedEvent" : true,
                    "description" : "ThousandEyes Test",
                    "type" : "agent-to-server",
                    "enabled" : true,
                    "createdDate" : "2022-07-17T22:00:54Z",
                    "createdBy" : "user@user.com",
                    "modifiedDate" : "2022-07-17T22:00:54Z",
                    "interval" : 60,
                    "modifiedBy" : "user@user.com",
                    "testId" : "281474976710706",
                    "alertsEnabled" : true,
                    "testName" : "ThousandEyes Test"
                  },
                  "endDate" : "2022-07-18T22:00:54Z",
                  "_links" : {
                    "next" : {
                      "hreflang" : "hreflang",
                      "templated" : true,
                      "profile" : "profile",
                      "name" : "name",
                      "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                      "type" : "type",
                      "deprecation" : "deprecation",
                      "title" : "title"
                    },
                    "previous" : {
                      "hreflang" : "hreflang",
                      "templated" : true,
                      "profile" : "profile",
                      "name" : "name",
                      "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                      "type" : "type",
                      "deprecation" : "deprecation",
                      "title" : "title"
                    },
                    "self" : {
                      "hreflang" : "hreflang",
                      "templated" : true,
                      "profile" : "profile",
                      "name" : "name",
                      "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                      "type" : "type",
                      "deprecation" : "deprecation",
                      "title" : "title"
                    }
                  },
                  "results" : [ {
                    "date" : "2022-07-17T22:00:54Z",
                    "server" : "www.thousandeyes.com:80",
                    "availableBandwidth" : 9.100464,
                    "agent" : {
                      "agentId" : "281474976710706",
                      "agentName" : "thousandeyes-stg-va-254",
                      "location" : "San Francisco Bay Area",
                      "countryId" : "US"
                    },
                    "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ],
                    "avgLatency" : 167.04,
                    "bandwidth" : 4.3313155,
                    "minLatency" : 167,
                    "_links" : {
                      "appLink" : {
                        "hreflang" : "hreflang",
                        "templated" : true,
                        "profile" : "profile",
                        "name" : "name",
                        "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                        "type" : "type",
                        "deprecation" : "deprecation",
                        "title" : "title"
                      }
                    },
                    "maxLatency" : 168,
                    "proxyJitter" : 1.2,
                    "proxyAverageLatency" : 45,
                    "proxyLoss" : 2.5,
                    "healthScore" : 0.98,
                    "capacity" : 210.10854,
                    "loss" : 0,
                    "proxyMinLatency" : 40,
                    "jitter" : 0.076808,
                    "serverIp" : "50.18.127.223",
                    "startTime" : 1384309800,
                    "endTime" : 1384309800,
                    "proxyMaxLatency" : 50,
                    "roundId" : 1384309800,
                    "direction" : "to-target"
                  }, {
                    "date" : "2022-07-17T22:00:54Z",
                    "server" : "www.thousandeyes.com:80",
                    "availableBandwidth" : 9.100464,
                    "agent" : {
                      "agentId" : "281474976710706",
                      "agentName" : "thousandeyes-stg-va-254",
                      "location" : "San Francisco Bay Area",
                      "countryId" : "US"
                    },
                    "packetsBySecond" : [ [ ], [ 0 ], [ 2 ], [ 2, 1 ], [ 1, 1 ] ],
                    "avgLatency" : 167.04,
                    "bandwidth" : 4.3313155,
                    "minLatency" : 167,
                    "_links" : {
                      "appLink" : {
                        "hreflang" : "hreflang",
                        "templated" : true,
                        "profile" : "profile",
                        "name" : "name",
                        "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                        "type" : "type",
                        "deprecation" : "deprecation",
                        "title" : "title"
                      }
                    },
                    "maxLatency" : 168,
                    "proxyJitter" : 1.2,
                    "proxyAverageLatency" : 45,
                    "proxyLoss" : 2.5,
                    "healthScore" : 0.98,
                    "capacity" : 210.10854,
                    "loss" : 0,
                    "proxyMinLatency" : 40,
                    "jitter" : 0.076808,
                    "serverIp" : "50.18.127.223",
                    "startTime" : 1384309800,
                    "endTime" : 1384309800,
                    "proxyMaxLatency" : 50,
                    "roundId" : 1384309800,
                    "direction" : "to-target"
                  } ],
                  "startDate" : "2022-07-17T22:00:54Z"
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.get_test_network_results(

            test_id=test_id,

            aid=aid,

            window=window,

            start_date=start_date,

            end_date=end_date,

            cursor=cursor,

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


    def test_get_test_network_results_error_400(self) -> None:
        """Integration test for get_test_network_results error path (HTTP 400)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "errors" : [ {
                    "code" : "code",
                    "field" : "field",
                    "message" : "message"
                  }, {
                    "code" : "code",
                    "field" : "field",
                    "message" : "message"
                  } ],
                  "status" : 0
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(400)
        ) as context:
            self.api.get_test_network_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_network_results_error_401(self) -> None:
        """Integration test for get_test_network_results error path (HTTP 401)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "error_description" : "Invalid access token",
                  "error" : "invalid_token"
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(401)
        ) as context:
            self.api.get_test_network_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_network_results_error_403(self) -> None:
        """Integration test for get_test_network_results error path (HTTP 403)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(403)
        ) as context:
            self.api.get_test_network_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_network_results_error_404(self) -> None:
        """Integration test for get_test_network_results error path (HTTP 404)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(404)
        ) as context:
            self.api.get_test_network_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_network_results_error_429(self) -> None:
        """Integration test for get_test_network_results error path (HTTP 429)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(429)
        ) as context:
            self.api.get_test_network_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_network_results_error_500(self) -> None:
        """Integration test for get_test_network_results error path (HTTP 500)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(500)
        ) as context:
            self.api.get_test_network_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_network_results_error_502(self) -> None:
        """Integration test for get_test_network_results error path (HTTP 502)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(502)
        ) as context:
            self.api.get_test_network_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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




    def test_get_test_path_vis_agent_round_results_happy_path(self) -> None:
        """Integration test for get_test_path_vis_agent_round_results success path"""
        test_id = '202701'
        agent_id = '11'
        round_id = '1384309800'
        aid = '1234'
        response_body_json = """
                {
                  "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,
                    "savedEvent" : true,
                    "description" : "ThousandEyes Test",
                    "type" : "agent-to-server",
                    "enabled" : true,
                    "createdDate" : "2022-07-17T22:00:54Z",
                    "createdBy" : "user@user.com",
                    "modifiedDate" : "2022-07-17T22:00:54Z",
                    "interval" : 60,
                    "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"
                    }
                  },
                  "results" : [ {
                    "date" : "2022-07-17T22:00:54Z",
                    "server" : "www.google.com:443",
                    "agent" : {
                      "agentId" : "281474976710706",
                      "agentName" : "thousandeyes-stg-va-254",
                      "location" : "San Francisco Bay Area",
                      "countryId" : "US"
                    },
                    "_links" : {
                      "appLink" : {
                        "hreflang" : "hreflang",
                        "templated" : true,
                        "profile" : "profile",
                        "name" : "name",
                        "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                        "type" : "type",
                        "deprecation" : "deprecation",
                        "title" : "title"
                      }
                    },
                    "targetIsProxy" : true,
                    "sourcePrefix" : "196.40.96.0/20",
                    "sourceIp" : "196.40.106.237",
                    "pathTraces" : [ {
                      "hops" : [ {
                        "rdns" : "core-router1.cpt2.host-h.net",
                        "prefix" : "196.40.96.0/20",
                        "responseTime" : 1,
                        "hop" : 1,
                        "ipAddress" : "196.40.106.237",
                        "mpls" : "mpls",
                        "location" : "Cape Town, South Africa",
                        "network" : "HETZNER (Pty) Ltd (AS 37153)"
                      }, {
                        "rdns" : "core-router1.cpt2.host-h.net",
                        "prefix" : "196.40.96.0/20",
                        "responseTime" : 1,
                        "hop" : 1,
                        "ipAddress" : "196.40.106.237",
                        "mpls" : "mpls",
                        "location" : "Cape Town, South Africa",
                        "network" : "HETZNER (Pty) Ltd (AS 37153)"
                      } ],
                      "pathId" : "4711301366345855606023718047703941305741293841502186803"
                    }, {
                      "hops" : [ {
                        "rdns" : "core-router1.cpt2.host-h.net",
                        "prefix" : "196.40.96.0/20",
                        "responseTime" : 1,
                        "hop" : 1,
                        "ipAddress" : "196.40.106.237",
                        "mpls" : "mpls",
                        "location" : "Cape Town, South Africa",
                        "network" : "HETZNER (Pty) Ltd (AS 37153)"
                      }, {
                        "rdns" : "core-router1.cpt2.host-h.net",
                        "prefix" : "196.40.96.0/20",
                        "responseTime" : 1,
                        "hop" : 1,
                        "ipAddress" : "196.40.106.237",
                        "mpls" : "mpls",
                        "location" : "Cape Town, South Africa",
                        "network" : "HETZNER (Pty) Ltd (AS 37153)"
                      } ],
                      "pathId" : "4711301366345855606023718047703941305741293841502186803"
                    } ],
                    "serverIp" : "172.217.170.68",
                    "startTime" : 1384309800,
                    "endTime" : 1384309800,
                    "roundId" : 1384309800,
                    "direction" : "to-target"
                  }, {
                    "date" : "2022-07-17T22:00:54Z",
                    "server" : "www.google.com:443",
                    "agent" : {
                      "agentId" : "281474976710706",
                      "agentName" : "thousandeyes-stg-va-254",
                      "location" : "San Francisco Bay Area",
                      "countryId" : "US"
                    },
                    "_links" : {
                      "appLink" : {
                        "hreflang" : "hreflang",
                        "templated" : true,
                        "profile" : "profile",
                        "name" : "name",
                        "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                        "type" : "type",
                        "deprecation" : "deprecation",
                        "title" : "title"
                      }
                    },
                    "targetIsProxy" : true,
                    "sourcePrefix" : "196.40.96.0/20",
                    "sourceIp" : "196.40.106.237",
                    "pathTraces" : [ {
                      "hops" : [ {
                        "rdns" : "core-router1.cpt2.host-h.net",
                        "prefix" : "196.40.96.0/20",
                        "responseTime" : 1,
                        "hop" : 1,
                        "ipAddress" : "196.40.106.237",
                        "mpls" : "mpls",
                        "location" : "Cape Town, South Africa",
                        "network" : "HETZNER (Pty) Ltd (AS 37153)"
                      }, {
                        "rdns" : "core-router1.cpt2.host-h.net",
                        "prefix" : "196.40.96.0/20",
                        "responseTime" : 1,
                        "hop" : 1,
                        "ipAddress" : "196.40.106.237",
                        "mpls" : "mpls",
                        "location" : "Cape Town, South Africa",
                        "network" : "HETZNER (Pty) Ltd (AS 37153)"
                      } ],
                      "pathId" : "4711301366345855606023718047703941305741293841502186803"
                    }, {
                      "hops" : [ {
                        "rdns" : "core-router1.cpt2.host-h.net",
                        "prefix" : "196.40.96.0/20",
                        "responseTime" : 1,
                        "hop" : 1,
                        "ipAddress" : "196.40.106.237",
                        "mpls" : "mpls",
                        "location" : "Cape Town, South Africa",
                        "network" : "HETZNER (Pty) Ltd (AS 37153)"
                      }, {
                        "rdns" : "core-router1.cpt2.host-h.net",
                        "prefix" : "196.40.96.0/20",
                        "responseTime" : 1,
                        "hop" : 1,
                        "ipAddress" : "196.40.106.237",
                        "mpls" : "mpls",
                        "location" : "Cape Town, South Africa",
                        "network" : "HETZNER (Pty) Ltd (AS 37153)"
                      } ],
                      "pathId" : "4711301366345855606023718047703941305741293841502186803"
                    } ],
                    "serverIp" : "172.217.170.68",
                    "startTime" : 1384309800,
                    "endTime" : 1384309800,
                    "roundId" : 1384309800,
                    "direction" : "to-target"
                  } ]
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.get_test_path_vis_agent_round_results(

            test_id=test_id,

            agent_id=agent_id,

            round_id=round_id,

            aid=aid,

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


    def test_get_test_path_vis_agent_round_results_error_400(self) -> None:
        """Integration test for get_test_path_vis_agent_round_results error path (HTTP 400)"""
        test_id = '202701'
        agent_id = '11'
        round_id = '1384309800'
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "errors" : [ {
                    "code" : "code",
                    "field" : "field",
                    "message" : "message"
                  }, {
                    "code" : "code",
                    "field" : "field",
                    "message" : "message"
                  } ],
                  "status" : 0
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(400)
        ) as context:
            self.api.get_test_path_vis_agent_round_results(

                test_id=test_id,

                agent_id=agent_id,

                round_id=round_id,

                aid=aid,

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


    def test_get_test_path_vis_agent_round_results_error_401(self) -> None:
        """Integration test for get_test_path_vis_agent_round_results error path (HTTP 401)"""
        test_id = '202701'
        agent_id = '11'
        round_id = '1384309800'
        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_test_path_vis_agent_round_results(

                test_id=test_id,

                agent_id=agent_id,

                round_id=round_id,

                aid=aid,

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


    def test_get_test_path_vis_agent_round_results_error_403(self) -> None:
        """Integration test for get_test_path_vis_agent_round_results error path (HTTP 403)"""
        test_id = '202701'
        agent_id = '11'
        round_id = '1384309800'
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(403)
        ) as context:
            self.api.get_test_path_vis_agent_round_results(

                test_id=test_id,

                agent_id=agent_id,

                round_id=round_id,

                aid=aid,

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


    def test_get_test_path_vis_agent_round_results_error_404(self) -> None:
        """Integration test for get_test_path_vis_agent_round_results error path (HTTP 404)"""
        test_id = '202701'
        agent_id = '11'
        round_id = '1384309800'
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(404)
        ) as context:
            self.api.get_test_path_vis_agent_round_results(

                test_id=test_id,

                agent_id=agent_id,

                round_id=round_id,

                aid=aid,

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


    def test_get_test_path_vis_agent_round_results_error_429(self) -> None:
        """Integration test for get_test_path_vis_agent_round_results error path (HTTP 429)"""
        test_id = '202701'
        agent_id = '11'
        round_id = '1384309800'
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(429)
        ) as context:
            self.api.get_test_path_vis_agent_round_results(

                test_id=test_id,

                agent_id=agent_id,

                round_id=round_id,

                aid=aid,

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


    def test_get_test_path_vis_agent_round_results_error_500(self) -> None:
        """Integration test for get_test_path_vis_agent_round_results error path (HTTP 500)"""
        test_id = '202701'
        agent_id = '11'
        round_id = '1384309800'
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(500)
        ) as context:
            self.api.get_test_path_vis_agent_round_results(

                test_id=test_id,

                agent_id=agent_id,

                round_id=round_id,

                aid=aid,

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


    def test_get_test_path_vis_agent_round_results_error_502(self) -> None:
        """Integration test for get_test_path_vis_agent_round_results error path (HTTP 502)"""
        test_id = '202701'
        agent_id = '11'
        round_id = '1384309800'
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(502)
        ) as context:
            self.api.get_test_path_vis_agent_round_results(

                test_id=test_id,

                agent_id=agent_id,

                round_id=round_id,

                aid=aid,

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




    def test_get_test_path_vis_results_happy_path(self) -> None:
        """Integration test for get_test_path_vis_results success path"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        response_body_json = """
                {
                  "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,
                    "savedEvent" : true,
                    "description" : "ThousandEyes Test",
                    "type" : "agent-to-server",
                    "enabled" : true,
                    "createdDate" : "2022-07-17T22:00:54Z",
                    "createdBy" : "user@user.com",
                    "modifiedDate" : "2022-07-17T22:00:54Z",
                    "interval" : 60,
                    "modifiedBy" : "user@user.com",
                    "testId" : "281474976710706",
                    "alertsEnabled" : true,
                    "testName" : "ThousandEyes Test"
                  },
                  "endDate" : "2022-07-18T22:00:54Z",
                  "_links" : {
                    "next" : {
                      "hreflang" : "hreflang",
                      "templated" : true,
                      "profile" : "profile",
                      "name" : "name",
                      "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                      "type" : "type",
                      "deprecation" : "deprecation",
                      "title" : "title"
                    },
                    "previous" : {
                      "hreflang" : "hreflang",
                      "templated" : true,
                      "profile" : "profile",
                      "name" : "name",
                      "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                      "type" : "type",
                      "deprecation" : "deprecation",
                      "title" : "title"
                    },
                    "self" : {
                      "hreflang" : "hreflang",
                      "templated" : true,
                      "profile" : "profile",
                      "name" : "name",
                      "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                      "type" : "type",
                      "deprecation" : "deprecation",
                      "title" : "title"
                    }
                  },
                  "results" : [ {
                    "date" : "2022-07-17T22:00:54Z",
                    "server" : "www.google.com:443",
                    "agent" : {
                      "agentId" : "281474976710706",
                      "agentName" : "thousandeyes-stg-va-254",
                      "location" : "San Francisco Bay Area",
                      "countryId" : "US"
                    },
                    "_links" : {
                      "appLink" : {
                        "hreflang" : "hreflang",
                        "templated" : true,
                        "profile" : "profile",
                        "name" : "name",
                        "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                        "type" : "type",
                        "deprecation" : "deprecation",
                        "title" : "title"
                      }
                    },
                    "targetIsProxy" : true,
                    "sourcePrefix" : "196.40.96.0/20",
                    "sourceIp" : "196.40.106.237",
                    "pathTraces" : [ {
                      "numberOfHops" : 15,
                      "responseTime" : 1500,
                      "ipAddress" : "196.40.106.237",
                      "pathMtu" : 1500,
                      "pathId" : "1230899668701775614109128428722974545787322404682781961521",
                      "mss" : 1460
                    }, {
                      "numberOfHops" : 15,
                      "responseTime" : 1500,
                      "ipAddress" : "196.40.106.237",
                      "pathMtu" : 1500,
                      "pathId" : "1230899668701775614109128428722974545787322404682781961521",
                      "mss" : 1460
                    } ],
                    "serverIp" : "172.217.170.68",
                    "startTime" : 1384309800,
                    "endTime" : 1384309800,
                    "roundId" : 1384309800,
                    "direction" : "to-target"
                  }, {
                    "date" : "2022-07-17T22:00:54Z",
                    "server" : "www.google.com:443",
                    "agent" : {
                      "agentId" : "281474976710706",
                      "agentName" : "thousandeyes-stg-va-254",
                      "location" : "San Francisco Bay Area",
                      "countryId" : "US"
                    },
                    "_links" : {
                      "appLink" : {
                        "hreflang" : "hreflang",
                        "templated" : true,
                        "profile" : "profile",
                        "name" : "name",
                        "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                        "type" : "type",
                        "deprecation" : "deprecation",
                        "title" : "title"
                      }
                    },
                    "targetIsProxy" : true,
                    "sourcePrefix" : "196.40.96.0/20",
                    "sourceIp" : "196.40.106.237",
                    "pathTraces" : [ {
                      "numberOfHops" : 15,
                      "responseTime" : 1500,
                      "ipAddress" : "196.40.106.237",
                      "pathMtu" : 1500,
                      "pathId" : "1230899668701775614109128428722974545787322404682781961521",
                      "mss" : 1460
                    }, {
                      "numberOfHops" : 15,
                      "responseTime" : 1500,
                      "ipAddress" : "196.40.106.237",
                      "pathMtu" : 1500,
                      "pathId" : "1230899668701775614109128428722974545787322404682781961521",
                      "mss" : 1460
                    } ],
                    "serverIp" : "172.217.170.68",
                    "startTime" : 1384309800,
                    "endTime" : 1384309800,
                    "roundId" : 1384309800,
                    "direction" : "to-target"
                  } ],
                  "startDate" : "2022-07-17T22:00:54Z"
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.get_test_path_vis_results(

            test_id=test_id,

            aid=aid,

            window=window,

            start_date=start_date,

            end_date=end_date,

            cursor=cursor,

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


    def test_get_test_path_vis_results_error_400(self) -> None:
        """Integration test for get_test_path_vis_results error path (HTTP 400)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "errors" : [ {
                    "code" : "code",
                    "field" : "field",
                    "message" : "message"
                  }, {
                    "code" : "code",
                    "field" : "field",
                    "message" : "message"
                  } ],
                  "status" : 0
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(400)
        ) as context:
            self.api.get_test_path_vis_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_path_vis_results_error_401(self) -> None:
        """Integration test for get_test_path_vis_results error path (HTTP 401)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "error_description" : "Invalid access token",
                  "error" : "invalid_token"
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(401)
        ) as context:
            self.api.get_test_path_vis_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_path_vis_results_error_403(self) -> None:
        """Integration test for get_test_path_vis_results error path (HTTP 403)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(403)
        ) as context:
            self.api.get_test_path_vis_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_path_vis_results_error_404(self) -> None:
        """Integration test for get_test_path_vis_results error path (HTTP 404)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(404)
        ) as context:
            self.api.get_test_path_vis_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_path_vis_results_error_429(self) -> None:
        """Integration test for get_test_path_vis_results error path (HTTP 429)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(429)
        ) as context:
            self.api.get_test_path_vis_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_path_vis_results_error_500(self) -> None:
        """Integration test for get_test_path_vis_results error path (HTTP 500)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(500)
        ) as context:
            self.api.get_test_path_vis_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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


    def test_get_test_path_vis_results_error_502(self) -> None:
        """Integration test for get_test_path_vis_results error path (HTTP 502)"""
        test_id = '202701'
        aid = '1234'
        window = '12h'
        start_date = '2022-07-17T22:00:54Z'
        end_date = '2022-07-18T22:00:54Z'
        cursor = 'cursor_example'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(502)
        ) as context:
            self.api.get_test_path_vis_results(

                test_id=test_id,

                aid=aid,

                window=window,

                start_date=start_date,

                end_date=end_date,

                cursor=cursor,

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






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