# 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.tag_assignment_api import TagAssignmentApi
from .integration_test_utils import IntegrationTestBase
from .test_utils import assert_constructed_model_matches_example_json


class TestTagAssignmentApiIntegration(IntegrationTestBase):
    """TagAssignmentApi integration test stubs"""

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


    def test_assign_tag_happy_path(self) -> None:
        """Integration test for assign_tag success path"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.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"
                  } ],
                  "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                  "_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"
                    }
                  }
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.assign_tag(

            id=id,

            tag_assignment=tag_assignment,

            aid=aid,

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


    def test_assign_tag_error_401(self) -> None:
        """Integration test for assign_tag error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.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.assign_tag(

                id=id,

                tag_assignment=tag_assignment,

                aid=aid,

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


    def test_assign_tag_error_403(self) -> None:
        """Integration test for assign_tag error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.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.assign_tag(

                id=id,

                tag_assignment=tag_assignment,

                aid=aid,

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


    def test_assign_tag_error_404(self) -> None:
        """Integration test for assign_tag error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.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.assign_tag(

                id=id,

                tag_assignment=tag_assignment,

                aid=aid,

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


    def test_assign_tag_error_429(self) -> None:
        """Integration test for assign_tag error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.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.assign_tag(

                id=id,

                tag_assignment=tag_assignment,

                aid=aid,

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


    def test_assign_tag_error_500(self) -> None:
        """Integration test for assign_tag error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.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.assign_tag(

                id=id,

                tag_assignment=tag_assignment,

                aid=aid,

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




    def test_assign_tags_happy_path(self) -> None:
        """Integration test for assign_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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.assign_tags(

            bulk_tag_assignments=bulk_tag_assignments,

            aid=aid,

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


    def test_assign_tags_error_401(self) -> None:
        """Integration test for assign_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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.assign_tags(

                bulk_tag_assignments=bulk_tag_assignments,

                aid=aid,

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


    def test_assign_tags_error_403(self) -> None:
        """Integration test for assign_tags error path (HTTP 403)"""
        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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.from_json(request_body_json)
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(403)
        ) as context:
            self.api.assign_tags(

                bulk_tag_assignments=bulk_tag_assignments,

                aid=aid,

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


    def test_assign_tags_error_404(self) -> None:
        """Integration test for assign_tags error path (HTTP 404)"""
        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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.from_json(request_body_json)
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(404)
        ) as context:
            self.api.assign_tags(

                bulk_tag_assignments=bulk_tag_assignments,

                aid=aid,

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


    def test_assign_tags_error_429(self) -> None:
        """Integration test for assign_tags error path (HTTP 429)"""
        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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.from_json(request_body_json)
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(429)
        ) as context:
            self.api.assign_tags(

                bulk_tag_assignments=bulk_tag_assignments,

                aid=aid,

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


    def test_assign_tags_error_500(self) -> None:
        """Integration test for assign_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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.assign_tags(

                bulk_tag_assignments=bulk_tag_assignments,

                aid=aid,

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




    def test_unassign_tag_happy_path(self) -> None:
        """Integration test for unassign_tag success path"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.from_json(request_body_json)
        id = 'c6b78e57-81a2-4c5f-a11a-d96c3c664d55'
        aid = '1234'
        response = self.api.unassign_tag_with_http_info(

            id=id,

            tag_assignment=tag_assignment,

            aid=aid,

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


    def test_unassign_tag_error_401(self) -> None:
        """Integration test for unassign_tag error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.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.unassign_tag(

                id=id,

                tag_assignment=tag_assignment,

                aid=aid,

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


    def test_unassign_tag_error_403(self) -> None:
        """Integration test for unassign_tag error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.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.unassign_tag(

                id=id,

                tag_assignment=tag_assignment,

                aid=aid,

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


    def test_unassign_tag_error_404(self) -> None:
        """Integration test for unassign_tag error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.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.unassign_tag(

                id=id,

                tag_assignment=tag_assignment,

                aid=aid,

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


    def test_unassign_tag_error_429(self) -> None:
        """Integration test for unassign_tag error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.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.unassign_tag(

                id=id,

                tag_assignment=tag_assignment,

                aid=aid,

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


    def test_unassign_tag_error_500(self) -> None:
        """Integration test for unassign_tag error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "assignments" : [ {
                    "id" : "123",
                    "type" : "test"
                  }, {
                    "id" : "123",
                    "type" : "test"
                  } ]
                }
        
                """
        tag_assignment = thousandeyes_sdk.tags.models.TagAssignment.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.unassign_tag(

                id=id,

                tag_assignment=tag_assignment,

                aid=aid,

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




    def test_unassign_tags_happy_path(self) -> None:
        """Integration test for unassign_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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.unassign_tags(

            bulk_tag_assignments=bulk_tag_assignments,

            aid=aid,

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


    def test_unassign_tags_error_401(self) -> None:
        """Integration test for unassign_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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.unassign_tags(

                bulk_tag_assignments=bulk_tag_assignments,

                aid=aid,

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


    def test_unassign_tags_error_403(self) -> None:
        """Integration test for unassign_tags error path (HTTP 403)"""
        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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.from_json(request_body_json)
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(403)
        ) as context:
            self.api.unassign_tags(

                bulk_tag_assignments=bulk_tag_assignments,

                aid=aid,

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


    def test_unassign_tags_error_404(self) -> None:
        """Integration test for unassign_tags error path (HTTP 404)"""
        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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.from_json(request_body_json)
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(404)
        ) as context:
            self.api.unassign_tags(

                bulk_tag_assignments=bulk_tag_assignments,

                aid=aid,

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


    def test_unassign_tags_error_429(self) -> None:
        """Integration test for unassign_tags error path (HTTP 429)"""
        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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.from_json(request_body_json)
        aid = '1234'
        error_body_json = """
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }
                """
        expected_error = json.loads(error_body_json)
        with self.assertRaises(
            ApiException.exception_class_for_http_status(429)
        ) as context:
            self.api.unassign_tags(

                bulk_tag_assignments=bulk_tag_assignments,

                aid=aid,

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


    def test_unassign_tags_error_500(self) -> None:
        """Integration test for unassign_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"
                    }
                  },
                  "tags" : [ {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  }, {
                    "assignments" : [ {
                      "id" : "123",
                      "type" : "test"
                    }, {
                      "id" : "123",
                      "type" : "test"
                    } ],
                    "tagId" : "c6b78e57-81a2-4c5f-a11a-d96c3c664d55",
                    "_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"
                      }
                    }
                  } ]
                }
        
                """
        bulk_tag_assignments = thousandeyes_sdk.tags.models.BulkTagAssignments.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.unassign_tags(

                bulk_tag_assignments=bulk_tag_assignments,

                aid=aid,

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






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