Merge "Derivate most of the RestClient's exception from the failureException"
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 824198f..5888913 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -296,7 +296,7 @@
if resp.status >= 400:
resp_body = self._parse_resp(resp_body)
self._log(req_url, body, resp, resp_body)
- raise exceptions.TempestException(str(resp.status))
+ raise exceptions.RestClientException(str(resp.status))
return resp, resp_body
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 178c2f2..de22688 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -15,6 +15,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import unittest2 as unittest
+
class TempestException(Exception):
"""
@@ -27,6 +29,7 @@
message = "An unknown exception occurred"
def __init__(self, *args, **kwargs):
+ super(TempestException, self).__init__()
try:
self._error_string = self.message % kwargs
except Exception:
@@ -49,11 +52,16 @@
message = "Invalid Configuration"
-class NotFound(TempestException):
+class RestClientException(TempestException,
+ unittest.TestCase.failureException):
+ pass
+
+
+class NotFound(RestClientException):
message = "Object not found"
-class Unauthorized(TempestException):
+class Unauthorized(RestClientException):
message = 'Unauthorized'
@@ -78,11 +86,11 @@
message = "Volume %(volume_id)s failed to build and is in ERROR status"
-class BadRequest(TempestException):
+class BadRequest(RestClientException):
message = "Bad request"
-class AuthenticationFailure(TempestException):
+class AuthenticationFailure(RestClientException):
message = ("Authentication with user %(user)s and password "
"%(password)s failed")
@@ -108,7 +116,7 @@
message = "Got identity error"
-class Duplicate(TempestException):
+class Duplicate(RestClientException):
message = "An object with that identifier already exists"
@@ -135,7 +143,7 @@
message = "%(num)d cleanUp operation failed"
-class RFCViolation(TempestException):
+class RFCViolation(RestClientException):
message = "RFC Violation"