fix check parameters error
Closes-Bug #1822537 Change-Id: I2955a83b8c9e525b810aa5f17f9ee0f677d9bcec
This commit is contained in:
parent
6598c51fba
commit
b68009787a
|
@ -308,7 +308,7 @@ class PlansController(wsgi.Controller):
|
||||||
for key in valid_update_keys.intersection(plan):
|
for key in valid_update_keys.intersection(plan):
|
||||||
update_dict[key] = plan[key]
|
update_dict[key] = plan[key]
|
||||||
|
|
||||||
if update_dict is None:
|
if not update_dict:
|
||||||
msg = _("Missing updated parameters in request body.")
|
msg = _("Missing updated parameters in request body.")
|
||||||
raise exc.HTTPBadRequest(explanation=msg)
|
raise exc.HTTPBadRequest(explanation=msg)
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,10 @@ class PlanApiTest(base.TestCase):
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
exception.ValidationError, self.controller.update,
|
exception.ValidationError, self.controller.update,
|
||||||
req, "2a9ce1f3-cc1a-4516-9435-0ebb13caa398", body=body)
|
req, "2a9ce1f3-cc1a-4516-9435-0ebb13caa398", body=body)
|
||||||
|
body = {"plan": {}}
|
||||||
|
self.assertRaises(
|
||||||
|
exc.HTTPBadRequest, self.controller.update,
|
||||||
|
req, "2a9ce1f3-cc1a-4516-9435-0ebb13caa398", body=body)
|
||||||
|
|
||||||
def test_plan_update_InvalidId(self):
|
def test_plan_update_InvalidId(self):
|
||||||
plan = self._plan_update_request_body()
|
plan = self._plan_update_request_body()
|
||||||
|
|
Loading…
Reference in New Issue