diff --git a/manila/exception.py b/manila/exception.py index d13cf3800a..73865184b7 100644 --- a/manila/exception.py +++ b/manila/exception.py @@ -48,7 +48,7 @@ ProcessExecutionError = processutils.ProcessExecutionError 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 diff --git a/manila/tests/test_policy.py b/manila/tests/test_policy.py index 4ec6f6552b..97a8a92f1c 100644 --- a/manila/tests/test_policy.py +++ b/manila/tests/test_policy.py @@ -17,11 +17,8 @@ import os.path -import mock from oslo_config import cfg from oslo_policy import policy as common_policy -import six -from six.moves.urllib import request as urlrequest from manila import context from manila import exception @@ -107,28 +104,6 @@ class PolicyTestCase(test.TestCase): action = "example:allowed" policy.enforce(self.context, action, self.target) - def test_enforce_http_true(self): - - def fakeurlopen(url, post_data): - return six.StringIO("True") - - action = "example:get_http" - target = {} - with mock.patch.object(urlrequest, 'urlopen', fakeurlopen): - result = policy.enforce(self.context, action, target) - self.assertTrue(result) - - def test_enforce_http_false(self): - - def fakeurlopen(url, post_data): - return six.StringIO("False") - - action = "example:get_http" - target = {} - with mock.patch.object(urlrequest, 'urlopen', fakeurlopen): - self.assertRaises(exception.PolicyNotAuthorized, policy.enforce, - self.context, action, target) - def test_templatized_enforcement(self): target_mine = {'project_id': 'fake'} target_not_mine = {'project_id': 'another'} diff --git a/test-requirements.txt b/test-requirements.txt index 423b065960..14f3efc77d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -18,4 +18,5 @@ python-subunit>=0.0.18 requests-mock>=0.6.0 # Apache-2.0 sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 testrepository>=0.0.18 +testresources>=0.2.4 testtools>=1.4.0