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
This commit is contained in:
Dean Troyer 2017-01-20 09:56:58 -06:00 committed by Steve Lewis (stevelle)
parent 18acc704a1
commit 811941a9cb
1 changed files with 28 additions and 0 deletions

View File

@ -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')