context = req.environ['cinder.context']
authorize(context)
if not body:
- raise webob.exc.HTTPUnprocessableEntity()
+ expl = _('Request body empty')
+ raise webob.exc.HTTPBadRequest(explanation=expl)
self._check_type(context, type_id)
if not id in body:
expl = _('Request body and URI mismatch')
self.assertRaises(webob.exc.HTTPBadRequest, self.controller.update,
req, 1, 'bad', body)
+ def _extra_specs_empty_update(self, body):
+ req = fakes.HTTPRequest.blank('/v2/fake/types/1/extra_specs')
+ req.method = 'POST'
+
+ self.assertRaises(webob.exc.HTTPBadRequest,
+ self.controller.update, req, '1', body)
+
+ def test_update_no_body(self):
+ self._extra_specs_empty_update(body=None)
+
+ def test_update_empty_body(self):
+ self._extra_specs_empty_update(body={})
+
class VolumeTypeExtraSpecsSerializerTest(test.TestCase):
def test_index_create_serializer(self):
def test_create_malformed_entity(self):
body = {'extra_specs': 'string'}
self._unprocessable_extra_specs_create(body=body)
-
- def _unprocessable_extra_specs_update(self, body):
- req = fakes.HTTPRequest.blank('/v2/fake/types/1/extra_specs')
- req.method = 'POST'
-
- self.assertRaises(webob.exc.HTTPUnprocessableEntity,
- self.controller.update, req, '1', body)
-
- def test_update_no_body(self):
- self._unprocessable_extra_specs_update(body=None)
-
- def test_update_empty_body(self):
- self._unprocessable_extra_specs_update(body={})