Simplify image and access_record responses
This removes the container around individual image and access_record entities in GET /images/<ID> and GET /images/<ID>/access/<TENANT>. Response bodies used to look like '{"image": {...}}', while now they look like '{...}'. Fix bug 1031185 Change-Id: I1eacee2d877f5dde3612b3d4006d4caf489f49e1
This commit is contained in:
parent
c901c6a050
commit
eeedad3333
@ -124,8 +124,7 @@ class ResponseSerializer(wsgi.JSONResponseSerializer):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def show(self, response, access):
|
def show(self, response, access):
|
||||||
record = {'access_record': self._format_access(access)}
|
response.body = json.dumps(self._format_access(access))
|
||||||
response.body = json.dumps(record)
|
|
||||||
response.content_type = 'application/json'
|
response.content_type = 'application/json'
|
||||||
|
|
||||||
def index(self, response, result):
|
def index(self, response, result):
|
||||||
@ -144,7 +143,7 @@ class ResponseSerializer(wsgi.JSONResponseSerializer):
|
|||||||
response.status_int = 201
|
response.status_int = 201
|
||||||
response.location = self._get_access_href(access['image_id'],
|
response.location = self._get_access_href(access['image_id'],
|
||||||
access['member'])
|
access['member'])
|
||||||
response.body = json.dumps({'access': self._format_access(access)})
|
response.body = json.dumps(self._format_access(access))
|
||||||
response.content_type = 'application/json'
|
response.content_type = 'application/json'
|
||||||
|
|
||||||
def delete(self, response, result):
|
def delete(self, response, result):
|
||||||
|
@ -277,16 +277,16 @@ class ResponseSerializer(wsgi.JSONResponseSerializer):
|
|||||||
image[key] = timeutils.isotime(value)
|
image[key] = timeutils.isotime(value)
|
||||||
|
|
||||||
def create(self, response, image):
|
def create(self, response, image):
|
||||||
response.body = json.dumps({'image': self._format_image(image)})
|
response.body = json.dumps(self._format_image(image))
|
||||||
response.content_type = 'application/json'
|
response.content_type = 'application/json'
|
||||||
response.location = self._get_image_href(image)
|
response.location = self._get_image_href(image)
|
||||||
|
|
||||||
def show(self, response, image):
|
def show(self, response, image):
|
||||||
response.body = json.dumps({'image': self._format_image(image)})
|
response.body = json.dumps(self._format_image(image))
|
||||||
response.content_type = 'application/json'
|
response.content_type = 'application/json'
|
||||||
|
|
||||||
def update(self, response, image):
|
def update(self, response, image):
|
||||||
response.body = json.dumps({'image': self._format_image(image)})
|
response.body = json.dumps(self._format_image(image))
|
||||||
response.content_type = 'application/json'
|
response.content_type = 'application/json'
|
||||||
|
|
||||||
def index(self, response, result):
|
def index(self, response, result):
|
||||||
|
@ -140,7 +140,7 @@ class BaseCacheMiddlewareTest(object):
|
|||||||
body=json.dumps(image_entity))
|
body=json.dumps(image_entity))
|
||||||
self.assertEqual(response.status, 200)
|
self.assertEqual(response.status, 200)
|
||||||
data = json.loads(content)
|
data = json.loads(content)
|
||||||
image_id = data['image']['id']
|
image_id = data['id']
|
||||||
|
|
||||||
path = "http://%s:%d/v2/images/%s/file" % ("0.0.0.0", self.api_port,
|
path = "http://%s:%d/v2/images/%s/file" % ("0.0.0.0", self.api_port,
|
||||||
image_id)
|
image_id)
|
||||||
|
@ -68,7 +68,7 @@ class TestImages(functional.FunctionalTest):
|
|||||||
image_location_header = response.headers['Location']
|
image_location_header = response.headers['Location']
|
||||||
|
|
||||||
# Returned image entity should have a generated id
|
# Returned image entity should have a generated id
|
||||||
image = json.loads(response.text)['image']
|
image = json.loads(response.text)
|
||||||
image_id = image['id']
|
image_id = image['id']
|
||||||
|
|
||||||
# Image list should now have one entry
|
# Image list should now have one entry
|
||||||
@ -82,7 +82,7 @@ class TestImages(functional.FunctionalTest):
|
|||||||
# Get the image using the returned Location header
|
# Get the image using the returned Location header
|
||||||
response = requests.get(image_location_header, headers=self._headers())
|
response = requests.get(image_location_header, headers=self._headers())
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
image = json.loads(response.text)['image']
|
image = json.loads(response.text)
|
||||||
self.assertEqual(image_id, image['id'])
|
self.assertEqual(image_id, image['id'])
|
||||||
self.assertEqual(None, image['checksum'])
|
self.assertEqual(None, image['checksum'])
|
||||||
self.assertEqual(None, image['size'])
|
self.assertEqual(None, image['size'])
|
||||||
@ -100,7 +100,7 @@ class TestImages(functional.FunctionalTest):
|
|||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
|
|
||||||
# Returned image entity should reflect the changes
|
# Returned image entity should reflect the changes
|
||||||
image = json.loads(response.text)['image']
|
image = json.loads(response.text)
|
||||||
self.assertEqual('image-2', image['name'])
|
self.assertEqual('image-2', image['name'])
|
||||||
self.assertEqual('vhd', image['format'])
|
self.assertEqual('vhd', image['format'])
|
||||||
self.assertEqual('baz', image['foo'])
|
self.assertEqual('baz', image['foo'])
|
||||||
@ -110,7 +110,7 @@ class TestImages(functional.FunctionalTest):
|
|||||||
path = self._url('/v2/images/%s' % image_id)
|
path = self._url('/v2/images/%s' % image_id)
|
||||||
response = requests.get(path, headers=self._headers())
|
response = requests.get(path, headers=self._headers())
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
image = json.loads(response.text)['image']
|
image = json.loads(response.text)
|
||||||
self.assertEqual(image_id, image['id'])
|
self.assertEqual(image_id, image['id'])
|
||||||
self.assertEqual('image-2', image['name'])
|
self.assertEqual('image-2', image['name'])
|
||||||
self.assertEqual('baz', image['foo'])
|
self.assertEqual('baz', image['foo'])
|
||||||
@ -132,7 +132,7 @@ class TestImages(functional.FunctionalTest):
|
|||||||
path = self._url('/v2/images/%s' % image_id)
|
path = self._url('/v2/images/%s' % image_id)
|
||||||
response = requests.get(path, headers=self._headers())
|
response = requests.get(path, headers=self._headers())
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
image = json.loads(response.text)['image']
|
image = json.loads(response.text)
|
||||||
self.assertEqual('8f113e38d28a79a5a451b16048cc2b72', image['checksum'])
|
self.assertEqual('8f113e38d28a79a5a451b16048cc2b72', image['checksum'])
|
||||||
|
|
||||||
# Try to download the data that was just uploaded
|
# Try to download the data that was just uploaded
|
||||||
@ -155,7 +155,7 @@ class TestImages(functional.FunctionalTest):
|
|||||||
headers = self._headers()
|
headers = self._headers()
|
||||||
response = requests.get(path, headers=headers)
|
response = requests.get(path, headers=headers)
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
self.assertEqual(5, json.loads(response.text)['image']['size'])
|
self.assertEqual(5, json.loads(response.text)['size'])
|
||||||
|
|
||||||
# Deletion should work
|
# Deletion should work
|
||||||
path = self._url('/v2/images/%s' % image_id)
|
path = self._url('/v2/images/%s' % image_id)
|
||||||
@ -189,7 +189,7 @@ class TestImages(functional.FunctionalTest):
|
|||||||
data = json.dumps({'name': 'image-1'})
|
data = json.dumps({'name': 'image-1'})
|
||||||
response = requests.post(path, headers=headers, data=data)
|
response = requests.post(path, headers=headers, data=data)
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
image_id = json.loads(response.text)['image']['id']
|
image_id = json.loads(response.text)['id']
|
||||||
|
|
||||||
# TENANT1 should see the image in their list
|
# TENANT1 should see the image in their list
|
||||||
path = self._url('/v2/images')
|
path = self._url('/v2/images')
|
||||||
@ -326,7 +326,7 @@ class TestImages(functional.FunctionalTest):
|
|||||||
data = json.dumps({'name': 'image-1'})
|
data = json.dumps({'name': 'image-1'})
|
||||||
response = requests.post(path, headers=headers, data=data)
|
response = requests.post(path, headers=headers, data=data)
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
image_id = json.loads(response.text)['image']['id']
|
image_id = json.loads(response.text)['id']
|
||||||
|
|
||||||
# Image acccess list should be empty
|
# Image acccess list should be empty
|
||||||
path = self._url('/v2/images/%s/access' % image_id)
|
path = self._url('/v2/images/%s/access' % image_id)
|
||||||
@ -417,13 +417,13 @@ class TestImages(functional.FunctionalTest):
|
|||||||
data = json.dumps({'name': 'image-1', 'tags': ['sniff']})
|
data = json.dumps({'name': 'image-1', 'tags': ['sniff']})
|
||||||
response = requests.post(path, headers=headers, data=data)
|
response = requests.post(path, headers=headers, data=data)
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
image_id = json.loads(response.text)['image']['id']
|
image_id = json.loads(response.text)['id']
|
||||||
|
|
||||||
# Image should show a list with a single tag
|
# Image should show a list with a single tag
|
||||||
path = self._url('/v2/images/%s' % image_id)
|
path = self._url('/v2/images/%s' % image_id)
|
||||||
response = requests.get(path, headers=self._headers())
|
response = requests.get(path, headers=self._headers())
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
tags = json.loads(response.text)['image']['tags']
|
tags = json.loads(response.text)['tags']
|
||||||
self.assertEqual(['sniff'], tags)
|
self.assertEqual(['sniff'], tags)
|
||||||
|
|
||||||
# Create another more complex tag
|
# Create another more complex tag
|
||||||
@ -435,7 +435,7 @@ class TestImages(functional.FunctionalTest):
|
|||||||
path = self._url('/v2/images/%s' % image_id)
|
path = self._url('/v2/images/%s' % image_id)
|
||||||
response = requests.get(path, headers=self._headers())
|
response = requests.get(path, headers=self._headers())
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
tags = json.loads(response.text)['image']['tags']
|
tags = json.loads(response.text)['tags']
|
||||||
self.assertEqual(['sniff', 'gabe@example.com'], tags)
|
self.assertEqual(['sniff', 'gabe@example.com'], tags)
|
||||||
|
|
||||||
# The tag should be deletable
|
# The tag should be deletable
|
||||||
@ -447,7 +447,7 @@ class TestImages(functional.FunctionalTest):
|
|||||||
path = self._url('/v2/images/%s' % image_id)
|
path = self._url('/v2/images/%s' % image_id)
|
||||||
response = requests.get(path, headers=self._headers())
|
response = requests.get(path, headers=self._headers())
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
tags = json.loads(response.text)['image']['tags']
|
tags = json.loads(response.text)['tags']
|
||||||
self.assertEqual(['sniff'], tags)
|
self.assertEqual(['sniff'], tags)
|
||||||
|
|
||||||
# Deleting the same tag should return a 404
|
# Deleting the same tag should return a 404
|
||||||
@ -485,7 +485,7 @@ class TestImages(functional.FunctionalTest):
|
|||||||
data = json.dumps(fixture)
|
data = json.dumps(fixture)
|
||||||
response = requests.post(path, headers=headers, data=data)
|
response = requests.post(path, headers=headers, data=data)
|
||||||
self.assertEqual(200, response.status_code)
|
self.assertEqual(200, response.status_code)
|
||||||
images.append(json.loads(response.text)['image'])
|
images.append(json.loads(response.text))
|
||||||
|
|
||||||
# Image list should contain 7 images
|
# Image list should contain 7 images
|
||||||
path = self._url('/v2/images')
|
path = self._url('/v2/images')
|
||||||
|
@ -152,13 +152,11 @@ class TestImageAccessSerializer(test_utils.BaseTestCase):
|
|||||||
self_href = ('/v2/images/%s/access/%s' %
|
self_href = ('/v2/images/%s/access/%s' %
|
||||||
(unit_test_utils.UUID1, unit_test_utils.TENANT1))
|
(unit_test_utils.UUID1, unit_test_utils.TENANT1))
|
||||||
expected = {
|
expected = {
|
||||||
'access_record': {
|
'tenant_id': unit_test_utils.TENANT1,
|
||||||
'tenant_id': unit_test_utils.TENANT1,
|
'can_share': False,
|
||||||
'can_share': False,
|
'self': self_href,
|
||||||
'self': self_href,
|
'schema': '/v2/schemas/image/access',
|
||||||
'schema': '/v2/schemas/image/access',
|
'image': '/v2/images/%s' % unit_test_utils.UUID1,
|
||||||
'image': '/v2/images/%s' % unit_test_utils.UUID1,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
response = webob.Response()
|
response = webob.Response()
|
||||||
self.serializer.show(response, fixture)
|
self.serializer.show(response, fixture)
|
||||||
@ -237,13 +235,11 @@ class TestImageAccessSerializer(test_utils.BaseTestCase):
|
|||||||
self_href = ('/v2/images/%s/access/%s' %
|
self_href = ('/v2/images/%s/access/%s' %
|
||||||
(unit_test_utils.UUID1, unit_test_utils.TENANT1))
|
(unit_test_utils.UUID1, unit_test_utils.TENANT1))
|
||||||
expected = {
|
expected = {
|
||||||
'access': {
|
'tenant_id': unit_test_utils.TENANT1,
|
||||||
'tenant_id': unit_test_utils.TENANT1,
|
'can_share': False,
|
||||||
'can_share': False,
|
'self': self_href,
|
||||||
'self': self_href,
|
'schema': '/v2/schemas/image/access',
|
||||||
'schema': '/v2/schemas/image/access',
|
'image': '/v2/images/%s' % unit_test_utils.UUID1,
|
||||||
'image': '/v2/images/%s' % unit_test_utils.UUID1,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
response = webob.Response()
|
response = webob.Response()
|
||||||
self.serializer.create(response, fixture)
|
self.serializer.create(response, fixture)
|
||||||
|
@ -993,21 +993,19 @@ class TestImagesSerializer(test_utils.BaseTestCase):
|
|||||||
'size': 1024,
|
'size': 1024,
|
||||||
}
|
}
|
||||||
expected = {
|
expected = {
|
||||||
'image': {
|
'id': unit_test_utils.UUID2,
|
||||||
'id': unit_test_utils.UUID2,
|
'name': 'image-2',
|
||||||
'name': 'image-2',
|
'owner': TENANT2,
|
||||||
'owner': TENANT2,
|
'visibility': 'public',
|
||||||
'visibility': 'public',
|
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
||||||
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
'created_at': ISOTIME,
|
||||||
'created_at': ISOTIME,
|
'updated_at': ISOTIME,
|
||||||
'updated_at': ISOTIME,
|
'tags': ['three', 'four'],
|
||||||
'tags': ['three', 'four'],
|
'size': 1024,
|
||||||
'size': 1024,
|
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
||||||
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
||||||
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
||||||
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
'schema': '/v2/schemas/image',
|
||||||
'schema': '/v2/schemas/image',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
response = webob.Response()
|
response = webob.Response()
|
||||||
self.serializer.show(response, fixture)
|
self.serializer.show(response, fixture)
|
||||||
@ -1029,21 +1027,19 @@ class TestImagesSerializer(test_utils.BaseTestCase):
|
|||||||
}
|
}
|
||||||
self_link = '/v2/images/%s' % unit_test_utils.UUID2
|
self_link = '/v2/images/%s' % unit_test_utils.UUID2
|
||||||
expected = {
|
expected = {
|
||||||
'image': {
|
'id': unit_test_utils.UUID2,
|
||||||
'id': unit_test_utils.UUID2,
|
'name': 'image-2',
|
||||||
'name': 'image-2',
|
'owner': TENANT2,
|
||||||
'owner': TENANT2,
|
'visibility': 'private',
|
||||||
'visibility': 'private',
|
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
||||||
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
'created_at': ISOTIME,
|
||||||
'created_at': ISOTIME,
|
'updated_at': ISOTIME,
|
||||||
'updated_at': ISOTIME,
|
'tags': [],
|
||||||
'tags': [],
|
'size': 1024,
|
||||||
'size': 1024,
|
'self': self_link,
|
||||||
'self': self_link,
|
'file': '%s/file' % self_link,
|
||||||
'file': '%s/file' % self_link,
|
'access': '%s/access' % self_link,
|
||||||
'access': '%s/access' % self_link,
|
'schema': '/v2/schemas/image',
|
||||||
'schema': '/v2/schemas/image',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
response = webob.Response()
|
response = webob.Response()
|
||||||
self.serializer.create(response, fixture)
|
self.serializer.create(response, fixture)
|
||||||
@ -1066,21 +1062,19 @@ class TestImagesSerializer(test_utils.BaseTestCase):
|
|||||||
}
|
}
|
||||||
self_link = '/v2/images/%s' % unit_test_utils.UUID2
|
self_link = '/v2/images/%s' % unit_test_utils.UUID2
|
||||||
expected = {
|
expected = {
|
||||||
'image': {
|
'id': unit_test_utils.UUID2,
|
||||||
'id': unit_test_utils.UUID2,
|
'name': 'image-2',
|
||||||
'name': 'image-2',
|
'owner': TENANT2,
|
||||||
'owner': TENANT2,
|
'visibility': 'public',
|
||||||
'visibility': 'public',
|
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
||||||
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
'created_at': ISOTIME,
|
||||||
'created_at': ISOTIME,
|
'updated_at': ISOTIME,
|
||||||
'updated_at': ISOTIME,
|
'tags': ['five'],
|
||||||
'tags': ['five'],
|
'size': 1024,
|
||||||
'size': 1024,
|
'self': self_link,
|
||||||
'self': self_link,
|
'file': '%s/file' % self_link,
|
||||||
'file': '%s/file' % self_link,
|
'access': '%s/access' % self_link,
|
||||||
'access': '%s/access' % self_link,
|
'schema': '/v2/schemas/image',
|
||||||
'schema': '/v2/schemas/image',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
response = webob.Response()
|
response = webob.Response()
|
||||||
self.serializer.update(response, fixture)
|
self.serializer.update(response, fixture)
|
||||||
@ -1118,22 +1112,20 @@ class TestImagesSerializerWithExtendedSchema(test_utils.BaseTestCase):
|
|||||||
|
|
||||||
def test_show(self):
|
def test_show(self):
|
||||||
expected = {
|
expected = {
|
||||||
'image': {
|
'id': unit_test_utils.UUID2,
|
||||||
'id': unit_test_utils.UUID2,
|
'name': 'image-2',
|
||||||
'name': 'image-2',
|
'owner': TENANT2,
|
||||||
'owner': TENANT2,
|
'visibility': 'private',
|
||||||
'visibility': 'private',
|
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
||||||
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
'created_at': ISOTIME,
|
||||||
'created_at': ISOTIME,
|
'updated_at': ISOTIME,
|
||||||
'updated_at': ISOTIME,
|
'tags': [],
|
||||||
'tags': [],
|
'size': 1024,
|
||||||
'size': 1024,
|
'color': 'green',
|
||||||
'color': 'green',
|
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
||||||
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
||||||
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
||||||
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
'schema': '/v2/schemas/image',
|
||||||
'schema': '/v2/schemas/image',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
response = webob.Response()
|
response = webob.Response()
|
||||||
self.serializer.show(response, self.fixture)
|
self.serializer.show(response, self.fixture)
|
||||||
@ -1142,22 +1134,20 @@ class TestImagesSerializerWithExtendedSchema(test_utils.BaseTestCase):
|
|||||||
def test_show_reports_invalid_data(self):
|
def test_show_reports_invalid_data(self):
|
||||||
self.fixture['properties']['color'] = 'invalid'
|
self.fixture['properties']['color'] = 'invalid'
|
||||||
expected = {
|
expected = {
|
||||||
'image': {
|
'id': unit_test_utils.UUID2,
|
||||||
'id': unit_test_utils.UUID2,
|
'name': 'image-2',
|
||||||
'name': 'image-2',
|
'owner': TENANT2,
|
||||||
'owner': TENANT2,
|
'visibility': 'private',
|
||||||
'visibility': 'private',
|
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
||||||
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
'created_at': ISOTIME,
|
||||||
'created_at': ISOTIME,
|
'updated_at': ISOTIME,
|
||||||
'updated_at': ISOTIME,
|
'tags': [],
|
||||||
'tags': [],
|
'size': 1024,
|
||||||
'size': 1024,
|
'color': 'invalid',
|
||||||
'color': 'invalid',
|
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
||||||
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
||||||
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
||||||
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
'schema': '/v2/schemas/image',
|
||||||
'schema': '/v2/schemas/image',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
response = webob.Response()
|
response = webob.Response()
|
||||||
self.serializer.show(response, self.fixture)
|
self.serializer.show(response, self.fixture)
|
||||||
@ -1187,22 +1177,20 @@ class TestImagesSerializerWithAdditionalProperties(test_utils.BaseTestCase):
|
|||||||
def test_show(self):
|
def test_show(self):
|
||||||
serializer = glance.api.v2.images.ResponseSerializer()
|
serializer = glance.api.v2.images.ResponseSerializer()
|
||||||
expected = {
|
expected = {
|
||||||
'image': {
|
'id': unit_test_utils.UUID2,
|
||||||
'id': unit_test_utils.UUID2,
|
'name': 'image-2',
|
||||||
'name': 'image-2',
|
'owner': TENANT2,
|
||||||
'owner': TENANT2,
|
'visibility': 'private',
|
||||||
'visibility': 'private',
|
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
||||||
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
'created_at': ISOTIME,
|
||||||
'created_at': ISOTIME,
|
'updated_at': ISOTIME,
|
||||||
'updated_at': ISOTIME,
|
'marx': 'groucho',
|
||||||
'marx': 'groucho',
|
'tags': [],
|
||||||
'tags': [],
|
'size': 1024,
|
||||||
'size': 1024,
|
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
||||||
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
||||||
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
||||||
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
'schema': '/v2/schemas/image',
|
||||||
'schema': '/v2/schemas/image',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
response = webob.Response()
|
response = webob.Response()
|
||||||
serializer.show(response, self.fixture)
|
serializer.show(response, self.fixture)
|
||||||
@ -1215,22 +1203,20 @@ class TestImagesSerializerWithAdditionalProperties(test_utils.BaseTestCase):
|
|||||||
serializer = glance.api.v2.images.ResponseSerializer()
|
serializer = glance.api.v2.images.ResponseSerializer()
|
||||||
self.fixture['properties']['marx'] = 123
|
self.fixture['properties']['marx'] = 123
|
||||||
expected = {
|
expected = {
|
||||||
'image': {
|
'id': unit_test_utils.UUID2,
|
||||||
'id': unit_test_utils.UUID2,
|
'name': 'image-2',
|
||||||
'name': 'image-2',
|
'owner': TENANT2,
|
||||||
'owner': TENANT2,
|
'visibility': 'private',
|
||||||
'visibility': 'private',
|
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
||||||
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
'created_at': ISOTIME,
|
||||||
'created_at': ISOTIME,
|
'updated_at': ISOTIME,
|
||||||
'updated_at': ISOTIME,
|
'marx': 123,
|
||||||
'marx': 123,
|
'tags': [],
|
||||||
'tags': [],
|
'size': 1024,
|
||||||
'size': 1024,
|
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
||||||
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
||||||
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
||||||
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
'schema': '/v2/schemas/image',
|
||||||
'schema': '/v2/schemas/image',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
response = webob.Response()
|
response = webob.Response()
|
||||||
serializer.show(response, self.fixture)
|
serializer.show(response, self.fixture)
|
||||||
@ -1240,21 +1226,19 @@ class TestImagesSerializerWithAdditionalProperties(test_utils.BaseTestCase):
|
|||||||
self.config(allow_additional_image_properties=False)
|
self.config(allow_additional_image_properties=False)
|
||||||
serializer = glance.api.v2.images.ResponseSerializer()
|
serializer = glance.api.v2.images.ResponseSerializer()
|
||||||
expected = {
|
expected = {
|
||||||
'image': {
|
'id': unit_test_utils.UUID2,
|
||||||
'id': unit_test_utils.UUID2,
|
'name': 'image-2',
|
||||||
'name': 'image-2',
|
'owner': TENANT2,
|
||||||
'owner': TENANT2,
|
'visibility': 'private',
|
||||||
'visibility': 'private',
|
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
||||||
'checksum': 'ca425b88f047ce8ec45ee90e813ada91',
|
'created_at': ISOTIME,
|
||||||
'created_at': ISOTIME,
|
'updated_at': ISOTIME,
|
||||||
'updated_at': ISOTIME,
|
'tags': [],
|
||||||
'tags': [],
|
'size': 1024,
|
||||||
'size': 1024,
|
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
||||||
'self': '/v2/images/%s' % unit_test_utils.UUID2,
|
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
||||||
'file': '/v2/images/%s/file' % unit_test_utils.UUID2,
|
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
||||||
'access': '/v2/images/%s/access' % unit_test_utils.UUID2,
|
'schema': '/v2/schemas/image',
|
||||||
'schema': '/v2/schemas/image',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
response = webob.Response()
|
response = webob.Response()
|
||||||
serializer.show(response, self.fixture)
|
serializer.show(response, self.fixture)
|
||||||
|
Loading…
Reference in New Issue
Block a user