# coding: utf-8

"""
    Usage API

    These usage endpoints define the following operations:  * **Usage**: Retrieve usage data for the specified time period (default is one month).          * Users must have the `View organization usage` permission to access this endpoint.     * This operation offers visibility across all account groups within the organization.     * Users with `View organization usage` permission in multiple organizations should query the operation with the `aid` query string parameter (see optional parameters) for each organization.     * The `agentId` field in enterprise agent unit responses may be omitted when not available.  * **Quotas**: Obtain organization and account usage quotas. Additionally, users with the appropriate permissions can create, update, or delete these quotas.          * Users must have the necessary permissions to perform quota-related actions.  Refer to the Usage API operations for detailed usage instructions and optional parameters. 

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

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


import json
import unittest
import thousandeyes_sdk.usage.models

from thousandeyes_sdk.core.exceptions import ApiException
from thousandeyes_sdk.usage.api.quotas_api import QuotasApi
from .integration_test_utils import IntegrationTestBase
from .test_utils import assert_constructed_model_matches_example_json


class TestQuotasApiIntegration(IntegrationTestBase):
    """QuotasApi integration test stubs"""

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


    def test_assign_organizations_account_groups_quotas_happy_path(self) -> None:
        """Integration test for assign_organizations_account_groups_quotas success path"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  } ]
                }
        
                """
        organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json)
        response_body_json = """
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  } ]
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.assign_organizations_account_groups_quotas(

            organizations_quotas_assign=organizations_quotas_assign,

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


    def test_assign_organizations_account_groups_quotas_error_400(self) -> None:
        """Integration test for assign_organizations_account_groups_quotas error path (HTTP 400)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  } ]
                }
        
                """
        organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json)
        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.assign_organizations_account_groups_quotas(

                organizations_quotas_assign=organizations_quotas_assign,

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


    def test_assign_organizations_account_groups_quotas_error_401(self) -> None:
        """Integration test for assign_organizations_account_groups_quotas error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  } ]
                }
        
                """
        organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json)
        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_organizations_account_groups_quotas(

                organizations_quotas_assign=organizations_quotas_assign,

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


    def test_assign_organizations_account_groups_quotas_error_403(self) -> None:
        """Integration test for assign_organizations_account_groups_quotas error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  } ]
                }
        
                """
        organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json)
        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_organizations_account_groups_quotas(

                organizations_quotas_assign=organizations_quotas_assign,

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


    def test_assign_organizations_account_groups_quotas_error_404(self) -> None:
        """Integration test for assign_organizations_account_groups_quotas error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  } ]
                }
        
                """
        organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json)
        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_organizations_account_groups_quotas(

                organizations_quotas_assign=organizations_quotas_assign,

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


    def test_assign_organizations_account_groups_quotas_error_429(self) -> None:
        """Integration test for assign_organizations_account_groups_quotas error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  } ]
                }
        
                """
        organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json)
        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_organizations_account_groups_quotas(

                organizations_quotas_assign=organizations_quotas_assign,

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


    def test_assign_organizations_account_groups_quotas_error_500(self) -> None:
        """Integration test for assign_organizations_account_groups_quotas error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 12000,
                      "aid" : "1234"
                    } ]
                  } ]
                }
        
                """
        organizations_quotas_assign = thousandeyes_sdk.usage.models.OrganizationsQuotasAssign.from_json(request_body_json)
        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(500)
        ) as context:
            self.api.assign_organizations_account_groups_quotas(

                organizations_quotas_assign=organizations_quotas_assign,

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




    def test_assign_organizations_quotas_happy_path(self) -> None:
        """Integration test for assign_organizations_quotas success path"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "value" : 12000
                  }, {
                    "orgId" : "1234",
                    "value" : 10000
                  } ]
                }
        
                """
        quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json)
        response_body_json = """
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "value" : 12000
                  }, {
                    "orgId" : "12345",
                    "value" : 10000
                  } ]
                }
                """
        expected_response = json.loads(response_body_json)
        response = self.api.assign_organizations_quotas(

            quotas_assign_request=quotas_assign_request,

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


    def test_assign_organizations_quotas_error_400(self) -> None:
        """Integration test for assign_organizations_quotas error path (HTTP 400)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "value" : 12000
                  }, {
                    "orgId" : "1234",
                    "value" : 10000
                  } ]
                }
        
                """
        quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json)
        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.assign_organizations_quotas(

                quotas_assign_request=quotas_assign_request,

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


    def test_assign_organizations_quotas_error_401(self) -> None:
        """Integration test for assign_organizations_quotas error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "value" : 12000
                  }, {
                    "orgId" : "1234",
                    "value" : 10000
                  } ]
                }
        
                """
        quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json)
        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_organizations_quotas(

                quotas_assign_request=quotas_assign_request,

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


    def test_assign_organizations_quotas_error_403(self) -> None:
        """Integration test for assign_organizations_quotas error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "value" : 12000
                  }, {
                    "orgId" : "1234",
                    "value" : 10000
                  } ]
                }
        
                """
        quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json)
        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_organizations_quotas(

                quotas_assign_request=quotas_assign_request,

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


    def test_assign_organizations_quotas_error_404(self) -> None:
        """Integration test for assign_organizations_quotas error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "value" : 12000
                  }, {
                    "orgId" : "1234",
                    "value" : 10000
                  } ]
                }
        
                """
        quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json)
        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_organizations_quotas(

                quotas_assign_request=quotas_assign_request,

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


    def test_assign_organizations_quotas_error_429(self) -> None:
        """Integration test for assign_organizations_quotas error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "value" : 12000
                  }, {
                    "orgId" : "1234",
                    "value" : 10000
                  } ]
                }
        
                """
        quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json)
        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_organizations_quotas(

                quotas_assign_request=quotas_assign_request,

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


    def test_assign_organizations_quotas_error_500(self) -> None:
        """Integration test for assign_organizations_quotas error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "value" : 12000
                  }, {
                    "orgId" : "1234",
                    "value" : 10000
                  } ]
                }
        
                """
        quotas_assign_request = thousandeyes_sdk.usage.models.QuotasAssignRequest.from_json(request_body_json)
        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(500)
        ) as context:
            self.api.assign_organizations_quotas(

                quotas_assign_request=quotas_assign_request,

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




    def test_get_quotas_happy_path(self) -> None:
        """Integration test for get_quotas success path"""
        response_body_json = """
                {
                  "quotas" : [ {
                    "accountGroupQuotas" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 10000,
                      "aid" : "12345"
                    } ],
                    "organizationQuota" : {
                      "value" : 22500,
                      "orgId" : "10"
                    }
                  }, {
                    "accountGroupQuotas" : [ {
                      "value" : 12000,
                      "aid" : "1234"
                    }, {
                      "value" : 10000,
                      "aid" : "12345"
                    } ],
                    "organizationQuota" : {
                      "value" : 22500,
                      "orgId" : "10"
                    }
                  } ],
                  "_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.get_quotas(

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


    def test_get_quotas_error_400(self) -> None:
        """Integration test for get_quotas error path (HTTP 400)"""
        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.get_quotas(

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


    def test_get_quotas_error_401(self) -> None:
        """Integration test for get_quotas error path (HTTP 401)"""
        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_quotas(

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


    def test_get_quotas_error_403(self) -> None:
        """Integration test for get_quotas error path (HTTP 403)"""
        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_quotas(

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


    def test_get_quotas_error_404(self) -> None:
        """Integration test for get_quotas error path (HTTP 404)"""
        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_quotas(

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


    def test_get_quotas_error_429(self) -> None:
        """Integration test for get_quotas error path (HTTP 429)"""
        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_quotas(

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


    def test_get_quotas_error_500(self) -> None:
        """Integration test for get_quotas error path (HTTP 500)"""
        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(500)
        ) as context:
            self.api.get_quotas(

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




    def test_unassign_organizations_account_groups_quotas_happy_path(self) -> None:
        """Integration test for unassign_organizations_account_groups_quotas success path"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  } ]
                }
        
                """
        organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json)
        response = self.api.unassign_organizations_account_groups_quotas_with_http_info(

            organizations_quotas_unassign=organizations_quotas_unassign,

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


    def test_unassign_organizations_account_groups_quotas_error_400(self) -> None:
        """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 400)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  } ]
                }
        
                """
        organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json)
        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.unassign_organizations_account_groups_quotas(

                organizations_quotas_unassign=organizations_quotas_unassign,

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


    def test_unassign_organizations_account_groups_quotas_error_401(self) -> None:
        """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  } ]
                }
        
                """
        organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json)
        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_organizations_account_groups_quotas(

                organizations_quotas_unassign=organizations_quotas_unassign,

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


    def test_unassign_organizations_account_groups_quotas_error_403(self) -> None:
        """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  } ]
                }
        
                """
        organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json)
        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_organizations_account_groups_quotas(

                organizations_quotas_unassign=organizations_quotas_unassign,

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


    def test_unassign_organizations_account_groups_quotas_error_404(self) -> None:
        """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  } ]
                }
        
                """
        organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json)
        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_organizations_account_groups_quotas(

                organizations_quotas_unassign=organizations_quotas_unassign,

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


    def test_unassign_organizations_account_groups_quotas_error_429(self) -> None:
        """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  } ]
                }
        
                """
        organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json)
        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_organizations_account_groups_quotas(

                organizations_quotas_unassign=organizations_quotas_unassign,

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


    def test_unassign_organizations_account_groups_quotas_error_500(self) -> None:
        """Integration test for unassign_organizations_account_groups_quotas error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "organizations" : [ {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  }, {
                    "orgId" : "1234",
                    "accountGroups" : [ "1234", "12345" ]
                  } ]
                }
        
                """
        organizations_quotas_unassign = thousandeyes_sdk.usage.models.OrganizationsQuotasUnassign.from_json(request_body_json)
        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(500)
        ) as context:
            self.api.unassign_organizations_account_groups_quotas(

                organizations_quotas_unassign=organizations_quotas_unassign,

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




    def test_unassign_organizations_quotas_happy_path(self) -> None:
        """Integration test for unassign_organizations_quotas success path"""
        request_body_json = """
        
                {
                  "organizations" : [ "1234", "12345" ]
                }
        
                """
        quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json)
        response = self.api.unassign_organizations_quotas_with_http_info(

            quotas_unassign=quotas_unassign,

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


    def test_unassign_organizations_quotas_error_400(self) -> None:
        """Integration test for unassign_organizations_quotas error path (HTTP 400)"""
        request_body_json = """
        
                {
                  "organizations" : [ "1234", "12345" ]
                }
        
                """
        quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json)
        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.unassign_organizations_quotas(

                quotas_unassign=quotas_unassign,

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


    def test_unassign_organizations_quotas_error_401(self) -> None:
        """Integration test for unassign_organizations_quotas error path (HTTP 401)"""
        request_body_json = """
        
                {
                  "organizations" : [ "1234", "12345" ]
                }
        
                """
        quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json)
        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_organizations_quotas(

                quotas_unassign=quotas_unassign,

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


    def test_unassign_organizations_quotas_error_403(self) -> None:
        """Integration test for unassign_organizations_quotas error path (HTTP 403)"""
        request_body_json = """
        
                {
                  "organizations" : [ "1234", "12345" ]
                }
        
                """
        quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json)
        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_organizations_quotas(

                quotas_unassign=quotas_unassign,

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


    def test_unassign_organizations_quotas_error_404(self) -> None:
        """Integration test for unassign_organizations_quotas error path (HTTP 404)"""
        request_body_json = """
        
                {
                  "organizations" : [ "1234", "12345" ]
                }
        
                """
        quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json)
        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_organizations_quotas(

                quotas_unassign=quotas_unassign,

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


    def test_unassign_organizations_quotas_error_429(self) -> None:
        """Integration test for unassign_organizations_quotas error path (HTTP 429)"""
        request_body_json = """
        
                {
                  "organizations" : [ "1234", "12345" ]
                }
        
                """
        quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json)
        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_organizations_quotas(

                quotas_unassign=quotas_unassign,

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


    def test_unassign_organizations_quotas_error_500(self) -> None:
        """Integration test for unassign_organizations_quotas error path (HTTP 500)"""
        request_body_json = """
        
                {
                  "organizations" : [ "1234", "12345" ]
                }
        
                """
        quotas_unassign = thousandeyes_sdk.usage.models.QuotasUnassign.from_json(request_body_json)
        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(500)
        ) as context:
            self.api.unassign_organizations_quotas(

                quotas_unassign=quotas_unassign,

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






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