# coding: utf-8

"""
    Tags API

    The ThousandEyes Tags API provides a tagging system with key/value pairs. It allows you to tag assets within the ThousandEyes platform (such as agents, tests, or dashboards) with meaningful metadata. For example: `branch:sfo`, `branch:nyc`, and `team:netops`.  This feature provides:  * Support for automation. * Powerful and flexible reports/dashboards. * Support for third-party integrations.  Things to note with the ThousandEyes Tags API:  * Tags are backwards-compatible with existing labels. * Tags are separated by Tests (CEA), Agents (CEA), Endpoint Agents, Scheduled Endpoint Tests, and Reports. A single tag can only apply to one type of target object, so each tag must specify the target type of object via a `type` field. * Tags are defined in a single table so that they can be represented using a single model - `Tag`. 

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

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


import json
import unittest
import thousandeyes_sdk.tags.models

from thousandeyes_sdk.core.exceptions import ApiException
from thousandeyes_sdk.tags.api.tags_api import TagsApi
from .integration_test_utils import IntegrationTestBase
from .test_utils import assert_constructed_model_matches_example_json


class TestTagsApiIntegration(IntegrationTestBase):
    """TagsApi integration test stubs"""

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


    def test_create_tag_happy_path(self) -> None:
        """Integration test for create_tag success path"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
        
                """
        tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json)
        aid = '1234'
        response_body_json = """
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "_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"
                    }
                  },
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.create_tag(

            aid=aid,

            tag_info=tag_info,

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


    def test_create_tag_error_400(self) -> None:
        """Integration test for create_tag error path (HTTP 400)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
        
                """
        tag_info = thousandeyes_sdk.tags.models.TagInfo.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_tag(

                aid=aid,

                tag_info=tag_info,

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


    def test_create_tag_error_401(self) -> None:
        """Integration test for create_tag error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
        
                """
        tag_info = thousandeyes_sdk.tags.models.TagInfo.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_tag(

                aid=aid,

                tag_info=tag_info,

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


    def test_create_tag_error_500(self) -> None:
        """Integration test for create_tag error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
        
                """
        tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json)
        aid = '1234'
        error_body_json = """
                {
                  "path" : "https://api.thousandeyes.com/v7/request/path",
                  "errors" : "Internal Server Error",
                  "timestamp" : 1679677853573,
                  "status" : 500
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(500)
        ) as context:
            self.api.create_tag(

                aid=aid,

                tag_info=tag_info,

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




    def test_create_tags_happy_path(self) -> None:
        """Integration test for create_tags success path"""
        request_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"
                    }
                  },
                  "errors" : [ {
                    "tag" : {
                      "key" : {
                        "assignments" : [ {
                          "id" : "123",
                          "type" : "test"
                        }, {
                          "id" : "123",
                          "type" : "test"
                        } ],
                        "color" : "#FF0000",
                        "matchType" : "and",
                        "builtIn" : true,
                        "icon" : "icon",
                        "description" : "To tag assets in San Francisco",
                        "filters" : [ {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        }, {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        } ],
                        "type" : "static",
                        "objectType" : "test",
                        "accessType" : "all",
                        "modifiedDate" : "2022-03-01T23:31:11Z",
                        "legacyId" : 0.8008281904610115,
                        "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                        "aid" : 1234,
                        "value" : "sfo",
                        "key" : "branch",
                        "createDate" : "2022-03-01T23:31:11Z"
                      }
                    },
                    "message" : "Object successfully created",
                    "responseCode" : 200
                  }, {
                    "tag" : {
                      "key" : {
                        "assignments" : [ {
                          "id" : "123",
                          "type" : "test"
                        }, {
                          "id" : "123",
                          "type" : "test"
                        } ],
                        "color" : "#FF0000",
                        "matchType" : "and",
                        "builtIn" : true,
                        "icon" : "icon",
                        "description" : "To tag assets in San Francisco",
                        "filters" : [ {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        }, {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        } ],
                        "type" : "static",
                        "objectType" : "test",
                        "accessType" : "all",
                        "modifiedDate" : "2022-03-01T23:31:11Z",
                        "legacyId" : 0.8008281904610115,
                        "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                        "aid" : 1234,
                        "value" : "sfo",
                        "key" : "branch",
                        "createDate" : "2022-03-01T23:31:11Z"
                      }
                    },
                    "message" : "Object successfully created",
                    "responseCode" : 200
                  } ],
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  } ]
                }
        
                """
        bulk_tag_response = thousandeyes_sdk.tags.models.BulkTagResponse.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"
                    }
                  },
                  "errors" : [ {
                    "tag" : {
                      "key" : {
                        "assignments" : [ {
                          "id" : "123",
                          "type" : "test"
                        }, {
                          "id" : "123",
                          "type" : "test"
                        } ],
                        "color" : "#FF0000",
                        "matchType" : "and",
                        "builtIn" : true,
                        "icon" : "icon",
                        "description" : "To tag assets in San Francisco",
                        "filters" : [ {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        }, {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        } ],
                        "type" : "static",
                        "objectType" : "test",
                        "accessType" : "all",
                        "modifiedDate" : "2022-03-01T23:31:11Z",
                        "legacyId" : 0.8008281904610115,
                        "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                        "aid" : 1234,
                        "value" : "sfo",
                        "key" : "branch",
                        "createDate" : "2022-03-01T23:31:11Z"
                      }
                    },
                    "message" : "Object successfully created",
                    "responseCode" : 200
                  }, {
                    "tag" : {
                      "key" : {
                        "assignments" : [ {
                          "id" : "123",
                          "type" : "test"
                        }, {
                          "id" : "123",
                          "type" : "test"
                        } ],
                        "color" : "#FF0000",
                        "matchType" : "and",
                        "builtIn" : true,
                        "icon" : "icon",
                        "description" : "To tag assets in San Francisco",
                        "filters" : [ {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        }, {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        } ],
                        "type" : "static",
                        "objectType" : "test",
                        "accessType" : "all",
                        "modifiedDate" : "2022-03-01T23:31:11Z",
                        "legacyId" : 0.8008281904610115,
                        "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                        "aid" : 1234,
                        "value" : "sfo",
                        "key" : "branch",
                        "createDate" : "2022-03-01T23:31:11Z"
                      }
                    },
                    "message" : "Object successfully created",
                    "responseCode" : 200
                  } ],
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  } ]
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.create_tags(

            aid=aid,

            bulk_tag_response=bulk_tag_response,

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


    def test_create_tags_error_400(self) -> None:
        """Integration test for create_tags error path (HTTP 400)"""
        request_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"
                    }
                  },
                  "errors" : [ {
                    "tag" : {
                      "key" : {
                        "assignments" : [ {
                          "id" : "123",
                          "type" : "test"
                        }, {
                          "id" : "123",
                          "type" : "test"
                        } ],
                        "color" : "#FF0000",
                        "matchType" : "and",
                        "builtIn" : true,
                        "icon" : "icon",
                        "description" : "To tag assets in San Francisco",
                        "filters" : [ {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        }, {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        } ],
                        "type" : "static",
                        "objectType" : "test",
                        "accessType" : "all",
                        "modifiedDate" : "2022-03-01T23:31:11Z",
                        "legacyId" : 0.8008281904610115,
                        "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                        "aid" : 1234,
                        "value" : "sfo",
                        "key" : "branch",
                        "createDate" : "2022-03-01T23:31:11Z"
                      }
                    },
                    "message" : "Object successfully created",
                    "responseCode" : 200
                  }, {
                    "tag" : {
                      "key" : {
                        "assignments" : [ {
                          "id" : "123",
                          "type" : "test"
                        }, {
                          "id" : "123",
                          "type" : "test"
                        } ],
                        "color" : "#FF0000",
                        "matchType" : "and",
                        "builtIn" : true,
                        "icon" : "icon",
                        "description" : "To tag assets in San Francisco",
                        "filters" : [ {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        }, {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        } ],
                        "type" : "static",
                        "objectType" : "test",
                        "accessType" : "all",
                        "modifiedDate" : "2022-03-01T23:31:11Z",
                        "legacyId" : 0.8008281904610115,
                        "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                        "aid" : 1234,
                        "value" : "sfo",
                        "key" : "branch",
                        "createDate" : "2022-03-01T23:31:11Z"
                      }
                    },
                    "message" : "Object successfully created",
                    "responseCode" : 200
                  } ],
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  } ]
                }
        
                """
        bulk_tag_response = thousandeyes_sdk.tags.models.BulkTagResponse.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_tags(

                aid=aid,

                bulk_tag_response=bulk_tag_response,

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


    def test_create_tags_error_401(self) -> None:
        """Integration test for create_tags error path (HTTP 401)"""
        request_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"
                    }
                  },
                  "errors" : [ {
                    "tag" : {
                      "key" : {
                        "assignments" : [ {
                          "id" : "123",
                          "type" : "test"
                        }, {
                          "id" : "123",
                          "type" : "test"
                        } ],
                        "color" : "#FF0000",
                        "matchType" : "and",
                        "builtIn" : true,
                        "icon" : "icon",
                        "description" : "To tag assets in San Francisco",
                        "filters" : [ {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        }, {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        } ],
                        "type" : "static",
                        "objectType" : "test",
                        "accessType" : "all",
                        "modifiedDate" : "2022-03-01T23:31:11Z",
                        "legacyId" : 0.8008281904610115,
                        "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                        "aid" : 1234,
                        "value" : "sfo",
                        "key" : "branch",
                        "createDate" : "2022-03-01T23:31:11Z"
                      }
                    },
                    "message" : "Object successfully created",
                    "responseCode" : 200
                  }, {
                    "tag" : {
                      "key" : {
                        "assignments" : [ {
                          "id" : "123",
                          "type" : "test"
                        }, {
                          "id" : "123",
                          "type" : "test"
                        } ],
                        "color" : "#FF0000",
                        "matchType" : "and",
                        "builtIn" : true,
                        "icon" : "icon",
                        "description" : "To tag assets in San Francisco",
                        "filters" : [ {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        }, {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        } ],
                        "type" : "static",
                        "objectType" : "test",
                        "accessType" : "all",
                        "modifiedDate" : "2022-03-01T23:31:11Z",
                        "legacyId" : 0.8008281904610115,
                        "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                        "aid" : 1234,
                        "value" : "sfo",
                        "key" : "branch",
                        "createDate" : "2022-03-01T23:31:11Z"
                      }
                    },
                    "message" : "Object successfully created",
                    "responseCode" : 200
                  } ],
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  } ]
                }
        
                """
        bulk_tag_response = thousandeyes_sdk.tags.models.BulkTagResponse.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_tags(

                aid=aid,

                bulk_tag_response=bulk_tag_response,

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


    def test_create_tags_error_500(self) -> None:
        """Integration test for create_tags error path (HTTP 500)"""
        request_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"
                    }
                  },
                  "errors" : [ {
                    "tag" : {
                      "key" : {
                        "assignments" : [ {
                          "id" : "123",
                          "type" : "test"
                        }, {
                          "id" : "123",
                          "type" : "test"
                        } ],
                        "color" : "#FF0000",
                        "matchType" : "and",
                        "builtIn" : true,
                        "icon" : "icon",
                        "description" : "To tag assets in San Francisco",
                        "filters" : [ {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        }, {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        } ],
                        "type" : "static",
                        "objectType" : "test",
                        "accessType" : "all",
                        "modifiedDate" : "2022-03-01T23:31:11Z",
                        "legacyId" : 0.8008281904610115,
                        "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                        "aid" : 1234,
                        "value" : "sfo",
                        "key" : "branch",
                        "createDate" : "2022-03-01T23:31:11Z"
                      }
                    },
                    "message" : "Object successfully created",
                    "responseCode" : 200
                  }, {
                    "tag" : {
                      "key" : {
                        "assignments" : [ {
                          "id" : "123",
                          "type" : "test"
                        }, {
                          "id" : "123",
                          "type" : "test"
                        } ],
                        "color" : "#FF0000",
                        "matchType" : "and",
                        "builtIn" : true,
                        "icon" : "icon",
                        "description" : "To tag assets in San Francisco",
                        "filters" : [ {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        }, {
                          "mode" : "in",
                          "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                          "scope" : "custom",
                          "key" : "vpn-client-network"
                        } ],
                        "type" : "static",
                        "objectType" : "test",
                        "accessType" : "all",
                        "modifiedDate" : "2022-03-01T23:31:11Z",
                        "legacyId" : 0.8008281904610115,
                        "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                        "aid" : 1234,
                        "value" : "sfo",
                        "key" : "branch",
                        "createDate" : "2022-03-01T23:31:11Z"
                      }
                    },
                    "message" : "Object successfully created",
                    "responseCode" : 200
                  } ],
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  } ]
                }
        
                """
        bulk_tag_response = thousandeyes_sdk.tags.models.BulkTagResponse.from_json(request_body_json)
        aid = '1234'
        error_body_json = """
                {
                  "path" : "https://api.thousandeyes.com/v7/request/path",
                  "errors" : "Internal Server Error",
                  "timestamp" : 1679677853573,
                  "status" : 500
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(500)
        ) as context:
            self.api.create_tags(

                aid=aid,

                bulk_tag_response=bulk_tag_response,

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




    def test_delete_tag_happy_path(self) -> None:
        """Integration test for delete_tag success path"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        aid = '1234'
        response = self.api.delete_tag_with_http_info(

            id=id,

            aid=aid,

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


    def test_delete_tag_error_401(self) -> None:
        """Integration test for delete_tag error path (HTTP 401)"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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_tag(

                id=id,

                aid=aid,

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


    def test_delete_tag_error_403(self) -> None:
        """Integration test for delete_tag error path (HTTP 403)"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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.delete_tag(

                id=id,

                aid=aid,

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


    def test_delete_tag_error_404(self) -> None:
        """Integration test for delete_tag error path (HTTP 404)"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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.delete_tag(

                id=id,

                aid=aid,

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


    def test_delete_tag_error_429(self) -> None:
        """Integration test for delete_tag error path (HTTP 429)"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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.delete_tag(

                id=id,

                aid=aid,

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


    def test_delete_tag_error_500(self) -> None:
        """Integration test for delete_tag error path (HTTP 500)"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        aid = '1234'
        error_body_json = """
                {
                  "path" : "https://api.thousandeyes.com/v7/request/path",
                  "errors" : "Internal Server Error",
                  "timestamp" : 1679677853573,
                  "status" : 500
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(500)
        ) as context:
            self.api.delete_tag(

                id=id,

                aid=aid,

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




    def test_get_tag_happy_path(self) -> None:
        """Integration test for get_tag success path"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        aid = '1234'
        response_body_json = """
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "_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"
                    }
                  },
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.get_tag(

            id=id,

            aid=aid,

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


    def test_get_tag_error_401(self) -> None:
        """Integration test for get_tag error path (HTTP 401)"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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_tag(

                id=id,

                aid=aid,

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


    def test_get_tag_error_403(self) -> None:
        """Integration test for get_tag error path (HTTP 403)"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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_tag(

                id=id,

                aid=aid,

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


    def test_get_tag_error_404(self) -> None:
        """Integration test for get_tag error path (HTTP 404)"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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_tag(

                id=id,

                aid=aid,

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


    def test_get_tag_error_429(self) -> None:
        """Integration test for get_tag error path (HTTP 429)"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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_tag(

                id=id,

                aid=aid,

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


    def test_get_tag_error_500(self) -> None:
        """Integration test for get_tag error path (HTTP 500)"""
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        aid = '1234'
        error_body_json = """
                {
                  "path" : "https://api.thousandeyes.com/v7/request/path",
                  "errors" : "Internal Server Error",
                  "timestamp" : 1679677853573,
                  "status" : 500
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(500)
        ) as context:
            self.api.get_tag(

                id=id,

                aid=aid,

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




    def test_get_tags_happy_path(self) -> None:
        """Integration test for get_tags 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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "color" : "#FF0000",
                    "_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"
                      }
                    },
                    "matchType" : "and",
                    "builtIn" : true,
                    "icon" : "icon",
                    "description" : "To tag assets in San Francisco",
                    "filters" : [ {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    }, {
                      "mode" : "in",
                      "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                      "scope" : "custom",
                      "key" : "vpn-client-network"
                    } ],
                    "type" : "static",
                    "objectType" : "test",
                    "accessType" : "all",
                    "modifiedDate" : "2022-03-01T23:31:11Z",
                    "legacyId" : 0.8008281904610115,
                    "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                    "aid" : 1234,
                    "value" : "sfo",
                    "key" : "branch",
                    "createDate" : "2022-03-01T23:31:11Z"
                  } ]
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.get_tags(

            aid=aid,

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


    def test_get_tags_error_401(self) -> None:
        """Integration test for get_tags 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_tags(

                aid=aid,

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


    def test_get_tags_error_403(self) -> None:
        """Integration test for get_tags error path (HTTP 403)"""
        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_tags(

                aid=aid,

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


    def test_get_tags_error_404(self) -> None:
        """Integration test for get_tags error path (HTTP 404)"""
        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_tags(

                aid=aid,

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


    def test_get_tags_error_429(self) -> None:
        """Integration test for get_tags error path (HTTP 429)"""
        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_tags(

                aid=aid,

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


    def test_get_tags_error_500(self) -> None:
        """Integration test for get_tags error path (HTTP 500)"""
        aid = '1234'
        error_body_json = """
                {
                  "path" : "https://api.thousandeyes.com/v7/request/path",
                  "errors" : "Internal Server Error",
                  "timestamp" : 1679677853573,
                  "status" : 500
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(500)
        ) as context:
            self.api.get_tags(

                aid=aid,

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




    def test_update_tag_happy_path(self) -> None:
        """Integration test for update_tag success path"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
        
                """
        tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json)
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        aid = '1234'
        response_body_json = """
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "_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"
                    }
                  },
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.update_tag(

            id=id,

            aid=aid,

            tag_info=tag_info,

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


    def test_update_tag_error_401(self) -> None:
        """Integration test for update_tag error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
        
                """
        tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json)
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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_tag(

                id=id,

                aid=aid,

                tag_info=tag_info,

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


    def test_update_tag_error_403(self) -> None:
        """Integration test for update_tag error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
        
                """
        tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json)
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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.update_tag(

                id=id,

                aid=aid,

                tag_info=tag_info,

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


    def test_update_tag_error_404(self) -> None:
        """Integration test for update_tag error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
        
                """
        tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json)
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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.update_tag(

                id=id,

                aid=aid,

                tag_info=tag_info,

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


    def test_update_tag_error_429(self) -> None:
        """Integration test for update_tag error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
        
                """
        tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json)
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        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.update_tag(

                id=id,

                aid=aid,

                tag_info=tag_info,

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


    def test_update_tag_error_500(self) -> None:
        """Integration test for update_tag error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ],
                  "color" : "#FF0000",
                  "matchType" : "and",
                  "builtIn" : true,
                  "icon" : "icon",
                  "description" : "To tag assets in San Francisco",
                  "filters" : [ {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  }, {
                    "mode" : "in",
                    "values" : [ "10.1.1.0/24", "192.168.1.0/24" ],
                    "scope" : "custom",
                    "key" : "vpn-client-network"
                  } ],
                  "type" : "static",
                  "objectType" : "test",
                  "accessType" : "all",
                  "modifiedDate" : "2022-03-01T23:31:11Z",
                  "legacyId" : 0.8008281904610115,
                  "id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
                  "aid" : 1234,
                  "value" : "sfo",
                  "key" : "branch",
                  "createDate" : "2022-03-01T23:31:11Z"
                }
        
                """
        tag_info = thousandeyes_sdk.tags.models.TagInfo.from_json(request_body_json)
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        aid = '1234'
        error_body_json = """
                {
                  "path" : "https://api.thousandeyes.com/v7/request/path",
                  "errors" : "Internal Server Error",
                  "timestamp" : 1679677853573,
                  "status" : 500
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(500)
        ) as context:
            self.api.update_tag(

                id=id,

                aid=aid,

                tag_info=tag_info,

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






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