# coding: utf-8

"""
    Alerts API

    **Note:** API operations for the creation or retrieval of API, Page Load, or Web-Transaction alert rules are not available for ThousandEyes for Government instance.  You can manage the following alert functionalities on the ThousandEyes platform using the Alerts API:  * **Alerts**: Retrieve alert details. Alerts are assigned to tests through alert rules.  * **Alert Rules**: Conditions that you configure in order to highlight or be notified of events of interest in your ThousandEyes tests. When an alert rule’s conditions are met, the associated alert is triggered and the alert becomes active. It remains active until the alert is cleared. Alert rules are reusable across multiple tests..  * **Alert Suppression Windows**: Suppress alerts for tests during periods such as planned maintenance. Windows can be one-time events or recurring events to handle periodic occurrences such as monthly downtime for maintenance.  For more information about the alerts, see [Alerts](https://docs.thousandeyes.com/product-documentation/alerts). 

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

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


import json
import unittest
import thousandeyes_sdk.alerts.models

from thousandeyes_sdk.core.exceptions import ApiException
from thousandeyes_sdk.alerts.api.alert_suppression_windows_api import AlertSuppressionWindowsApi
from .integration_test_utils import IntegrationTestBase
from .test_utils import assert_constructed_model_matches_example_json


class TestAlertSuppressionWindowsApiIntegration(IntegrationTestBase):
    """AlertSuppressionWindowsApi integration test stubs"""

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


    def test_create_alert_suppression_window_happy_path(self) -> None:
        """Integration test for create_alert_suppression_window success path"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json)
        aid = '1234'
        response_body_json = """
                {
                  "duration" : 0,
                  "alertSuppressionWindowId" : "2411",
                  "tests" : [ {
                    "_links" : {
                      "testResults" : [ {
                        "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
                      }, {
                        "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
                      } ],
                      "self" : {
                        "hreflang" : "hreflang",
                        "templated" : true,
                        "profile" : "profile",
                        "name" : "name",
                        "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                        "type" : "type",
                        "deprecation" : "deprecation",
                        "title" : "title"
                      }
                    },
                    "liveShare" : false,
                    "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" : {
                      "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"
                    }
                  },
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.create_alert_suppression_window(

            alert_suppression_window_request=alert_suppression_window_request,

            aid=aid,

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


    def test_create_alert_suppression_window_error_400(self) -> None:
        """Integration test for create_alert_suppression_window error path (HTTP 400)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.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_alert_suppression_window(

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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


    def test_create_alert_suppression_window_error_401(self) -> None:
        """Integration test for create_alert_suppression_window error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.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_alert_suppression_window(

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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


    def test_create_alert_suppression_window_error_403(self) -> None:
        """Integration test for create_alert_suppression_window error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.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_alert_suppression_window(

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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


    def test_create_alert_suppression_window_error_404(self) -> None:
        """Integration test for create_alert_suppression_window error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.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_alert_suppression_window(

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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


    def test_create_alert_suppression_window_error_429(self) -> None:
        """Integration test for create_alert_suppression_window error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.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_alert_suppression_window(

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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


    def test_create_alert_suppression_window_error_500(self) -> None:
        """Integration test for create_alert_suppression_window error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.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_alert_suppression_window(

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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




    def test_delete_alert_suppression_window_happy_path(self) -> None:
        """Integration test for delete_alert_suppression_window success path"""
        window_id = '2411'
        aid = '1234'
        response = self.api.delete_alert_suppression_window_with_http_info(

            window_id=window_id,

            aid=aid,

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


    def test_delete_alert_suppression_window_error_400(self) -> None:
        """Integration test for delete_alert_suppression_window error path (HTTP 400)"""
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                aid=aid,

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


    def test_delete_alert_suppression_window_error_401(self) -> None:
        """Integration test for delete_alert_suppression_window error path (HTTP 401)"""
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                aid=aid,

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


    def test_delete_alert_suppression_window_error_403(self) -> None:
        """Integration test for delete_alert_suppression_window error path (HTTP 403)"""
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                aid=aid,

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


    def test_delete_alert_suppression_window_error_404(self) -> None:
        """Integration test for delete_alert_suppression_window error path (HTTP 404)"""
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                aid=aid,

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


    def test_delete_alert_suppression_window_error_429(self) -> None:
        """Integration test for delete_alert_suppression_window error path (HTTP 429)"""
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                aid=aid,

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


    def test_delete_alert_suppression_window_error_500(self) -> None:
        """Integration test for delete_alert_suppression_window error path (HTTP 500)"""
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                aid=aid,

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




    def test_get_alert_suppression_window_happy_path(self) -> None:
        """Integration test for get_alert_suppression_window success path"""
        window_id = '2411'
        aid = '1234'
        response_body_json = """
                {
                  "duration" : 0,
                  "alertSuppressionWindowId" : "2411",
                  "tests" : [ {
                    "_links" : {
                      "testResults" : [ {
                        "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
                      }, {
                        "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
                      } ],
                      "self" : {
                        "hreflang" : "hreflang",
                        "templated" : true,
                        "profile" : "profile",
                        "name" : "name",
                        "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                        "type" : "type",
                        "deprecation" : "deprecation",
                        "title" : "title"
                      }
                    },
                    "liveShare" : false,
                    "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" : {
                      "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"
                    }
                  },
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.get_alert_suppression_window(

            window_id=window_id,

            aid=aid,

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


    def test_get_alert_suppression_window_error_401(self) -> None:
        """Integration test for get_alert_suppression_window error path (HTTP 401)"""
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                aid=aid,

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


    def test_get_alert_suppression_window_error_403(self) -> None:
        """Integration test for get_alert_suppression_window error path (HTTP 403)"""
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                aid=aid,

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


    def test_get_alert_suppression_window_error_404(self) -> None:
        """Integration test for get_alert_suppression_window error path (HTTP 404)"""
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                aid=aid,

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


    def test_get_alert_suppression_window_error_429(self) -> None:
        """Integration test for get_alert_suppression_window error path (HTTP 429)"""
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                aid=aid,

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


    def test_get_alert_suppression_window_error_500(self) -> None:
        """Integration test for get_alert_suppression_window error path (HTTP 500)"""
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                aid=aid,

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




    def test_get_alert_suppression_windows_happy_path(self) -> None:
        """Integration test for get_alert_suppression_windows success path"""
        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"
                    }
                  },
                  "alertSuppressionWindows" : [ {
                    "duration" : 0,
                    "alertSuppressionWindowId" : "2411",
                    "_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"
                      }
                    },
                    "isEnabled" : false,
                    "repeat" : {
                      "intervalType" : "day",
                      "intervalLength" : 2,
                      "type" : "week",
                      "daysOfWeek" : [ "sun", "sun" ]
                    },
                    "endRepeat" : {
                      "date" : "2017-07-01",
                      "count" : 3,
                      "type" : "never"
                    },
                    "name" : "Monthly maintenance",
                    "startDate" : "2017-07-01T05:00:00Z",
                    "status" : "ended"
                  }, {
                    "duration" : 0,
                    "alertSuppressionWindowId" : "2411",
                    "_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"
                      }
                    },
                    "isEnabled" : false,
                    "repeat" : {
                      "intervalType" : "day",
                      "intervalLength" : 2,
                      "type" : "week",
                      "daysOfWeek" : [ "sun", "sun" ]
                    },
                    "endRepeat" : {
                      "date" : "2017-07-01",
                      "count" : 3,
                      "type" : "never"
                    },
                    "name" : "Monthly maintenance",
                    "startDate" : "2017-07-01T05:00:00Z",
                    "status" : "ended"
                  } ]
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.get_alert_suppression_windows(

            aid=aid,

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


    def test_get_alert_suppression_windows_error_401(self) -> None:
        """Integration test for get_alert_suppression_windows 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_alert_suppression_windows(

                aid=aid,

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


    def test_get_alert_suppression_windows_error_403(self) -> None:
        """Integration test for get_alert_suppression_windows 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_alert_suppression_windows(

                aid=aid,

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


    def test_get_alert_suppression_windows_error_404(self) -> None:
        """Integration test for get_alert_suppression_windows error path (HTTP 404)"""
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 0
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(404)
        ) as context:
            self.api.get_alert_suppression_windows(

                aid=aid,

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


    def test_get_alert_suppression_windows_error_429(self) -> None:
        """Integration test for get_alert_suppression_windows 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_alert_suppression_windows(

                aid=aid,

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


    def test_get_alert_suppression_windows_error_500(self) -> None:
        """Integration test for get_alert_suppression_windows 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_alert_suppression_windows(

                aid=aid,

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




    def test_update_alert_suppression_window_happy_path(self) -> None:
        """Integration test for update_alert_suppression_window success path"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json)
        window_id = '2411'
        aid = '1234'
        response_body_json = """
                {
                  "duration" : 0,
                  "alertSuppressionWindowId" : "2411",
                  "tests" : [ {
                    "_links" : {
                      "testResults" : [ {
                        "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
                      }, {
                        "href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
                      } ],
                      "self" : {
                        "hreflang" : "hreflang",
                        "templated" : true,
                        "profile" : "profile",
                        "name" : "name",
                        "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                        "type" : "type",
                        "deprecation" : "deprecation",
                        "title" : "title"
                      }
                    },
                    "liveShare" : false,
                    "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" : {
                      "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"
                    }
                  },
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.update_alert_suppression_window(

            window_id=window_id,

            alert_suppression_window_request=alert_suppression_window_request,

            aid=aid,

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


    def test_update_alert_suppression_window_error_400(self) -> None:
        """Integration test for update_alert_suppression_window error path (HTTP 400)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json)
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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


    def test_update_alert_suppression_window_error_401(self) -> None:
        """Integration test for update_alert_suppression_window error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json)
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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


    def test_update_alert_suppression_window_error_403(self) -> None:
        """Integration test for update_alert_suppression_window error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json)
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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


    def test_update_alert_suppression_window_error_404(self) -> None:
        """Integration test for update_alert_suppression_window error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json)
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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


    def test_update_alert_suppression_window_error_429(self) -> None:
        """Integration test for update_alert_suppression_window error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json)
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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


    def test_update_alert_suppression_window_error_500(self) -> None:
        """Integration test for update_alert_suppression_window error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "duration" : 0,
                  "testIds" : [ "71687", "71687" ],
                  "alertSuppressionWindowId" : "2411",
                  "isEnabled" : false,
                  "repeat" : {
                    "intervalType" : "day",
                    "intervalLength" : 2,
                    "type" : "week",
                    "daysOfWeek" : [ "sun", "sun" ]
                  },
                  "endRepeat" : {
                    "date" : "2017-07-01",
                    "count" : 3,
                    "type" : "never"
                  },
                  "name" : "Monthly maintenance",
                  "startDate" : "2017-07-01T05:00:00Z",
                  "status" : "ended"
                }
        
                """
        alert_suppression_window_request = thousandeyes_sdk.alerts.models.AlertSuppressionWindowRequest.from_json(request_body_json)
        window_id = '2411'
        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_alert_suppression_window(

                window_id=window_id,

                alert_suppression_window_request=alert_suppression_window_request,

                aid=aid,

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






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