# Path: muranoclient/common/exceptions.py
# class BaseException(Exception):
# class InvalidEndpoint(BaseException):
# class CommunicationError(BaseException):
# class ClientException(Exception):
# class HTTPException(ClientException):
# class HTTPMultipleChoices(HTTPException):
# class BadRequest(HTTPException):
# class HTTPBadRequest(BadRequest):
# class Unauthorized(HTTPException):
# class HTTPUnauthorized(Unauthorized):
# class Forbidden(HTTPException):
# class HTTPForbidden(Forbidden):
# class NotFound(HTTPException):
# class HTTPNotFound(NotFound):
# class HTTPMethodNotAllowed(HTTPException):
# class Conflict(HTTPException):
# class HTTPConflict(Conflict):
# class OverLimit(HTTPException):
# class HTTPOverLimit(OverLimit):
# class HTTPInternalServerError(HTTPException):
# class HTTPNotImplemented(HTTPException):
# class HTTPBadGateway(HTTPException):
# class ServiceUnavailable(HTTPException):
# class HTTPServiceUnavailable(ServiceUnavailable):
# class NoTokenLookupException(Exception):
# class EndpointNotFound(Exception):
# class SSLConfigurationError(BaseException):
# class SSLCertificateError(BaseException):
#     def __init__(self, message=None):
#     def __str__(self):
#     def __init__(self, details=None):
#     def __str__(self):
#     def __str__(self):
# def from_response(response):
# def from_code(code):
# 
# Path: muranoclient/common/http.py
# LOG = logging.getLogger(__name__)
# USER_AGENT = 'python-muranoclient'
# CHUNKSIZE = 1024 * 64  # 64kB
# def get_system_ca_file():
#     def __init__(self, endpoint, **kwargs):
#     def _safe_header(self, name, value):
#     def log_curl_request(self, url, method, kwargs):
#     def log_http_response(resp):
#     def request(self, url, method, log=True, **kwargs):
#     def strip_endpoint(self, location):
#     def credentials_headers(self):
#     def json_request(self, url, method, content_type='application/json',
#                      **kwargs):
#     def json_patch_request(self, url, method='PATCH', **kwargs):
#     def head(self, url, **kwargs):
#     def get(self, url, **kwargs):
#     def post(self, url, **kwargs):
#     def put(self, url, **kwargs):
#     def delete(self, url, **kwargs):
#     def patch(self, url, **kwargs):
#     def request(self, url, method, **kwargs):
#     def json_request(self, url, method, **kwargs):
#     def json_patch_request(self, url, method='PATCH', **kwargs):
# def _construct_http_client(*args, **kwargs):
# def _set_data(kwargs):
# class HTTPClient(object):
# class SessionClient(keystone_adapter.Adapter):
# 
# Path: muranoclient/tests/unit/fakes.py
# class FakeHTTPResponse(object):
# class FakeRaw(object):
#     def __init__(self, status_code, reason, headers, content):
#     def getheader(self, name, default=None):
#     def getheaders(self):
#     def read(self, amt=None):
#     def iter_content(self, chunksize):
#     def json(self):


import socket
import testtools
from unittest import mock
from muranoclient.common import exceptions as exc
from muranoclient.common import http
from muranoclient.tests.unit import fakes
            headers={'Content-Type': 'application/json',
                     'User-Agent': 'python-muranoclient'})

    def test_fake_json_request(self, mock_request):
        headers = {'User-Agent': 'python-muranoclient'}
        mock_request.side_effect = [socket.gaierror]

        client = http.HTTPClient('fake://example.com:8082')
        self.assertRaises(exc.InvalidEndpoint,
                          client.request, "/", "GET")
        mock_request.assert_called_once_with('GET', 'fake://example.com:8082/',
                                             allow_redirects=False,
                                             headers=headers)

    def test_http_request_socket_error(self, mock_request):
        headers = {'User-Agent': 'python-muranoclient'}
        mock_request.side_effect = [socket.gaierror]

        client = http.HTTPClient('http://example.com:8082')
        self.assertRaises(exc.InvalidEndpoint,
                          client.request, "/", "GET")
        mock_request.assert_called_once_with('GET', 'http://example.com:8082/',
                                             allow_redirects=False,
                                             headers=headers)

    def test_http_request_socket_timeout(self, mock_request):
        headers = {'User-Agent': 'python-muranoclient'}
        mock_request.side_effect = [socket.timeout]

        client = http.HTTPClient('http://example.com:8082')

# Path: muranoclient/common/exceptions.py
# class BaseException(Exception):
# class InvalidEndpoint(BaseException):
# class CommunicationError(BaseException):
# class ClientException(Exception):
# class HTTPException(ClientException):
# class HTTPMultipleChoices(HTTPException):
# class BadRequest(HTTPException):
# class HTTPBadRequest(BadRequest):
# class Unauthorized(HTTPException):
# class HTTPUnauthorized(Unauthorized):
# class Forbidden(HTTPException):
# class HTTPForbidden(Forbidden):
# class NotFound(HTTPException):
# class HTTPNotFound(NotFound):
# class HTTPMethodNotAllowed(HTTPException):
# class Conflict(HTTPException):
# class HTTPConflict(Conflict):
# class OverLimit(HTTPException):
# class HTTPOverLimit(OverLimit):
# class HTTPInternalServerError(HTTPException):
# class HTTPNotImplemented(HTTPException):
# class HTTPBadGateway(HTTPException):
# class ServiceUnavailable(HTTPException):
# class HTTPServiceUnavailable(ServiceUnavailable):
# class NoTokenLookupException(Exception):
# class EndpointNotFound(Exception):
# class SSLConfigurationError(BaseException):
# class SSLCertificateError(BaseException):
#     def __init__(self, message=None):
#     def __str__(self):
#     def __init__(self, details=None):
#     def __str__(self):
#     def __str__(self):
# def from_response(response):
# def from_code(code):
# 
# Path: muranoclient/common/http.py
# LOG = logging.getLogger(__name__)
# USER_AGENT = 'python-muranoclient'
# CHUNKSIZE = 1024 * 64  # 64kB
# def get_system_ca_file():
#     def __init__(self, endpoint, **kwargs):
#     def _safe_header(self, name, value):
#     def log_curl_request(self, url, method, kwargs):
#     def log_http_response(resp):
#     def request(self, url, method, log=True, **kwargs):
#     def strip_endpoint(self, location):
#     def credentials_headers(self):
#     def json_request(self, url, method, content_type='application/json',
#                      **kwargs):
#     def json_patch_request(self, url, method='PATCH', **kwargs):
#     def head(self, url, **kwargs):
#     def get(self, url, **kwargs):
#     def post(self, url, **kwargs):
#     def put(self, url, **kwargs):
#     def delete(self, url, **kwargs):
#     def patch(self, url, **kwargs):
#     def request(self, url, method, **kwargs):
#     def json_request(self, url, method, **kwargs):
#     def json_patch_request(self, url, method='PATCH', **kwargs):
# def _construct_http_client(*args, **kwargs):
# def _set_data(kwargs):
# class HTTPClient(object):
# class SessionClient(keystone_adapter.Adapter):
# 
# Path: muranoclient/tests/unit/fakes.py
# class FakeHTTPResponse(object):
# class FakeRaw(object):
#     def __init__(self, status_code, reason, headers, content):
#     def getheader(self, name, default=None):
#     def getheaders(self):
#     def read(self, amt=None):
#     def iter_content(self, chunksize):
#     def json(self):


# Path: muranoclient/tests/unit/test_common_http.py
import socket
import testtools
from unittest import mock
from muranoclient.common import exceptions as exc
from muranoclient.common import http
from muranoclient.tests.unit import fakes

            headers={'Content-Type': 'application/json',
                     'User-Agent': 'python-muranoclient'})

    def test_fake_json_request(self, mock_request):
        headers = {'User-Agent': 'python-muranoclient'}
        mock_request.side_effect = [socket.gaierror]

        client = http.HTTPClient('fake://example.com:8082')
        self.assertRaises(exc.InvalidEndpoint,
                          client.request, "/", "GET")
        mock_request.assert_called_once_with('GET', 'fake://example.com:8082/',
                                             allow_redirects=False,
                                             headers=headers)

    def test_http_request_socket_error(self, mock_request):
        headers = {'User-Agent': 'python-muranoclient'}
        mock_request.side_effect = [socket.gaierror]

        client = http.HTTPClient('http://example.com:8082')
        self.assertRaises(exc.InvalidEndpoint,
                          client.request, "/", "GET")
        mock_request.assert_called_once_with('GET', 'http://example.com:8082/',
                                             allow_redirects=False,
                                             headers=headers)

    def test_http_request_socket_timeout(self, mock_request):
        headers = {'User-Agent': 'python-muranoclient'}
        mock_request.side_effect = [socket.timeout]

        client = http.HTTPClient('http://example.com:8082')

        self.assertRaises(exc.CommunicationError,