Merge "Change image client methods to return one value"
diff --git a/tempest/api/compute/images/test_image_metadata.py b/tempest/api/compute/images/test_image_metadata.py
index 5105e2f..38e55b1 100644
--- a/tempest/api/compute/images/test_image_metadata.py
+++ b/tempest/api/compute/images/test_image_metadata.py
@@ -37,10 +37,10 @@
cls.image_id = None
name = data_utils.rand_name('image')
- resp, body = cls.glance_client.create_image(name=name,
- container_format='bare',
- disk_format='raw',
- is_public=False)
+ body = cls.glance_client.create_image(name=name,
+ container_format='bare',
+ disk_format='raw',
+ is_public=False)
cls.image_id = body['id']
cls.images.append(cls.image_id)
image_file = StringIO.StringIO(('*' * 1024))
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index ceab4f9..d9a7201 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -42,10 +42,10 @@
def _create_image():
name = data_utils.rand_name('image')
- _, body = cls.glance_client.create_image(name=name,
- container_format='bare',
- disk_format='raw',
- is_public=False)
+ body = cls.glance_client.create_image(name=name,
+ container_format='bare',
+ disk_format='raw',
+ is_public=False)
image_id = body['id']
cls.images.append(image_id)
# Wait 1 second between creation and upload to ensure a delta
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 28deaa7..76c858b 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -290,12 +290,11 @@
'backup_type': "daily",
'instance_uuid': self.server_id,
}
- resp, image_list = self.os.image_client.image_list_detail(
+ image_list = self.os.image_client.image_list_detail(
properties,
status='active',
sort_key='created_at',
sort_dir='asc')
- self.assertEqual(200, resp.status)
self.assertEqual(2, len(image_list))
self.assertEqual((backup1, backup2),
(image_list[0]['name'], image_list[1]['name']))
@@ -315,12 +314,11 @@
self.servers_client.wait_for_server_status(self.server_id, 'ACTIVE')
self.os.image_client.wait_for_resource_deletion(image1_id)
oldest_backup_exist = False
- resp, image_list = self.os.image_client.image_list_detail(
+ image_list = self.os.image_client.image_list_detail(
properties,
status='active',
sort_key='created_at',
sort_dir='asc')
- self.assertEqual(200, resp.status)
self.assertEqual(2, len(image_list),
'Unexpected number of images for '
'v2:test_create_backup; was the oldest backup not '
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 1f4f124..3dd6e34 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -57,13 +57,13 @@
resp, cls.server = cls.client.get_server(server['id'])
name = data_utils.rand_name('image')
- resp, body = cls.glance_client.create_image(name=name,
- container_format='bare',
- disk_format='raw',
- is_public=False)
+ body = cls.glance_client.create_image(name=name,
+ container_format='bare',
+ disk_format='raw',
+ is_public=False)
image_id = body['id']
image_file = StringIO.StringIO(('*' * 1024))
- resp, body = cls.glance_client.update_image(image_id, data=image_file)
+ body = cls.glance_client.update_image(image_id, data=image_file)
cls.glance_client.wait_for_image_status(image_id, 'active')
resp, cls.image = cls.images_client.get_image(image_id)
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 76b6f17..12f3fdd 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -67,10 +67,10 @@
container_format = kwargs.pop('container_format')
disk_format = kwargs.pop('disk_format')
- resp, image = cls.client.create_image(name, container_format,
- disk_format, **kwargs)
+ image = cls.client.create_image(name, container_format,
+ disk_format, **kwargs)
cls.created_images.append(image['id'])
- return resp, image
+ return image
class BaseV1ImageTest(BaseImageTest):
@@ -95,11 +95,10 @@
def _create_image(self):
image_file = StringIO.StringIO(data_utils.random_bytes())
- resp, image = self.create_image(container_format='bare',
- disk_format='raw',
- is_public=False,
- data=image_file)
- self.assertEqual(201, resp.status)
+ image = self.create_image(container_format='bare',
+ disk_format='raw',
+ is_public=False,
+ data=image_file)
image_id = image['id']
return image_id
@@ -127,15 +126,15 @@
cls.alt_tenant_id = cls.alt_img_client.tenant_id
def _list_image_ids_as_alt(self):
- _, image_list = self.alt_img_client.image_list()
+ image_list = self.alt_img_client.image_list()
image_ids = map(lambda x: x['id'], image_list)
return image_ids
def _create_image(self):
name = data_utils.rand_name('image')
- _, image = self.os_img_client.create_image(name,
- container_format='bare',
- disk_format='raw')
+ image = self.os_img_client.create_image(name,
+ container_format='bare',
+ disk_format='raw')
image_id = image['id']
self.addCleanup(self.os_img_client.delete_image, image_id)
return image_id
diff --git a/tempest/api/image/v1/test_image_members.py b/tempest/api/image/v1/test_image_members.py
index f91cb69..d18a274 100644
--- a/tempest/api/image/v1/test_image_members.py
+++ b/tempest/api/image/v1/test_image_members.py
@@ -23,7 +23,7 @@
def test_add_image_member(self):
image = self._create_image()
self.client.add_member(self.alt_tenant_id, image)
- _, body = self.client.get_image_membership(image)
+ body = self.client.get_image_membership(image)
members = body['members']
members = map(lambda x: x['member_id'], members)
self.assertIn(self.alt_tenant_id, members)
@@ -36,7 +36,7 @@
self.client.add_member(self.alt_tenant_id, image)
share_image = self._create_image()
self.client.add_member(self.alt_tenant_id, share_image)
- _, body = self.client.get_shared_images(self.alt_tenant_id)
+ body = self.client.get_shared_images(self.alt_tenant_id)
images = body['shared_images']
images = map(lambda x: x['image_id'], images)
self.assertIn(share_image, images)
@@ -47,6 +47,6 @@
image_id = self._create_image()
self.client.add_member(self.alt_tenant_id, image_id)
self.client.delete_member(self.alt_tenant_id, image_id)
- _, body = self.client.get_image_membership(image_id)
+ body = self.client.get_image_membership(image_id)
members = body['members']
self.assertEqual(0, len(members), str(members))
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index bc45da5..b9f12e6 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -30,11 +30,11 @@
def test_register_then_upload(self):
# Register, then upload an image
properties = {'prop1': 'val1'}
- _, body = self.create_image(name='New Name',
- container_format='bare',
- disk_format='raw',
- is_public=False,
- properties=properties)
+ body = self.create_image(name='New Name',
+ container_format='bare',
+ disk_format='raw',
+ is_public=False,
+ properties=properties)
self.assertIn('id', body)
image_id = body.get('id')
self.assertEqual('New Name', body.get('name'))
@@ -45,19 +45,19 @@
# Now try uploading an image file
image_file = StringIO.StringIO(data_utils.random_bytes())
- _, body = self.client.update_image(image_id, data=image_file)
+ body = self.client.update_image(image_id, data=image_file)
self.assertIn('size', body)
self.assertEqual(1024, body.get('size'))
@test.attr(type='gate')
def test_register_remote_image(self):
# Register a new remote image
- _, body = self.create_image(name='New Remote Image',
- container_format='bare',
- disk_format='raw', is_public=False,
- location=CONF.image.http_image,
- properties={'key1': 'value1',
- 'key2': 'value2'})
+ body = self.create_image(name='New Remote Image',
+ container_format='bare',
+ disk_format='raw', is_public=False,
+ location=CONF.image.http_image,
+ properties={'key1': 'value1',
+ 'key2': 'value2'})
self.assertIn('id', body)
self.assertEqual('New Remote Image', body.get('name'))
self.assertFalse(body.get('is_public'))
@@ -68,10 +68,10 @@
@test.attr(type='gate')
def test_register_http_image(self):
- _, body = self.create_image(name='New Http Image',
- container_format='bare',
- disk_format='raw', is_public=False,
- copy_from=CONF.image.http_image)
+ body = self.create_image(name='New Http Image',
+ container_format='bare',
+ disk_format='raw', is_public=False,
+ copy_from=CONF.image.http_image)
self.assertIn('id', body)
image_id = body.get('id')
self.assertEqual('New Http Image', body.get('name'))
@@ -83,12 +83,12 @@
def test_register_image_with_min_ram(self):
# Register an image with min ram
properties = {'prop1': 'val1'}
- _, body = self.create_image(name='New_image_with_min_ram',
- container_format='bare',
- disk_format='raw',
- is_public=False,
- min_ram=40,
- properties=properties)
+ body = self.create_image(name='New_image_with_min_ram',
+ container_format='bare',
+ disk_format='raw',
+ is_public=False,
+ min_ram=40,
+ properties=properties)
self.assertIn('id', body)
self.assertEqual('New_image_with_min_ram', body.get('name'))
self.assertFalse(body.get('is_public'))
@@ -140,11 +140,11 @@
"""
name = 'New Remote Image %s' % name
location = CONF.image.http_image
- _, image = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- is_public=False,
- location=location)
+ image = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ is_public=False,
+ location=location)
image_id = image['id']
return image_id
@@ -158,24 +158,24 @@
"""
image_file = StringIO.StringIO(data_utils.random_bytes(size))
name = 'New Standard Image %s' % name
- _, image = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- is_public=False, data=image_file)
+ image = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ is_public=False, data=image_file)
image_id = image['id']
return image_id
@test.attr(type='gate')
def test_index_no_params(self):
# Simple test to see all fixture images returned
- _, images_list = self.client.image_list()
+ images_list = self.client.image_list()
image_list = map(lambda x: x['id'], images_list)
for image_id in self.created_images:
self.assertIn(image_id, image_list)
@test.attr(type='gate')
def test_index_disk_format(self):
- _, images_list = self.client.image_list(disk_format='ami')
+ images_list = self.client.image_list(disk_format='ami')
for image in images_list:
self.assertEqual(image['disk_format'], 'ami')
result_set = set(map(lambda x: x['id'], images_list))
@@ -184,7 +184,7 @@
@test.attr(type='gate')
def test_index_container_format(self):
- _, images_list = self.client.image_list(container_format='bare')
+ images_list = self.client.image_list(container_format='bare')
for image in images_list:
self.assertEqual(image['container_format'], 'bare')
result_set = set(map(lambda x: x['id'], images_list))
@@ -193,7 +193,7 @@
@test.attr(type='gate')
def test_index_max_size(self):
- _, images_list = self.client.image_list(size_max=42)
+ images_list = self.client.image_list(size_max=42)
for image in images_list:
self.assertTrue(image['size'] <= 42)
result_set = set(map(lambda x: x['id'], images_list))
@@ -202,7 +202,7 @@
@test.attr(type='gate')
def test_index_min_size(self):
- _, images_list = self.client.image_list(size_min=142)
+ images_list = self.client.image_list(size_min=142)
for image in images_list:
self.assertTrue(image['size'] >= 142)
result_set = set(map(lambda x: x['id'], images_list))
@@ -211,9 +211,9 @@
@test.attr(type='gate')
def test_index_status_active_detail(self):
- _, images_list = self.client.image_list_detail(status='active',
- sort_key='size',
- sort_dir='desc')
+ images_list = self.client.image_list_detail(status='active',
+ sort_key='size',
+ sort_dir='desc')
top_size = images_list[0]['size'] # We have non-zero sized images
for image in images_list:
size = image['size']
@@ -223,7 +223,7 @@
@test.attr(type='gate')
def test_index_name(self):
- _, images_list = self.client.image_list_detail(
+ images_list = self.client.image_list_detail(
name='New Remote Image dup')
result_set = set(map(lambda x: x['id'], images_list))
for image in images_list:
@@ -247,18 +247,18 @@
"""
image_file = StringIO.StringIO(data_utils.random_bytes(size))
name = 'New Standard Image %s' % name
- _, image = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- is_public=False, data=image_file,
- properties={'key1': 'value1'})
+ image = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ is_public=False, data=image_file,
+ properties={'key1': 'value1'})
image_id = image['id']
return image_id
@test.attr(type='gate')
def test_list_image_metadata(self):
# All metadata key/value pairs for an image should be returned
- _, resp_metadata = self.client.get_image_meta(self.image_id)
+ resp_metadata = self.client.get_image_meta(self.image_id)
expected = {'key1': 'value1'}
self.assertEqual(expected, resp_metadata['properties'])
@@ -266,12 +266,12 @@
def test_update_image_metadata(self):
# The metadata for the image should match the updated values
req_metadata = {'key1': 'alt1', 'key2': 'value2'}
- _, metadata = self.client.get_image_meta(self.image_id)
+ metadata = self.client.get_image_meta(self.image_id)
self.assertEqual(metadata['properties'], {'key1': 'value1'})
metadata['properties'].update(req_metadata)
- _, metadata = self.client.update_image(
+ metadata = self.client.update_image(
self.image_id, properties=metadata['properties'])
- _, resp_metadata = self.client.get_image_meta(self.image_id)
+ resp_metadata = self.client.get_image_meta(self.image_id)
expected = {'key1': 'alt1', 'key2': 'value2'}
self.assertEqual(expected, resp_metadata['properties'])
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 7e018e5..e307c5c 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -37,11 +37,11 @@
uuid = '00000000-1111-2222-3333-444455556666'
image_name = data_utils.rand_name('image')
- _, body = self.create_image(name=image_name,
- container_format='bare',
- disk_format='raw',
- visibility='private',
- ramdisk_id=uuid)
+ body = self.create_image(name=image_name,
+ container_format='bare',
+ disk_format='raw',
+ visibility='private',
+ ramdisk_id=uuid)
self.assertIn('id', body)
image_id = body.get('id')
self.assertIn('name', body)
@@ -57,7 +57,7 @@
self.client.store_image(image_id, image_file)
# Now try to get image details
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertEqual(image_id, body['id'])
self.assertEqual(image_name, body['name'])
self.assertEqual(uuid, body['ramdisk_id'])
@@ -74,10 +74,10 @@
# Create image
image_name = data_utils.rand_name('image')
- _, body = self.client.create_image(name=image_name,
- container_format='bare',
- disk_format='raw',
- visibility='private')
+ body = self.client.create_image(name=image_name,
+ container_format='bare',
+ disk_format='raw',
+ visibility='private')
image_id = body['id']
# Delete Image
@@ -85,7 +85,7 @@
self.client.wait_for_resource_deletion(image_id)
# Verifying deletion
- _, images = self.client.image_list()
+ images = self.client.image_list()
images_id = [item['id'] for item in images]
self.assertNotIn(image_id, images_id)
@@ -95,10 +95,10 @@
# Create image
image_name = data_utils.rand_name('image')
- _, body = self.client.create_image(name=image_name,
- container_format='bare',
- disk_format='iso',
- visibility='private')
+ body = self.client.create_image(name=image_name,
+ container_format='bare',
+ disk_format='iso',
+ visibility='private')
self.addCleanup(self.client.delete_image, body['id'])
self.assertEqual('queued', body['status'])
image_id = body['id']
@@ -109,12 +109,12 @@
# Update Image
new_image_name = data_utils.rand_name('new-image')
- _, body = self.client.update_image(image_id, [
+ body = self.client.update_image(image_id, [
dict(replace='/name', value=new_image_name)])
# Verifying updating
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertEqual(image_id, body['id'])
self.assertEqual(new_image_name, body['name'])
@@ -147,10 +147,10 @@
size = random.randint(1024, 4096)
image_file = StringIO.StringIO(data_utils.random_bytes(size))
name = data_utils.rand_name('image-')
- _, body = cls.create_image(name=name,
- container_format=container_format,
- disk_format=disk_format,
- visibility='private')
+ body = cls.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ visibility='private')
image_id = body['id']
cls.client.store_image(image_id, data=image_file)
@@ -160,7 +160,7 @@
"""
Perform list action with given params and validates result.
"""
- _, images_list = self.client.image_list(params=params)
+ images_list = self.client.image_list(params=params)
# Validating params of fetched images
for image in images_list:
for key in params:
@@ -170,7 +170,7 @@
@test.attr(type='gate')
def test_index_no_params(self):
# Simple test to see all fixture images returned
- _, images_list = self.client.image_list()
+ images_list = self.client.image_list()
image_list = map(lambda x: x['id'], images_list)
for image in self.created_images:
@@ -199,7 +199,7 @@
# Test to get all images by size
image_id = self.created_images[1]
# Get image metadata
- _, image = self.client.get_image(image_id)
+ image = self.client.get_image(image_id)
params = {"size": image['size']}
self._list_by_param_value_and_assert(params)
@@ -209,11 +209,11 @@
# Test to get all images with size between 2000 to 3000
image_id = self.created_images[1]
# Get image metadata
- _, image = self.client.get_image(image_id)
+ image = self.client.get_image(image_id)
size = image['size']
params = {"size_min": size - 500, "size_max": size + 500}
- _, images_list = self.client.image_list(params=params)
+ images_list = self.client.image_list(params=params)
image_size_list = map(lambda x: x['size'], images_list)
for image_size in image_size_list:
@@ -231,7 +231,7 @@
def test_list_images_param_limit(self):
# Test to get images by limit
params = {"limit": 2}
- _, images_list = self.client.image_list(params=params)
+ images_list = self.client.image_list(params=params)
self.assertEqual(len(images_list), params['limit'],
"Failed to get images by limit")
@@ -240,12 +240,12 @@
def test_get_image_schema(self):
# Test to get image schema
schema = "image"
- _, body = self.client.get_schema(schema)
+ body = self.client.get_schema(schema)
self.assertEqual("image", body['name'])
@test.attr(type='gate')
def test_get_images_schema(self):
# Test to get images schema
schema = "images"
- _, body = self.client.get_schema(schema)
+ body = self.client.get_schema(schema)
self.assertEqual("images", body['name'])
diff --git a/tempest/api/image/v2/test_images_member.py b/tempest/api/image/v2/test_images_member.py
index 5aaf578..ec1cf14 100644
--- a/tempest/api/image/v2/test_images_member.py
+++ b/tempest/api/image/v2/test_images_member.py
@@ -20,8 +20,8 @@
@test.attr(type='gate')
def test_image_share_accept(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
@@ -30,7 +30,7 @@
self.alt_tenant_id,
'accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
- _, body = self.os_img_client.get_image_membership(image_id)
+ body = self.os_img_client.get_image_membership(image_id)
members = body['members']
member = members[0]
self.assertEqual(len(members), 1, str(members))
@@ -41,8 +41,8 @@
@test.attr(type='gate')
def test_image_share_reject(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
@@ -62,8 +62,8 @@
'accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
- _, member = self.os_img_client.get_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.get_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(self.alt_tenant_id, member['member_id'])
self.assertEqual(image_id, member['image_id'])
self.assertEqual('accepted', member['status'])
@@ -83,10 +83,10 @@
@test.attr(type='gate')
def test_get_image_member_schema(self):
- _, body = self.os_img_client.get_schema("member")
+ body = self.os_img_client.get_schema("member")
self.assertEqual("member", body['name'])
@test.attr(type='gate')
def test_get_image_members_schema(self):
- _, body = self.os_img_client.get_schema("members")
+ body = self.os_img_client.get_schema("members")
self.assertEqual("members", body['name'])
diff --git a/tempest/api/image/v2/test_images_member_negative.py b/tempest/api/image/v2/test_images_member_negative.py
index 7da6e65..1f8e3d0 100644
--- a/tempest/api/image/v2/test_images_member_negative.py
+++ b/tempest/api/image/v2/test_images_member_negative.py
@@ -21,8 +21,8 @@
@test.attr(type=['negative', 'gate'])
def test_image_share_invalid_status(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertRaises(exceptions.BadRequest,
self.alt_img_client.update_member_status,
@@ -31,8 +31,8 @@
@test.attr(type=['negative', 'gate'])
def test_image_share_owner_cannot_accept(self):
image_id = self._create_image()
- _, member = self.os_img_client.add_member(image_id,
- self.alt_tenant_id)
+ member = self.os_img_client.add_member(image_id,
+ self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.assertRaises(exceptions.Unauthorized,
diff --git a/tempest/api/image/v2/test_images_negative.py b/tempest/api/image/v2/test_images_negative.py
index 722929e..fc781b1 100644
--- a/tempest/api/image/v2/test_images_negative.py
+++ b/tempest/api/image/v2/test_images_negative.py
@@ -52,9 +52,9 @@
def test_get_delete_deleted_image(self):
# get and delete the deleted image
# create and delete image
- _, body = self.client.create_image(name='test',
- container_format='bare',
- disk_format='raw')
+ body = self.client.create_image(name='test',
+ container_format='bare',
+ disk_format='raw')
image_id = body['id']
self.client.delete_image(image_id)
self.client.wait_for_resource_deletion(image_id)
diff --git a/tempest/api/image/v2/test_images_tags.py b/tempest/api/image/v2/test_images_tags.py
index a9db24b..4686de2 100644
--- a/tempest/api/image/v2/test_images_tags.py
+++ b/tempest/api/image/v2/test_images_tags.py
@@ -21,19 +21,19 @@
@test.attr(type='gate')
def test_update_delete_tags_for_image(self):
- _, body = self.create_image(container_format='bare',
- disk_format='raw',
- visibility='private')
+ body = self.create_image(container_format='bare',
+ disk_format='raw',
+ visibility='private')
image_id = body['id']
tag = data_utils.rand_name('tag-')
self.addCleanup(self.client.delete_image, image_id)
# Creating image tag and verify it.
self.client.add_image_tag(image_id, tag)
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertIn(tag, body['tags'])
# Deleting image tag and verify it.
self.client.delete_image_tag(image_id, tag)
- _, body = self.client.get_image(image_id)
+ body = self.client.get_image(image_id)
self.assertNotIn(tag, body['tags'])
diff --git a/tempest/api/image/v2/test_images_tags_negative.py b/tempest/api/image/v2/test_images_tags_negative.py
index 8e42b7c..aa0a214 100644
--- a/tempest/api/image/v2/test_images_tags_negative.py
+++ b/tempest/api/image/v2/test_images_tags_negative.py
@@ -33,10 +33,10 @@
@test.attr(type=['negative', 'gate'])
def test_delete_non_existing_tag(self):
# Delete non existing tag.
- _, body = self.create_image(container_format='bare',
- disk_format='raw',
- visibility='private'
- )
+ body = self.create_image(container_format='bare',
+ disk_format='raw',
+ visibility='private'
+ )
image_id = body['id']
tag = data_utils.rand_name('non-exist-tag-')
self.addCleanup(self.client.delete_image, image_id)
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 6896362..21f2578 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -113,9 +113,9 @@
def _create_image(cls, name_start='image-heat-', container_format='bare',
disk_format='iso'):
image_name = data_utils.rand_name(name_start)
- _, body = cls.images_v2_client.create_image(image_name,
- container_format,
- disk_format)
+ body = cls.images_v2_client.create_image(image_name,
+ container_format,
+ disk_format)
image_id = body['id']
cls.images.append(image_id)
return body
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index db862c7..0941008 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -845,7 +845,7 @@
def list(self):
client = self.client
- _, images = client.list_images({"all_tenants": True})
+ images = client.list_images({"all_tenants": True})
if not self.is_save_state:
images = [image for image in images if image['id']
not in self.saved_state_json['images'].keys()]
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index c7ec359..819f4e2 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -528,7 +528,7 @@
def _get_image_by_name(client, name):
- r, body = client.images.image_list()
+ body = client.images.image_list()
for image in body:
if name == image['name']:
return image
@@ -551,19 +551,19 @@
extras = {}
if image['format'] == 'ami':
name, fname = _resolve_image(image, 'aki')
- r, aki = client.images.create_image(
+ aki = client.images.create_image(
'javelin_' + name, 'aki', 'aki')
client.images.store_image(aki.get('id'), open(fname, 'r'))
extras['kernel_id'] = aki.get('id')
name, fname = _resolve_image(image, 'ari')
- r, ari = client.images.create_image(
+ ari = client.images.create_image(
'javelin_' + name, 'ari', 'ari')
client.images.store_image(ari.get('id'), open(fname, 'r'))
extras['ramdisk_id'] = ari.get('id')
_, fname = _resolve_image(image, 'file')
- r, body = client.images.create_image(
+ body = client.images.create_image(
image['name'], image['format'], image['format'], **extras)
image_id = body.get('id')
client.images.store_image(image_id, open(fname, 'r'))
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index abf8fc3..890c77a 100755
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -59,7 +59,7 @@
def verify_glance_api_versions(os, update):
# Check glance api versions
- __, versions = os.image_client.get_versions()
+ versions = os.image_client.get_versions()
if CONF.image_feature_enabled.api_v1 != ('v1.1' in versions or 'v1.0' in
versions):
print_and_or_update('api_v1', 'image_feature_enabled',
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 9cb24b9..b417472 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -338,7 +338,7 @@
'is_public': 'False',
}
params.update(properties)
- _, image = self.image_client.create_image(**params)
+ image = self.image_client.create_image(**params)
self.addCleanup(self.image_client.delete_image, image['id'])
self.assertEqual("queued", image['status'])
self.image_client.update_image(image['id'], data=image_file)
@@ -407,7 +407,7 @@
thing_id=image_id, thing_id_param='id',
cleanup_callable=self.delete_wrapper,
cleanup_args=[_image_client.delete_image, image_id])
- _, snapshot_image = _image_client.get_image_meta(image_id)
+ snapshot_image = _image_client.get_image_meta(image_id)
image_name = snapshot_image['name']
self.assertEqual(name, image_name)
LOG.debug("Created snapshot image %s for server %s",
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py
index 013784c..94d2f8e 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/image_client.py
@@ -120,7 +120,7 @@
self._error_checker('POST', '/v1/images', headers, data, resp,
body_iter)
body = json.loads(''.join([c for c in body_iter]))
- return resp, body['image']
+ return rest_client.ResponseBody(resp, body['image'])
def _update_with_data(self, image_id, headers, data):
url = '/v1/images/%s' % image_id
@@ -129,7 +129,7 @@
self._error_checker('PUT', url, headers, data,
resp, body_iter)
body = json.loads(''.join([c for c in body_iter]))
- return resp, body['image']
+ return rest_client.ResponseBody(resp, body['image'])
@property
def http(self):
@@ -160,7 +160,7 @@
resp, body = self.post('v1/images', None, headers)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body['image']
+ return rest_client.ResponseBody(resp, body['image'])
def update_image(self, image_id, name=None, container_format=None,
data=None, properties=None):
@@ -184,13 +184,13 @@
resp, body = self.put(url, data, headers)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['image']
+ return rest_client.ResponseBody(resp, body['image'])
def delete_image(self, image_id):
url = 'v1/images/%s' % image_id
resp, body = self.delete(url)
self.expected_success(200, resp.status)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def image_list(self, **kwargs):
url = 'v1/images'
@@ -201,7 +201,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['images']
+ return rest_client.ResponseBodyList(resp, body['images'])
def image_list_detail(self, properties=dict(), changes_since=None,
**kwargs):
@@ -222,19 +222,20 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body['images']
+ return rest_client.ResponseBodyList(resp, body['images'])
def get_image_meta(self, image_id):
url = 'v1/images/%s' % image_id
resp, __ = self.head(url)
self.expected_success(200, resp.status)
body = self._image_meta_from_headers(resp)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def get_image(self, image_id):
url = 'v1/images/%s' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
+ # We can't return a ResponseBody because the body is a string
return resp, body
def is_resource_deleted(self, id):
@@ -254,14 +255,14 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def get_shared_images(self, member_id):
url = 'v1/shared-images/%s' % member_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def add_member(self, member_id, image_id, can_share=False):
url = 'v1/images/%s/members/%s' % (image_id, member_id)
@@ -270,17 +271,17 @@
body = json.dumps({'member': {'can_share': True}})
resp, __ = self.put(url, body)
self.expected_success(204, resp.status)
- return resp
+ return rest_client.ResponseBody(resp)
def delete_member(self, member_id, image_id):
url = 'v1/images/%s/members/%s' % (image_id, member_id)
resp, __ = self.delete(url)
self.expected_success(204, resp.status)
- return resp
+ return rest_client.ResponseBody(resp)
# NOTE(afazekas): just for the wait function
def _get_image_status(self, image_id):
- resp, meta = self.get_image_meta(image_id)
+ meta = self.get_image_meta(image_id)
status = meta['status']
return status
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index 2b3cb0e..847a4c6 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -45,7 +45,7 @@
def _validate_schema(self, body, type='image'):
if type in ['image', 'images']:
- resp, schema = self.get_schema(type)
+ schema = self.get_schema(type)
else:
raise ValueError("%s is not a valid schema type" % type)
@@ -66,7 +66,7 @@
"-json-patch"}
resp, body = self.patch('v2/images/%s' % image_id, data, headers)
self.expected_success(200, resp.status)
- return resp, self._parse_resp(body)
+ return rest_client.ResponseBody(resp, self._parse_resp(body))
def create_image(self, name, container_format, disk_format, **kwargs):
params = {
@@ -88,12 +88,13 @@
resp, body = self.post('v2/images', data)
self.expected_success(201, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def delete_image(self, image_id):
url = 'v2/images/%s' % image_id
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
+ return rest_client.ResponseBody(resp)
def image_list(self, params=None):
url = 'v2/images'
@@ -105,14 +106,14 @@
self.expected_success(200, resp.status)
body = json.loads(body)
self._validate_schema(body, type='images')
- return resp, body['images']
+ return rest_client.ResponseBodyList(resp, body['images'])
def get_image(self, image_id):
url = 'v2/images/%s' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
try:
@@ -132,32 +133,33 @@
resp, body = self.http.raw_request('PUT', url, headers=headers,
body=data)
self.expected_success(204, resp.status)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def get_image_file(self, image_id):
url = 'v2/images/%s/file' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
+ # We can't return a ResponseBody because the body is a string
return resp, body
def add_image_tag(self, image_id, tag):
url = 'v2/images/%s/tags/%s' % (image_id, tag)
resp, body = self.put(url, body=None)
self.expected_success(204, resp.status)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def delete_image_tag(self, image_id, tag):
url = 'v2/images/%s/tags/%s' % (image_id, tag)
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
- return resp
+ return rest_client.ResponseBody(resp)
def get_image_membership(self, image_id):
url = 'v2/images/%s/members' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def add_member(self, image_id, member_id):
url = 'v2/images/%s/members' % image_id
@@ -165,7 +167,7 @@
resp, body = self.post(url, data)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def update_member_status(self, image_id, member_id, status):
"""Valid status are: ``pending``, ``accepted``, ``rejected``."""
@@ -174,23 +176,23 @@
resp, body = self.put(url, data)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
def get_member(self, image_id, member_id):
url = 'v2/images/%s/members/%s' % (image_id, member_id)
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return resp, json.loads(body)
+ return rest_client.ResponseBody(resp, json.loads(body))
def remove_member(self, image_id, member_id):
url = 'v2/images/%s/members/%s' % (image_id, member_id)
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
- return resp
+ return rest_client.ResponseBody(resp)
def get_schema(self, schema):
url = 'v2/schemas/%s' % schema
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return resp, body
+ return rest_client.ResponseBody(resp, body)
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index 65106cc..a8adc7e 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -171,7 +171,7 @@
def test_verify_glance_version_no_v2_with_v1_1(self):
def fake_get_versions():
- return (None, ['v1.1'])
+ return (['v1.1'])
fake_os = mock.MagicMock()
fake_os.image_client.get_versions = fake_get_versions
with mock.patch.object(verify_tempest_config,
@@ -182,7 +182,7 @@
def test_verify_glance_version_no_v2_with_v1_0(self):
def fake_get_versions():
- return (None, ['v1.0'])
+ return (['v1.0'])
fake_os = mock.MagicMock()
fake_os.image_client.get_versions = fake_get_versions
with mock.patch.object(verify_tempest_config,
@@ -193,7 +193,7 @@
def test_verify_glance_version_no_v1(self):
def fake_get_versions():
- return (None, ['v2.0'])
+ return (['v2.0'])
fake_os = mock.MagicMock()
fake_os.image_client.get_versions = fake_get_versions
with mock.patch.object(verify_tempest_config,