Browse Source

fix check parameters error

Closes-Bug #1822537

Change-Id: I2955a83b8c9e525b810aa5f17f9ee0f677d9bcec
changes/11/648911/2
liushuai 2 years ago
committed by Jiao Pengju
parent
commit
b68009787a
  1. 2
      karbor/api/v1/plans.py
  2. 4
      karbor/tests/unit/api/v1/test_plans.py

2
karbor/api/v1/plans.py

@ -308,7 +308,7 @@ class PlansController(wsgi.Controller):
for key in valid_update_keys.intersection(plan):
update_dict[key] = plan[key]
if update_dict is None:
if not update_dict:
msg = _("Missing updated parameters in request body.")
raise exc.HTTPBadRequest(explanation=msg)

4
karbor/tests/unit/api/v1/test_plans.py

@ -126,6 +126,10 @@ class PlanApiTest(base.TestCase):
self.assertRaises(
exception.ValidationError, self.controller.update,
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):
plan = self._plan_update_request_body()

Loading…
Cancel
Save