Merge "Add image update tests for is_public"

This commit is contained in:
Jenkins 2017-01-26 06:41:19 +00:00 committed by Gerrit Code Review
commit 9c7b25d6f8
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')