From b6c1893863b4fbb282109354c63cca19b240d210 Mon Sep 17 00:00:00 2001 From: Fei Long Wang Date: Thu, 7 May 2015 11:42:26 +1200 Subject: [PATCH] Remove is_public from domain layer The pre-reserved attribute 'is_public' has been removed from the api layer, this patch will remove it from the domain layer and add an unit test for that. Closes-Bug: #1452447 Change-Id: Ie75088d95e7e0ae53df5290b33f3a184adc22239 --- glance/domain/__init__.py | 5 ++--- glance/tests/unit/test_domain.py | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/glance/domain/__init__.py b/glance/domain/__init__.py index 5ac56d261a..82346bbf92 100644 --- a/glance/domain/__init__.py +++ b/glance/domain/__init__.py @@ -53,9 +53,8 @@ def _import_delayed_delete(): class ImageFactory(object): _readonly_properties = ['created_at', 'updated_at', 'status', 'checksum', 'size', 'virtual_size'] - _reserved_properties = ['owner', 'is_public', 'locations', - 'deleted', 'deleted_at', 'direct_url', 'self', - 'file', 'schema'] + _reserved_properties = ['owner', 'locations', 'deleted', 'deleted_at', + 'direct_url', 'self', 'file', 'schema'] def _check_readonly(self, kwargs): for key in self._readonly_properties: diff --git a/glance/tests/unit/test_domain.py b/glance/tests/unit/test_domain.py index 9172abf7d9..31647e8565 100644 --- a/glance/tests/unit/test_domain.py +++ b/glance/tests/unit/test_domain.py @@ -119,6 +119,12 @@ class TestImageFactory(test_utils.BaseTestCase): self.image_factory.new_image, image_id=UUID1, extra_properties=extra_properties) + def test_new_image_for_is_public(self): + extra_prop = {'is_public': True} + new_image = self.image_factory.new_image(image_id=UUID1, + extra_properties=extra_prop) + self.assertEqual(True, new_image.extra_properties['is_public']) + class TestImage(test_utils.BaseTestCase):