# Path: barbicanclient/client.py
# LOG = logging.getLogger(__name__)
# _DEFAULT_SERVICE_TYPE = 'key-manager'
# _DEFAULT_SERVICE_INTERFACE = 'public'
# _DEFAULT_API_VERSION = 'v1'
# _SUPPORTED_API_VERSION_MAP = {'v1': 'barbicanclient.v1.client.Client'}
# class _HTTPClient(adapter.Adapter):
# class _LazyImporter(object):
#     def __init__(self, session, project_id=None, **kwargs):
#     def request(self, *args, **kwargs):
#     def get(self, *args, **kwargs):
#     def post(self, path, *args, **kwargs):
#     def _fix_path(self, path):
#     def _get_raw(self, path, *args, **kwargs):
#     def _check_status_code(self, resp):
#     def _get_error_message(self, resp):
# def Client(version=None, session=None, *args, **kwargs):
# def env(*vars, **kwargs):
#     def __init__(self, module):
#     def __getattr__(self, name):
# 
# Path: barbicanclient/exceptions.py
# class BarbicanException(Exception):
# class PayloadException(BarbicanException):
# class UnsupportedVersion(BarbicanException):
# class HTTPError(Exception):
# class HTTPServerError(HTTPError):
# class HTTPClientError(HTTPError):
# class HTTPAuthError(HTTPError):
#     def __init__(self, message, status_code=0):
#     def __init__(self, message, status_code=401):


from unittest import mock
from keystoneauth1 import session
from requests_mock.contrib import fixture
from barbicanclient import client
from barbicanclient import exceptions
import testtools
    def test_delete_passes_json(self):
        json = {"test": "test"}
        self.httpclient.delete(self.href, json=json)
        self.assertEqual('{"test": "test"}', self.del_mock.last_request.text)

    def test_delete_includes_default_headers(self):
        self.httpclient._default_headers = {'Test-Default-Header': 'test'}
        self.httpclient.delete(self.href)
        self.assertEqual(
            'test',
            self.del_mock.last_request.headers['Test-Default-Header'])

    def test_delete_checks_status_code(self):
        self.httpclient._check_status_code = mock.MagicMock()
        self.httpclient.delete(self.href)
        self.httpclient._check_status_code.assert_has_calls([])


class WhenTestingCheckStatusCodes(TestClient):

    def test_raises_http_auth_error_for_401_response(self):
        resp = mock.MagicMock()
        resp.status_code = 401
        self.assertRaises(exceptions.HTTPAuthError,
                          self.httpclient._check_status_code,
                          resp)

    def test_raises_http_server_error_for_500_response(self):
        resp = mock.MagicMock()
        resp.status_code = 500

# Path: barbicanclient/client.py
# LOG = logging.getLogger(__name__)
# _DEFAULT_SERVICE_TYPE = 'key-manager'
# _DEFAULT_SERVICE_INTERFACE = 'public'
# _DEFAULT_API_VERSION = 'v1'
# _SUPPORTED_API_VERSION_MAP = {'v1': 'barbicanclient.v1.client.Client'}
# class _HTTPClient(adapter.Adapter):
# class _LazyImporter(object):
#     def __init__(self, session, project_id=None, **kwargs):
#     def request(self, *args, **kwargs):
#     def get(self, *args, **kwargs):
#     def post(self, path, *args, **kwargs):
#     def _fix_path(self, path):
#     def _get_raw(self, path, *args, **kwargs):
#     def _check_status_code(self, resp):
#     def _get_error_message(self, resp):
# def Client(version=None, session=None, *args, **kwargs):
# def env(*vars, **kwargs):
#     def __init__(self, module):
#     def __getattr__(self, name):
# 
# Path: barbicanclient/exceptions.py
# class BarbicanException(Exception):
# class PayloadException(BarbicanException):
# class UnsupportedVersion(BarbicanException):
# class HTTPError(Exception):
# class HTTPServerError(HTTPError):
# class HTTPClientError(HTTPError):
# class HTTPAuthError(HTTPError):
#     def __init__(self, message, status_code=0):
#     def __init__(self, message, status_code=401):


# Path: barbicanclient/tests/test_client.py
from unittest import mock
from keystoneauth1 import session
from requests_mock.contrib import fixture
from barbicanclient import client
from barbicanclient import exceptions
import testtools

    def test_delete_passes_json(self):
        json = {"test": "test"}
        self.httpclient.delete(self.href, json=json)
        self.assertEqual('{"test": "test"}', self.del_mock.last_request.text)

    def test_delete_includes_default_headers(self):
        self.httpclient._default_headers = {'Test-Default-Header': 'test'}
        self.httpclient.delete(self.href)
        self.assertEqual(
            'test',
            self.del_mock.last_request.headers['Test-Default-Header'])

    def test_delete_checks_status_code(self):
        self.httpclient._check_status_code = mock.MagicMock()
        self.httpclient.delete(self.href)
        self.httpclient._check_status_code.assert_has_calls([])


class WhenTestingCheckStatusCodes(TestClient):

    def test_raises_http_auth_error_for_401_response(self):
        resp = mock.MagicMock()
        resp.status_code = 401
        self.assertRaises(exceptions.HTTPAuthError,
                          self.httpclient._check_status_code,
                          resp)

    def test_raises_http_server_error_for_500_response(self):
        resp = mock.MagicMock()
        resp.status_code = 500

        self.assertRaises(exceptions.HTTPServerError,