Add func test to validate baymodel-update referenced by bay

This patch https://review.openstack.org/#/c/266420/ disallowed
baymodel-update when it is referenced by bay(s).
For regression, add to have func test coverage for that.

Change-Id: I4db767da900e48af0234bded3aaf371557c0bfcd
Closes-Bug: #1533746
This commit is contained in:
wangqun 2016-01-28 06:52:11 +00:00
parent a28251726d
commit c4d030fae6
1 changed files with 7 additions and 1 deletions

View File

@ -140,7 +140,7 @@ class BayTest(base.BaseMagnumTest):
self.bay_client.post_bay, gen_model)
@testtools.testcase.attr('negative')
def test_update_bay_name_for_existing_bay(self):
def test_update_bay_baymodel_name_for_existing_bay(self):
first_model = datagen.valid_bay_data(baymodel_id=self.baymodel.uuid,
name='test')
_, old_model = self._create_bay(first_model)
@ -151,6 +151,12 @@ class BayTest(base.BaseMagnumTest):
self.bay_client.patch_bay,
old_model.uuid, patch_model)
patch_baymodel = datagen.baymodel_name_patch_data()
self.assertRaises(
exceptions.BadRequest,
self.baymodel_client.patch_baymodel,
self.baymodel.uuid, patch_baymodel)
@testtools.testcase.attr('negative')
def test_update_bay_for_nonexisting_bay(self):
patch_model = datagen.bay_name_patch_data()