# coding: utf-8

"""
    Endpoint Instant Scheduled Tests API

    You can create and execute a new endpoint instant scheduled test within ThousandEyes using this API. The test parameters are specified in the `POST` data.  The following applies to the Endpoint Instant Scheduled Tests API:  * To initiate the creation and execution of an instant scheduled test, the user must possess the `Edit endpoint tests` permission.  * Upon successful creation of an instant scheduled test, the API responds with an HTTP/201 CREATED status code and return the test definition. * It's important to note that the response does not include the results of the instant scheduled test. To retrieve test results, users can utilize the Endpoint Test Data endpoints. The URLs for these API test data endpoints are provided within the test definition output when an instant scheduled test is created. 

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

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


import unittest

from thousandeyes_sdk.core.api_client import ApiClient
from thousandeyes_sdk.core.configuration import Configuration
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer

from .mock_manifest import OPERATION_MANIFEST


class IntegrationTestBase(unittest.TestCase):
    def setUp(self) -> None:
        self.server = MockApiServer(OPERATION_MANIFEST)
        self.server.start()
        configuration = Configuration(host=self.server.base_url, access_token="test-token")
        self.api_client = ApiClient(configuration=configuration)

    def tearDown(self) -> None:
        self.server.stop()

    def te_headers(self, operation_id: str, error_status=None):
        headers = {OPERATION_ID_HEADER: operation_id}
        if error_status is not None:
            headers[ERROR_STATUS_HEADER] = error_status
        return headers
