From 811941a9cbb57e9d28bd5eaf2081e27e8d2fd81a Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 20 Jan 2017 09:56:58 -0600 Subject: [PATCH] Add image update tests for is_public These tests check the value of the is_public attribute after attempting to set it in an image update. Before https://review.openstack.org/369110 these work, after test_update_image_private() fails. https://review.openstack.org/#/c/423499/ fixes the regression, let's add these tests from the Every-Little-Bit-Helps Dept. to verify one last time. Depends-on: I996fbed2e31df8559c025cca31e5e12c4fb76548 Change-Id: I992da5c291036279c84bff53b83661e461f80ad1 --- glance/tests/unit/v1/test_registry_client.py | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/glance/tests/unit/v1/test_registry_client.py b/glance/tests/unit/v1/test_registry_client.py index 8ad0a0aff0..6be1c3d379 100644 --- a/glance/tests/unit/v1/test_registry_client.py +++ b/glance/tests/unit/v1/test_registry_client.py @@ -754,6 +754,34 @@ class TestRegistryV1Client(base.IsolatedUnitTest, test_utils.RegistryAPIMixIn): for k, v in fixture.items(): self.assertEqual(v, data[k]) + def test_update_image_public(self): + """Tests that the /images PUT registry API updates the image""" + fixture = {'name': 'fake public image #2', + 'is_public': True, + 'disk_format': 'vmdk'} + + self.assertTrue(self.client.update_image(UUID2, fixture)) + + # Test all other attributes set + data = self.client.get_image(UUID2) + + for k, v in fixture.items(): + self.assertEqual(v, data[k]) + + def test_update_image_private(self): + """Tests that the /images PUT registry API updates the image""" + fixture = {'name': 'fake public image #2', + 'is_public': False, + 'disk_format': 'vmdk'} + + self.assertTrue(self.client.update_image(UUID2, fixture)) + + # Test all other attributes set + data = self.client.get_image(UUID2) + + for k, v in fixture.items(): + self.assertEqual(v, data[k]) + def test_update_image_not_existing(self): """Tests non existing image update doesn't work""" fixture = self.get_fixture(status='bad status')