diff --git a/glanceclient/tests/unit/v2/test_client_requests.py b/glanceclient/tests/unit/v2/test_client_requests.py index d305a4e..2332619 100644 --- a/glanceclient/tests/unit/v2/test_client_requests.py +++ b/glanceclient/tests/unit/v2/test_client_requests.py @@ -42,7 +42,7 @@ class ClientTestRequests(testutils.TestCase): def test_show_bad_image_schema(self): # if kernel_id or ramdisk_id are not uuids, verify we - # fail schema validation on 'show' + # don't fail due to schema validation self.requests = self.useFixture(rm_fixture.Fixture()) self.requests.get('http://example.com/v2/schemas/image', json=schema_fixture) @@ -50,9 +50,5 @@ class ClientTestRequests(testutils.TestCase): % image_show_fixture['id'], json=image_show_fixture) gc = client.Client(2.2, "http://example.com/v2.1") - try: - gc.images.get(image_show_fixture['id']) - self.fail('Expected exception was not raised.') - except ValueError as e: - if 'ramdisk_id' not in str(e) and 'kernel_id' not in str(e): - self.fail('Expected exception message was not returned.') + img = gc.images.get(image_show_fixture['id']) + self.assertEqual(image_show_fixture['checksum'], img['checksum']) diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py index 053cc64..5aa3e76 100644 --- a/glanceclient/v2/images.py +++ b/glanceclient/v2/images.py @@ -182,7 +182,7 @@ class Controller(object): # NOTE(bcwaldon): remove 'self' for now until we have an elegant # way to pass it into the model constructor without conflict body.pop('self', None) - return self.model(**body) + return self.unvalidated_model(**body) def data(self, image_id, do_checksum=True): """Retrieve data of an image. @@ -255,7 +255,8 @@ class Controller(object): :param remove_props: List of property names to remove :param \*\*kwargs: Image attribute names and their new values. """ - image = self.get(image_id) + unvalidated_image = self.get(image_id) + image = self.model(**unvalidated_image) for (key, value) in kwargs.items(): try: setattr(image, key, value)