summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhiQiang Fan <zhiqiang.fan@huawei.com>2014-05-16 12:14:01 +0800
committerZhiQiang Fan <zhiqiang.fan@huawei.com>2014-05-16 12:14:01 +0800
commit09ad1ed7a3109a936f0e1bc9cbc904292607d70c (patch)
treebaa2751e32b0f6552163d68db06c18e2c571c20b
parentb2d530b7c7c96c5efd32a742136280eccfd95a49 (diff)
downloadpython-ceilometerclient-09ad1ed7a3109a936f0e1bc9cbc904292607d70c.tar.gz
Remove out-dated exceptions
There are some exceptions defined in exc module, which is introduced two years ago, and it is marked as DEPRECATED in the same time. It should be removed for now, since there are no longer used. Change-Id: I039575f37b0e6d1c30e447b74d61b8cd0b6bbd29
-rw-r--r--ceilometerclient/exc.py51
-rw-r--r--ceilometerclient/tests/test_shell.py6
2 files changed, 4 insertions, 53 deletions
diff --git a/ceilometerclient/exc.py b/ceilometerclient/exc.py
index f0620b1..dfa46de 100644
--- a/ceilometerclient/exc.py
+++ b/ceilometerclient/exc.py
@@ -35,11 +35,7 @@ class CommunicationError(BaseException):
"""Unable to communicate with server."""
-class ClientException(Exception):
- """DEPRECATED."""
-
-
-class HTTPException(ClientException):
+class HTTPException(BaseException):
"""Base exception for all HTTP-derived exceptions."""
code = 'N/A'
@@ -68,38 +64,18 @@ class HTTPMultipleChoices(HTTPException):
self.details)
-class BadRequest(HTTPException):
- """DEPRECATED."""
- code = 400
-
-
class HTTPBadRequest(HTTPException):
code = 400
-class Unauthorized(HTTPException):
- """DEPRECATED."""
- code = 401
-
-
class HTTPUnauthorized(HTTPException):
code = 401
-class Forbidden(HTTPException):
- """DEPRECATED."""
- code = 403
-
-
class HTTPForbidden(HTTPException):
code = 403
-class NotFound(HTTPException):
- """DEPRECATED."""
- code = 404
-
-
class HTTPNotFound(HTTPException):
code = 404
@@ -108,20 +84,10 @@ class HTTPMethodNotAllowed(HTTPException):
code = 405
-class Conflict(HTTPException):
- """DEPRECATED."""
- code = 409
-
-
class HTTPConflict(HTTPException):
code = 409
-class OverLimit(HTTPException):
- """DEPRECATED."""
- code = 413
-
-
class HTTPOverLimit(HTTPException):
code = 413
@@ -138,11 +104,6 @@ class HTTPBadGateway(HTTPException):
code = 502
-class ServiceUnavailable(HTTPException):
- """DEPRECATED."""
- code = 503
-
-
class HTTPServiceUnavailable(HTTPException):
code = 503
@@ -160,13 +121,3 @@ def from_response(response, details=None):
"""Return an instance of an HTTPException based on httplib response."""
cls = _code_map.get(response.status, HTTPException)
return cls(details)
-
-
-class NoTokenLookupException(Exception):
- """DEPRECATED."""
- pass
-
-
-class EndpointNotFound(Exception):
- """DEPRECATED."""
- pass
diff --git a/ceilometerclient/tests/test_shell.py b/ceilometerclient/tests/test_shell.py
index 1536abc..82329b4 100644
--- a/ceilometerclient/tests/test_shell.py
+++ b/ceilometerclient/tests/test_shell.py
@@ -97,10 +97,10 @@ class ShellTest(utils.BaseTestCase):
@mock.patch.object(ksclient, 'Client')
def test_debug_switch_raises_error(self, mock_ksclient):
- mock_ksclient.side_effect = exc.Unauthorized
+ mock_ksclient.side_effect = exc.HTTPUnauthorized
self.make_env()
args = ['--debug', 'event-list']
- self.assertRaises(exc.Unauthorized, ceilometer_shell.main, args)
+ self.assertRaises(exc.HTTPUnauthorized, ceilometer_shell.main, args)
@mock.patch.object(ksclient, 'Client')
def test_dash_d_switch_raises_error(self, mock_ksclient):
@@ -111,7 +111,7 @@ class ShellTest(utils.BaseTestCase):
@mock.patch.object(ksclient, 'Client')
def test_no_debug_switch_no_raises_errors(self, mock_ksclient):
- mock_ksclient.side_effect = exc.Unauthorized("FAIL")
+ mock_ksclient.side_effect = exc.HTTPUnauthorized("FAIL")
self.make_env()
args = ['event-list']
self.assertRaises(SystemExit, ceilometer_shell.main, args)