# coding: utf-8

"""
    Integrations API

    **Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance.  Manage connectors and operations. 

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

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


import json
import unittest
import thousandeyes_sdk.connectors.models

from .test_utils import assert_constructed_model_matches_example_json
from thousandeyes_sdk.connectors.api.webhook_operations_api import WebhookOperationsApi


class TestWebhookOperationsApi(unittest.TestCase):
    """WebhookOperationsApi unit test stubs"""

    def setUp(self) -> None:
        self.api = WebhookOperationsApi()

    def tearDown(self) -> None:
        pass

    def test_create_webhook_operation_models_validation(self) -> None:
        """Test case for create_webhook_operation request and response models"""
        request_body_json = """
                {
                  "path" : "/custom/path",
                  "headers" : [ {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  }, {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  } ],
                  "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}",
                  "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}",
                  "_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"
                    }
                  },
                  "name" : "My operation",
                  "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                  "category" : "alerts",
                  "type" : "webhook",
                  "enabled" : true,
                  "status" : "pending"
                }
                """

        request_loaded_json = json.loads(request_body_json)
        request_from_json = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(request_body_json)
        assert_constructed_model_matches_example_json(request_from_json, request_loaded_json)

        response_body_json = """
                {
                  "path" : "/custom/path",
                  "headers" : [ {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  }, {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  } ],
                  "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}",
                  "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}",
                  "_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"
                    }
                  },
                  "name" : "My operation",
                  "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                  "category" : "alerts",
                  "type" : "webhook",
                  "enabled" : true,
                  "status" : "pending"
                }"""

        response_loaded_json = json.loads(response_body_json)
        response_from_json = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(response_body_json)
        assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)

    def test_delete_webhook_operation_models_validation(self) -> None:
        """Test case for delete_webhook_operation request and response models"""


    def test_get_webhook_operation_models_validation(self) -> None:
        """Test case for get_webhook_operation request and response models"""

        response_body_json = """
                {
                  "path" : "/custom/path",
                  "headers" : [ {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  }, {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  } ],
                  "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}",
                  "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}",
                  "_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"
                    }
                  },
                  "name" : "My operation",
                  "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                  "category" : "alerts",
                  "type" : "webhook",
                  "enabled" : true,
                  "status" : "pending"
                }"""

        response_loaded_json = json.loads(response_body_json)
        response_from_json = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(response_body_json)
        assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)

    def test_get_webhook_operations_models_validation(self) -> None:
        """Test case for get_webhook_operations request and response models"""

        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"
                    }
                  },
                  "items" : [ {
                    "path" : "/custom/path",
                    "headers" : [ {
                      "name" : "Content-Type",
                      "value" : "application/json"
                    }, {
                      "name" : "Content-Type",
                      "value" : "application/json"
                    } ],
                    "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}",
                    "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}",
                    "_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"
                      }
                    },
                    "name" : "My operation",
                    "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                    "category" : "alerts",
                    "type" : "webhook",
                    "enabled" : true,
                    "status" : "pending"
                  }, {
                    "path" : "/custom/path",
                    "headers" : [ {
                      "name" : "Content-Type",
                      "value" : "application/json"
                    }, {
                      "name" : "Content-Type",
                      "value" : "application/json"
                    } ],
                    "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}",
                    "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}",
                    "_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"
                      }
                    },
                    "name" : "My operation",
                    "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                    "category" : "alerts",
                    "type" : "webhook",
                    "enabled" : true,
                    "status" : "pending"
                  } ]
                }"""

        response_loaded_json = json.loads(response_body_json)
        response_from_json = thousandeyes_sdk.connectors.models.WebhookOperations.from_json(response_body_json)
        assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)

    def test_update_webhook_operation_models_validation(self) -> None:
        """Test case for update_webhook_operation request and response models"""
        request_body_json = """
                {
                  "path" : "/custom/path",
                  "headers" : [ {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  }, {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  } ],
                  "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}",
                  "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}",
                  "_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"
                    }
                  },
                  "name" : "My operation",
                  "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                  "category" : "alerts",
                  "type" : "webhook",
                  "enabled" : true,
                  "status" : "pending"
                }
                """

        request_loaded_json = json.loads(request_body_json)
        request_from_json = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(request_body_json)
        assert_constructed_model_matches_example_json(request_from_json, request_loaded_json)

        response_body_json = """
                {
                  "path" : "/custom/path",
                  "headers" : [ {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  }, {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  } ],
                  "payload" : "{\\"property1\\": {{numericVar}}, \\"property2\\": \\"{{stringVar}}\\"}",
                  "queryParams" : "{\\"queryParam1\\":\\"{{stringVar}}\\"}",
                  "_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"
                    }
                  },
                  "name" : "My operation",
                  "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                  "category" : "alerts",
                  "type" : "webhook",
                  "enabled" : true,
                  "status" : "pending"
                }"""

        response_loaded_json = json.loads(response_body_json)
        response_from_json = thousandeyes_sdk.connectors.models.WebhookOperation.from_json(response_body_json)
        assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)


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