Fix baymodel with invalid parameter can updated.

Now, when we update baymodel with the invalid flavor_id or
master_flavor_id parameters, the baymodel can be updated
successfully.

We need to validate the flavor_id, master_flavor, keypair and so on
before patching baymodel.

Closes-Bug: #1555490
Change-Id: I4ae3cd7c0be1161dacb6f0a80c5ee1b53d06d03d
This commit is contained in:
wangqun 2016-03-10 08:31:42 +00:00
parent bb33e1c6ec
commit 7ddee99fbf

View File

@ -177,17 +177,8 @@ class BayTest(base.BaseMagnumTest):
self.assertEqual(resp.status, 201)
self.assertIsNotNone(baymodel.uuid)
patch_model = datagen.baymodel_flavor_patch_data()
resp, new_model = self.baymodel_client.patch_baymodel(
baymodel.uuid, patch_model)
self.assertEqual(200, resp.status)
resp, model = self.baymodel_client.get_baymodel(new_model.uuid)
self.assertEqual(200, resp.status)
self.assertEqual(baymodel.uuid, new_model.uuid)
self.assertEqual(model.flavor_id, new_model.flavor_id)
gen_model = datagen.valid_bay_data(baymodel_id=baymodel.uuid)
gen_model.flavor_id = 'aaa'
self.assertRaises(
exceptions.BadRequest,
self.bay_client.post_bay, gen_model)