From 2911427ace17d148cdcd2cdb706e5606b17d42b4 Mon Sep 17 00:00:00 2001 From: wangqun Date: Thu, 28 Jan 2016 06:52:11 +0000 Subject: [PATCH] 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 --- magnum/tests/functional/api/v1/test_bay.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/magnum/tests/functional/api/v1/test_bay.py b/magnum/tests/functional/api/v1/test_bay.py index d91cd37562..29dd6f0d5b 100644 --- a/magnum/tests/functional/api/v1/test_bay.py +++ b/magnum/tests/functional/api/v1/test_bay.py @@ -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()