# 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.generic_connectors_api import GenericConnectorsApi


class TestGenericConnectorsApi(unittest.TestCase):
    """GenericConnectorsApi unit test stubs"""

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

    def tearDown(self) -> None:
        pass

    def test_create_generic_connector_models_validation(self) -> None:
        """Test case for create_generic_connector request and response models"""
        request_body_json = """
                {
                  "headers" : [ {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  }, {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  } ],
                  "lastModifiedDate" : 1770293655756,
                  "_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" : "Cisco Slack",
                  "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                  "type" : "generic",
                  "target" : "https://hooks.slack.com/services/abc/xyz",
                  "authentication" : {
                    "password" : "abc123",
                    "type" : "basic",
                    "username" : "user1"
                  }
                }
                """

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

        response_body_json = """
                {
                  "headers" : [ {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  }, {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  } ],
                  "lastModifiedDate" : 1770293655756,
                  "_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" : "Cisco Slack",
                  "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                  "type" : "generic",
                  "target" : "https://hooks.slack.com/services/abc/xyz",
                  "authentication" : {
                    "password" : "abc123",
                    "type" : "basic",
                    "username" : "user1"
                  }
                }"""

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

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


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

        response_body_json = """
                {
                  "headers" : [ {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  }, {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  } ],
                  "lastModifiedDate" : 1770293655756,
                  "_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" : "Cisco Slack",
                  "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                  "type" : "generic",
                  "target" : "https://hooks.slack.com/services/abc/xyz",
                  "authentication" : {
                    "password" : "abc123",
                    "type" : "basic",
                    "username" : "user1"
                  }
                }"""

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

    def test_get_generic_connectors_models_validation(self) -> None:
        """Test case for get_generic_connectors 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" : [ {
                    "headers" : [ {
                      "name" : "Content-Type",
                      "value" : "application/json"
                    }, {
                      "name" : "Content-Type",
                      "value" : "application/json"
                    } ],
                    "lastModifiedDate" : 1770293655756,
                    "_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" : "Cisco Slack",
                    "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                    "type" : "generic",
                    "target" : "https://hooks.slack.com/services/abc/xyz",
                    "authentication" : {
                      "password" : "abc123",
                      "type" : "basic",
                      "username" : "user1"
                    }
                  }, {
                    "headers" : [ {
                      "name" : "Content-Type",
                      "value" : "application/json"
                    }, {
                      "name" : "Content-Type",
                      "value" : "application/json"
                    } ],
                    "lastModifiedDate" : 1770293655756,
                    "_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" : "Cisco Slack",
                    "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                    "type" : "generic",
                    "target" : "https://hooks.slack.com/services/abc/xyz",
                    "authentication" : {
                      "password" : "abc123",
                      "type" : "basic",
                      "username" : "user1"
                    }
                  } ]
                }"""

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

    def test_list_generic_connector_operations_models_validation(self) -> None:
        """Test case for list_generic_connector_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" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
                }"""

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

    def test_set_generic_connector_operations_models_validation(self) -> None:
        """Test case for set_generic_connector_operations request and response models"""
        request_body_json = """
                ["ca39314d-eb4f-496f-9435-b5d20b1bfbff","a32cfbab-32f6-41d8-9027-7127cba965dd"]
                """

        request_loaded_json = json.loads(request_body_json)
        request_from_json = json.loads(request_body_json)
        self.assertEqual(request_from_json, request_loaded_json)

        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" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
                }"""

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

    def test_update_generic_connector_models_validation(self) -> None:
        """Test case for update_generic_connector request and response models"""
        request_body_json = """
                {
                  "headers" : [ {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  }, {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  } ],
                  "lastModifiedDate" : 1770293655756,
                  "_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" : "Cisco Slack",
                  "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                  "type" : "generic",
                  "target" : "https://hooks.slack.com/services/abc/xyz",
                  "authentication" : {
                    "password" : "abc123",
                    "type" : "basic",
                    "username" : "user1"
                  }
                }
                """

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

        response_body_json = """
                {
                  "headers" : [ {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  }, {
                    "name" : "Content-Type",
                    "value" : "application/json"
                  } ],
                  "lastModifiedDate" : 1770293655756,
                  "_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" : "Cisco Slack",
                  "id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
                  "type" : "generic",
                  "target" : "https://hooks.slack.com/services/abc/xyz",
                  "authentication" : {
                    "password" : "abc123",
                    "type" : "basic",
                    "username" : "user1"
                  }
                }"""

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


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