# 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):


import testtools
from unittest import mock
from muranoclient.common import exceptions as exc



HTML_MSG = """<html>
 <head>
  <title>403 Forbidden</title>
 </head>
 <body>
  <h1>403 Forbidden</h1>
  Access was denied to this resource.<br /><br />
 </body>
</html>"""


class TestHTTPExceptions(testtools.TestCase):
    def test_handles_json(self):
        """exc.from_response should not print JSON."""
        mock_resp = mock.Mock()
        mock_resp.status_code = 413
        mock_resp.json.return_value = {
            "overLimit": {
                "code": 413,
                "message": "OverLimit Retry...",
                "details": "Error Details...",
                "retryAt": "2015-08-31T21:21:06Z"
            }
        }
        mock_resp.headers = {
            "content-type": "application/json"
        }

# 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/tests/unit/test_exc.py
import testtools
from unittest import mock
from muranoclient.common import exceptions as exc




HTML_MSG = """<html>
 <head>
  <title>403 Forbidden</title>
 </head>
 <body>
  <h1>403 Forbidden</h1>
  Access was denied to this resource.<br /><br />
 </body>
</html>"""


class TestHTTPExceptions(testtools.TestCase):
    def test_handles_json(self):
        """exc.from_response should not print JSON."""
        mock_resp = mock.Mock()
        mock_resp.status_code = 413
        mock_resp.json.return_value = {
            "overLimit": {
                "code": 413,
                "message": "OverLimit Retry...",
                "details": "Error Details...",
                "retryAt": "2015-08-31T21:21:06Z"
            }
        }
        mock_resp.headers = {
            "content-type": "application/json"
        }

        err = exc.from_response(mock_resp)