Merge "Fix image owner field"

This commit is contained in:
Zuul
2020-05-13 05:54:41 +00:00
committed by Gerrit Code Review
4 changed files with 8 additions and 2 deletions

View File

@@ -70,7 +70,9 @@ class Image(resource.Resource, _download.DownloadMixin):
#: of images owned by others.
name = resource.Body('name')
#: The ID of the owner, or project, of the image.
owner_id = resource.Body('owner')
owner = resource.Body('owner', alias='owner_id')
#: The ID of the owner, or project, of the image. (backwards compat)
owner_id = resource.Body('owner', alias='owner')
#: Properties, if any, that are associated with the image.
properties = resource.Body('properties')
#: The size of the image data, in bytes.

View File

@@ -88,7 +88,9 @@ class Image(resource.Resource, resource.TagMixin, _download.DownloadMixin):
#: The name of the image.
name = resource.Body('name')
#: The ID of the owner, or project, of the image.
owner_id = resource.Body('owner')
owner = resource.Body('owner', alias='owner_id')
#: The ID of the owner, or project, of the image. (backwards compat)
owner_id = resource.Body('owner', alias='owner')
# TODO(mordred) This is not how this works in v2. I mean, it's how it
# should work, but it's not. We need to fix properties. They work right
# in shade, so we can draw some logic from there.

View File

@@ -61,6 +61,7 @@ class TestImage(base.TestCase):
self.assertEqual(EXAMPLE['min_disk'], sot.min_disk)
self.assertEqual(EXAMPLE['min_ram'], sot.min_ram)
self.assertEqual(EXAMPLE['name'], sot.name)
self.assertEqual(EXAMPLE['owner'], sot.owner)
self.assertEqual(EXAMPLE['owner'], sot.owner_id)
self.assertEqual(EXAMPLE['properties'], sot.properties)
self.assertTrue(sot.is_protected)

View File

@@ -168,6 +168,7 @@ class TestImage(base.TestCase):
self.assertEqual(EXAMPLE['disk_format'], sot.disk_format)
self.assertEqual(EXAMPLE['min_disk'], sot.min_disk)
self.assertEqual(EXAMPLE['name'], sot.name)
self.assertEqual(EXAMPLE['owner'], sot.owner)
self.assertEqual(EXAMPLE['owner'], sot.owner_id)
self.assertEqual(EXAMPLE['properties'], sot.properties)
self.assertFalse(sot.is_protected)