]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix test_misc for WebOb 1.5
authorVictor Stinner <vstinner@redhat.com>
Mon, 12 Oct 2015 08:35:25 +0000 (10:35 +0200)
committerVictor Stinner <vstinner@redhat.com>
Mon, 12 Oct 2015 09:29:13 +0000 (11:29 +0200)
WebOb 1.5 was released at 2015-10-11. With this new version,
webob.exc.WSGIHTTPException() constructor now fails with a KeyError
when the HTTP status code is 0.

test_exceptions_raise() of test_misc tries to instanciate all
exceptions of cinder.exception. The problem is that
ConvertedException uses a default HTTP status code of 0.

Modify the default HTTP status code of ConvertedException to 400 to
fix the unit test. The bug is only in the test,
cinder/api/openstack/wsgi.py copies an existing HTTP code:

    Fault(exception.ConvertedException(code=ex_value.code,  ...)

Closes-Bug: #1505153
Change-Id: I1aec8038774828d48da4b0e831b390e33243809a

cinder/exception.py

index 9a2b3b6b5ae47e42bc3d9dbf1bca1b2e81ac9fb2..9367cae71854351e58339db9331325fbc69c260c 100644 (file)
@@ -46,7 +46,7 @@ CONF.register_opts(exc_log_opts)
 
 
 class ConvertedException(webob.exc.WSGIHTTPException):
-    def __init__(self, code=0, title="", explanation=""):
+    def __init__(self, code=400, title="", explanation=""):
         self.code = code
         self.title = title
         self.explanation = explanation