# coding: utf-8

"""
    Internet Insights API

    **Note:** All Internet Insights APIs are not available for ThousandEyes for Government instance.  We are happy to announce the release of the Internet Insights API set. This limited release includes endpoints that:  * Make our catalog provider and Internet outage data accessible to API users. * Provide access to advanced filtering, which is part of our next-generation API efforts to allow API users to fine-tune queries across all of our APIs in a consistent manner.  Internet Insights provide visibility into core Internet infrastructure, including ISPs, DNS providers, IaaS, CDNs , and SaaS providers. It tracks the macro-level impact of Internet events on individual users and enterprise networks connecting at the edge of the Internet. These events include Outages, Routing hijacks and leaks, DDoS attacks, And political interference, among others.  Future releases of the Internet Insights API set will further unlock access to core Internet Insights functionality, unlocking potential integrations to enrich customer process flows.  For more information about Internet Insights, see the [Internet Insights](https://docs.thousandeyes.com/product-documentation/internet-insights). 

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

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


import json
import unittest
import thousandeyes_sdk.internet_insights.models

from thousandeyes_sdk.core.exceptions import ApiException
from thousandeyes_sdk.internet_insights.api.internet_insights_outages_api import InternetInsightsOutagesApi
from .integration_test_utils import IntegrationTestBase
from .test_utils import assert_constructed_model_matches_example_json


class TestInternetInsightsOutagesApiIntegration(IntegrationTestBase):
    """InternetInsightsOutagesApi integration test stubs"""

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


    def test_filter_outages_happy_path(self) -> None:
        """Integration test for filter_outages success path"""
        request_body_json = """
        
                {
                  "startDate" : "2022-03-01T01:30:00Z",
                  "endDate" : "2022-03-01T23:30:15Z",
                  "outageScope" : "all",
                  "providerName" : [ "Telia", "Amazon" ],
                  "interfaceNetwork" : [ "Telianet", "Cloudflare" ],
                  "applicationName" : [ "slack", "facebook" ]
                }
        
                """
        api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.from_json(request_body_json)
        aid = '1234'
        response_body_json = """
                {
                  "_links" : {
                    "self" : {
                      "hreflang" : "hreflang",
                      "templated" : true,
                      "profile" : "profile",
                      "name" : "name",
                      "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                      "type" : "type",
                      "deprecation" : "deprecation",
                      "title" : "title"
                    }
                  },
                  "outages" : [ {
                    "affectedInterfacesCount" : 1,
                    "endDate" : "2022-03-01T23:31:11Z",
                    "_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"
                      }
                    },
                    "affectedLocationsCount" : 1,
                    "endRoundId" : 1646177700,
                    "affectedTestsCount" : 1,
                    "type" : "app",
                    "providerType" : "SAAS",
                    "duration" : 214,
                    "startRoundId" : 1646177400,
                    "name" : "Google",
                    "id" : "xxxxxxxxxxxxxxxxxx1",
                    "affectedServersCount" : 2,
                    "asn" : 19994,
                    "providerName" : "Google",
                    "startDate" : "2022-03-01T23:31:11Z"
                  }, {
                    "affectedInterfacesCount" : 1,
                    "endDate" : "2022-03-01T23:31:11Z",
                    "_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"
                      }
                    },
                    "affectedLocationsCount" : 1,
                    "endRoundId" : 1646177700,
                    "affectedTestsCount" : 1,
                    "type" : "app",
                    "providerType" : "SAAS",
                    "duration" : 214,
                    "startRoundId" : 1646177400,
                    "name" : "Google",
                    "id" : "xxxxxxxxxxxxxxxxxx1",
                    "affectedServersCount" : 2,
                    "asn" : 19994,
                    "providerName" : "Google",
                    "startDate" : "2022-03-01T23:31:11Z"
                  } ]
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.filter_outages(

            api_outage_filter=api_outage_filter,

            aid=aid,

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


    def test_filter_outages_error_400(self) -> None:
        """Integration test for filter_outages error path (HTTP 400)"""
        request_body_json = """
        
                {
                  "startDate" : "2022-03-01T01:30:00Z",
                  "endDate" : "2022-03-01T23:30:15Z",
                  "outageScope" : "all",
                  "providerName" : [ "Telia", "Amazon" ],
                  "interfaceNetwork" : [ "Telianet", "Cloudflare" ],
                  "applicationName" : [ "slack", "facebook" ]
                }
        
                """
        api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.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.filter_outages(

                api_outage_filter=api_outage_filter,

                aid=aid,

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


    def test_filter_outages_error_401(self) -> None:
        """Integration test for filter_outages error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "startDate" : "2022-03-01T01:30:00Z",
                  "endDate" : "2022-03-01T23:30:15Z",
                  "outageScope" : "all",
                  "providerName" : [ "Telia", "Amazon" ],
                  "interfaceNetwork" : [ "Telianet", "Cloudflare" ],
                  "applicationName" : [ "slack", "facebook" ]
                }
        
                """
        api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.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.filter_outages(

                api_outage_filter=api_outage_filter,

                aid=aid,

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


    def test_filter_outages_error_403(self) -> None:
        """Integration test for filter_outages error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "startDate" : "2022-03-01T01:30:00Z",
                  "endDate" : "2022-03-01T23:30:15Z",
                  "outageScope" : "all",
                  "providerName" : [ "Telia", "Amazon" ],
                  "interfaceNetwork" : [ "Telianet", "Cloudflare" ],
                  "applicationName" : [ "slack", "facebook" ]
                }
        
                """
        api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.from_json(request_body_json)
        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.filter_outages(

                api_outage_filter=api_outage_filter,

                aid=aid,

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


    def test_filter_outages_error_404(self) -> None:
        """Integration test for filter_outages error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "startDate" : "2022-03-01T01:30:00Z",
                  "endDate" : "2022-03-01T23:30:15Z",
                  "outageScope" : "all",
                  "providerName" : [ "Telia", "Amazon" ],
                  "interfaceNetwork" : [ "Telianet", "Cloudflare" ],
                  "applicationName" : [ "slack", "facebook" ]
                }
        
                """
        api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.from_json(request_body_json)
        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.filter_outages(

                api_outage_filter=api_outage_filter,

                aid=aid,

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


    def test_filter_outages_error_429(self) -> None:
        """Integration test for filter_outages error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "startDate" : "2022-03-01T01:30:00Z",
                  "endDate" : "2022-03-01T23:30:15Z",
                  "outageScope" : "all",
                  "providerName" : [ "Telia", "Amazon" ],
                  "interfaceNetwork" : [ "Telianet", "Cloudflare" ],
                  "applicationName" : [ "slack", "facebook" ]
                }
        
                """
        api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.from_json(request_body_json)
        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.filter_outages(

                api_outage_filter=api_outage_filter,

                aid=aid,

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


    def test_filter_outages_error_500(self) -> None:
        """Integration test for filter_outages error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "startDate" : "2022-03-01T01:30:00Z",
                  "endDate" : "2022-03-01T23:30:15Z",
                  "outageScope" : "all",
                  "providerName" : [ "Telia", "Amazon" ],
                  "interfaceNetwork" : [ "Telianet", "Cloudflare" ],
                  "applicationName" : [ "slack", "facebook" ]
                }
        
                """
        api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.from_json(request_body_json)
        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.filter_outages(

                api_outage_filter=api_outage_filter,

                aid=aid,

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


    def test_filter_outages_error_502(self) -> None:
        """Integration test for filter_outages error path (HTTP 502)"""
        request_body_json = """
        
                {
                  "startDate" : "2022-03-01T01:30:00Z",
                  "endDate" : "2022-03-01T23:30:15Z",
                  "outageScope" : "all",
                  "providerName" : [ "Telia", "Amazon" ],
                  "interfaceNetwork" : [ "Telianet", "Cloudflare" ],
                  "applicationName" : [ "slack", "facebook" ]
                }
        
                """
        api_outage_filter = thousandeyes_sdk.internet_insights.models.ApiOutageFilter.from_json(request_body_json)
        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.filter_outages(

                api_outage_filter=api_outage_filter,

                aid=aid,

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




    def test_get_app_outage_happy_path(self) -> None:
        """Integration test for get_app_outage success path"""
        outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0'
        aid = '1234'
        response_body_json = """
                {
                  "affectedDomains" : [ "amazon.com", "amazon.com" ],
                  "affectedTests" : [ {
                    "name" : "amazon-test2",
                    "id" : 5
                  }, {
                    "name" : "amazon-test2",
                    "id" : 5
                  } ],
                  "endDate" : "2023-01-27T20:53:51.256Z",
                  "_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"
                    }
                  },
                  "endRoundId" : 1674852600,
                  "providerType" : "SAAS",
                  "duration" : 180,
                  "startRoundId" : 1674852600,
                  "affectedAgents" : [ {
                    "name" : "London, England",
                    "id" : 11
                  }, {
                    "name" : "London, England",
                    "id" : 11
                  } ],
                  "id" : "0CC4C4209887126DE42E92252FB43962CBB3193147F318EA",
                  "providerName" : "Amazon Web Services",
                  "applicationName" : "Amazon Web Services",
                  "startDate" : "2023-01-27T20:50:51.256Z",
                  "errors" : [ "HTTP_SERVER_TIMEOUT", "HTTP_SERVER_TIMEOUT" ],
                  "affectedLocations" : [ {
                    "location" : "Chicago, Illinois, US",
                    "affectedServers" : [ {
                      "prefix" : "123.176.185.0/23",
                      "domain" : "amazon.com"
                    }, {
                      "prefix" : "123.176.185.0/23",
                      "domain" : "amazon.com"
                    } ]
                  }, {
                    "location" : "Chicago, Illinois, US",
                    "affectedServers" : [ {
                      "prefix" : "123.176.185.0/23",
                      "domain" : "amazon.com"
                    }, {
                      "prefix" : "123.176.185.0/23",
                      "domain" : "amazon.com"
                    } ]
                  } ]
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.get_app_outage(

            outage_id=outage_id,

            aid=aid,

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


    def test_get_app_outage_error_400(self) -> None:
        """Integration test for get_app_outage error path (HTTP 400)"""
        outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0'
        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_app_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_app_outage_error_401(self) -> None:
        """Integration test for get_app_outage error path (HTTP 401)"""
        outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0'
        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_app_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_app_outage_error_403(self) -> None:
        """Integration test for get_app_outage error path (HTTP 403)"""
        outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0'
        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_app_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_app_outage_error_404(self) -> None:
        """Integration test for get_app_outage error path (HTTP 404)"""
        outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0'
        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_app_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_app_outage_error_429(self) -> None:
        """Integration test for get_app_outage error path (HTTP 429)"""
        outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0'
        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_app_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_app_outage_error_500(self) -> None:
        """Integration test for get_app_outage error path (HTTP 500)"""
        outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0'
        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_app_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_app_outage_error_502(self) -> None:
        """Integration test for get_app_outage error path (HTTP 502)"""
        outage_id = 'F73E24F17E4996923196826A208BB572508A8EB13BEE14B0'
        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_app_outage(

                outage_id=outage_id,

                aid=aid,

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




    def test_get_network_outage_happy_path(self) -> None:
        """Integration test for get_network_outage success path"""
        outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F'
        aid = '1234'
        response_body_json = """
                {
                  "affectedDomains" : [ "periodic-failure.com", "periodic-failure.com" ],
                  "affectedTests" : [ {
                    "name" : "amazon-test2",
                    "id" : 5
                  }, {
                    "name" : "amazon-test2",
                    "id" : 5
                  } ],
                  "endDate" : "2023-01-27T20:53:51.256Z",
                  "_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"
                    }
                  },
                  "networkName" : "Rackspace Hosting",
                  "endRoundId" : 1674852600,
                  "providerType" : "IAAS",
                  "duration" : 180,
                  "startRoundId" : 1674852600,
                  "affectedAgents" : [ {
                    "name" : "London, England",
                    "id" : 11
                  }, {
                    "name" : "London, England",
                    "id" : 11
                  } ],
                  "id" : "8EF2760862C705783A2F8BCBAAABB44F28DBC670DBA3B610",
                  "asn" : 19994,
                  "providerName" : "Rackspace",
                  "startDate" : "2023-01-27T20:50:51.256Z",
                  "affectedLocations" : [ {
                    "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ],
                    "location" : "Chicago, Illinois, US"
                  }, {
                    "affectedInterfaces" : [ "50.51.52.53", "50.51.52.53" ],
                    "location" : "Chicago, Illinois, US"
                  } ]
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.get_network_outage(

            outage_id=outage_id,

            aid=aid,

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


    def test_get_network_outage_error_400(self) -> None:
        """Integration test for get_network_outage error path (HTTP 400)"""
        outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F'
        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_network_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_network_outage_error_401(self) -> None:
        """Integration test for get_network_outage error path (HTTP 401)"""
        outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F'
        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_network_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_network_outage_error_403(self) -> None:
        """Integration test for get_network_outage error path (HTTP 403)"""
        outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F'
        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_network_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_network_outage_error_404(self) -> None:
        """Integration test for get_network_outage error path (HTTP 404)"""
        outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F'
        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_network_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_network_outage_error_429(self) -> None:
        """Integration test for get_network_outage error path (HTTP 429)"""
        outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F'
        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_network_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_network_outage_error_500(self) -> None:
        """Integration test for get_network_outage error path (HTTP 500)"""
        outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F'
        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_network_outage(

                outage_id=outage_id,

                aid=aid,

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


    def test_get_network_outage_error_502(self) -> None:
        """Integration test for get_network_outage error path (HTTP 502)"""
        outage_id = '694D8656960F34F76489BCE5E9BCD58EC53027462740D75F'
        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_network_outage(

                outage_id=outage_id,

                aid=aid,

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






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