# Path: mistralclient/api/client.py
# def client(auth_type='keystone', **kwargs):
#     return client_v2.Client(auth_type=auth_type, **kwargs)


import os
import tempfile
import osprofiler.profiler
from unittest import mock
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
from oslotest import base
from mistralclient.api import client



AUTH_HTTP_URL_v3 = 'http://localhost:35357/v3'
AUTH_HTTP_URL_v2_0 = 'http://localhost:35357/v2.0'
AUTH_HTTPS_URL = AUTH_HTTP_URL_v3.replace('http', 'https')
MISTRAL_HTTP_URL = 'http://localhost:8989/v2'
MISTRAL_HTTPS_URL = MISTRAL_HTTP_URL.replace('http', 'https')
PROFILER_HMAC_KEY = 'SECRET_HMAC_KEY'


class BaseClientTest(base.BaseTestCase):

    @staticmethod
    def setup_keystone_mock(session_mock):
        keystone_client_instance = session_mock.return_value
        keystone_client_instance.auth_token = uuidutils.generate_uuid()
        keystone_client_instance.project_id = uuidutils.generate_uuid()
        keystone_client_instance.user_id = uuidutils.generate_uuid()
        keystone_client_instance.auth_ref = str(jsonutils.dumps({}))
        return keystone_client_instance

    @mock.patch('keystoneauth1.session.Session')
    def test_mistral_url_from_catalog_v2(self, session_mock):
        session = mock.Mock()
        session_mock.side_effect = [session]

        get_endpoint = mock.Mock(return_value='http://mistral_host:8989/v2')
        session.get_endpoint = get_endpoint


# Path: mistralclient/api/client.py
# def client(auth_type='keystone', **kwargs):
#     return client_v2.Client(auth_type=auth_type, **kwargs)


# Path: mistralclient/tests/unit/test_client.py
import os
import tempfile
import osprofiler.profiler
from unittest import mock
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
from oslotest import base
from mistralclient.api import client




AUTH_HTTP_URL_v3 = 'http://localhost:35357/v3'
AUTH_HTTP_URL_v2_0 = 'http://localhost:35357/v2.0'
AUTH_HTTPS_URL = AUTH_HTTP_URL_v3.replace('http', 'https')
MISTRAL_HTTP_URL = 'http://localhost:8989/v2'
MISTRAL_HTTPS_URL = MISTRAL_HTTP_URL.replace('http', 'https')
PROFILER_HMAC_KEY = 'SECRET_HMAC_KEY'


class BaseClientTest(base.BaseTestCase):

    @staticmethod
    def setup_keystone_mock(session_mock):
        keystone_client_instance = session_mock.return_value
        keystone_client_instance.auth_token = uuidutils.generate_uuid()
        keystone_client_instance.project_id = uuidutils.generate_uuid()
        keystone_client_instance.user_id = uuidutils.generate_uuid()
        keystone_client_instance.auth_ref = str(jsonutils.dumps({}))
        return keystone_client_instance

    @mock.patch('keystoneauth1.session.Session')
    def test_mistral_url_from_catalog_v2(self, session_mock):
        session = mock.Mock()
        session_mock.side_effect = [session]

        get_endpoint = mock.Mock(return_value='http://mistral_host:8989/v2')
        session.get_endpoint = get_endpoint


        mistralclient = client.client(