Merge "Return complete response from interfaces_client"
diff --git a/README.rst b/README.rst
index 431be7c..7a7dfa6 100644
--- a/README.rst
+++ b/README.rst
@@ -32,7 +32,7 @@
parts as load generation for an OpenStack cloud.
- Tempest should attempt to clean up after itself, whenever possible
we should tear down resources when done.
-- Tempest should be self testing.
+- Tempest should be self-testing.
Quickstart
----------
@@ -94,7 +94,7 @@
Detailed configuration of Tempest is beyond the scope of this
document see :ref:`tempest-configuration` for more details on configuring
-Tempest. The etc/tempest.conf.sample attempts to be a self documenting version
+Tempest. The etc/tempest.conf.sample attempts to be a self-documenting version
of the configuration.
You can generate a new sample tempest.conf file, run the following
@@ -142,7 +142,7 @@
support running with Python 3.4. A gating unit test job was added to also run
Tempest's unit tests under Python 3.4. This means that the Tempest code at
least imports under Python 3.4 and things that have unit test coverage will
-work on Python 3.4. However, because large parts of Tempest are self verifying
+work on Python 3.4. However, because large parts of Tempest are self-verifying
there might be uncaught issues running on Python 3.4. So until there is a gating
job which does a full Tempest run using Python 3.4 there isn't any guarantee
that running Tempest under Python 3.4 is bug free.
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 3e6013d..3c109b5 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -24,7 +24,7 @@
Tempest currently has 2 different ways in configuration to provide credentials
to use when running tempest. One is a traditional set of configuration options
in the tempest.conf file. These options are in the identity section and let you
-specify a regular user, a global admin user, and a alternate user set of
+specify a regular user, a global admin user, and an alternate user set of
credentials. (which consist of a username, password, and project/tenant name)
These options should be clearly labelled in the sample config file in the
identity section.
@@ -187,7 +187,7 @@
#. image_ref_alt
Both options are expecting an image id (not name) from nova. The *image_ref*
-option is what what will be used for booting the majority of servers in tempest.
+option is what will be used for booting the majority of servers in tempest.
*image_ref_alt* is used for tests that require 2 images such as rebuild. If 2
images are not available you can set both options to the same image_ref and
those tests will be skipped.
diff --git a/tempest/api/compute/admin/test_agents.py b/tempest/api/compute/admin/test_agents.py
index d9a1ee5..38f5fb7 100644
--- a/tempest/api/compute/admin/test_agents.py
+++ b/tempest/api/compute/admin/test_agents.py
@@ -38,7 +38,7 @@
hypervisor='common', os='linux', architecture='x86_64',
version='7.0', url='xxx://xxxx/xxx/xxx',
md5hash='add6bb58e139be103324d04d82d8f545')
- body = self.client.create_agent(**params)
+ body = self.client.create_agent(**params)['agent']
self.agent_id = body['agent_id']
def tearDown(self):
@@ -67,7 +67,7 @@
hypervisor='kvm', os='win', architecture='x86',
version='7.0', url='xxx://xxxx/xxx/xxx',
md5hash='add6bb58e139be103324d04d82d8f545')
- body = self.client.create_agent(**params)
+ body = self.client.create_agent(**params)['agent']
self.addCleanup(self.client.delete_agent, body['agent_id'])
for expected_item, value in params.items():
self.assertEqual(value, body[expected_item])
@@ -78,7 +78,7 @@
params = self._param_helper(
version='8.0', url='xxx://xxxx/xxx/xxx2',
md5hash='add6bb58e139be103324d04d82d8f547')
- body = self.client.update_agent(self.agent_id, **params)
+ body = self.client.update_agent(self.agent_id, **params)['agent']
for expected_item, value in params.items():
self.assertEqual(value, body[expected_item])
@@ -88,13 +88,13 @@
self.client.delete_agent(self.agent_id)
# Verify the list doesn't contain the deleted agent.
- agents = self.client.list_agents()
+ agents = self.client.list_agents()['agents']
self.assertNotIn(self.agent_id, map(lambda x: x['agent_id'], agents))
@test.idempotent_id('6a326c69-654b-438a-80a3-34bcc454e138')
def test_list_agents(self):
# List all agents.
- agents = self.client.list_agents()
+ agents = self.client.list_agents()['agents']
self.assertTrue(len(agents) > 0, 'Cannot get any agents.(%s)' % agents)
self.assertIn(self.agent_id, map(lambda x: x['agent_id'], agents))
@@ -105,11 +105,12 @@
hypervisor='xen', os='linux', architecture='x86',
version='7.0', url='xxx://xxxx/xxx/xxx1',
md5hash='add6bb58e139be103324d04d82d8f546')
- agent_xen = self.client.create_agent(**params)
+ agent_xen = self.client.create_agent(**params)['agent']
self.addCleanup(self.client.delete_agent, agent_xen['agent_id'])
agent_id_xen = agent_xen['agent_id']
- agents = self.client.list_agents(hypervisor=agent_xen['hypervisor'])
+ agents = (self.client.list_agents(hypervisor=agent_xen['hypervisor'])
+ ['agents'])
self.assertTrue(len(agents) > 0, 'Cannot get any agents.(%s)' % agents)
self.assertIn(agent_id_xen, map(lambda x: x['agent_id'], agents))
self.assertNotIn(self.agent_id, map(lambda x: x['agent_id'], agents))
diff --git a/tempest/api/compute/admin/test_availability_zone.py b/tempest/api/compute/admin/test_availability_zone.py
index 22eae03..1b36ff2 100644
--- a/tempest/api/compute/admin/test_availability_zone.py
+++ b/tempest/api/compute/admin/test_availability_zone.py
@@ -32,10 +32,10 @@
def test_get_availability_zone_list(self):
# List of availability zone
availability_zone = self.client.list_availability_zones()
- self.assertTrue(len(availability_zone) > 0)
+ self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
@test.idempotent_id('ef726c58-530f-44c2-968c-c7bed22d5b8c')
def test_get_availability_zone_list_detail(self):
# List of availability zones and available services
availability_zone = self.client.list_availability_zones(detail=True)
- self.assertTrue(len(availability_zone) > 0)
+ self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
diff --git a/tempest/api/compute/admin/test_baremetal_nodes.py b/tempest/api/compute/admin/test_baremetal_nodes.py
index 4d95f0a..2599d86 100644
--- a/tempest/api/compute/admin/test_baremetal_nodes.py
+++ b/tempest/api/compute/admin/test_baremetal_nodes.py
@@ -46,11 +46,11 @@
# List all baremetal nodes and ensure our created test nodes are
# listed
bm_node_ids = set([n['id'] for n in
- self.client.list_baremetal_nodes()])
+ self.client.list_baremetal_nodes()['nodes']])
test_node_ids = set([n['uuid'] for n in test_nodes])
self.assertTrue(test_node_ids.issubset(bm_node_ids))
# Test getting each individually
for node in test_nodes:
baremetal_node = self.client.show_baremetal_node(node['uuid'])
- self.assertEqual(node['uuid'], baremetal_node['id'])
+ self.assertEqual(node['uuid'], baremetal_node['node']['id'])
diff --git a/tempest/api/compute/admin/test_fixed_ips.py b/tempest/api/compute/admin/test_fixed_ips.py
index 3e20b46..669585c 100644
--- a/tempest/api/compute/admin/test_fixed_ips.py
+++ b/tempest/api/compute/admin/test_fixed_ips.py
@@ -51,7 +51,7 @@
@test.services('network')
def test_list_fixed_ip_details(self):
fixed_ip = self.client.show_fixed_ip(self.ip)
- self.assertEqual(fixed_ip['address'], self.ip)
+ self.assertEqual(fixed_ip['fixed_ip']['address'], self.ip)
@test.idempotent_id('5485077b-7e46-4cec-b402-91dc3173433b')
@test.services('network')
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py
index d26a5e5..7a5bcff 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -78,5 +78,5 @@
def test_list_floating_ip_pools(self):
# Positive test:Should return the list of floating IP Pools
floating_ip_pools = self.pools_client.list_floating_ip_pools()
- self.assertNotEqual(0, len(floating_ip_pools),
+ self.assertNotEqual(0, len(floating_ip_pools['floating_ip_pools']),
"Expected floating IP Pools. Got zero.")
diff --git a/tempest/api/compute/servers/test_availability_zone.py b/tempest/api/compute/servers/test_availability_zone.py
index d1fbcec..080441a 100644
--- a/tempest/api/compute/servers/test_availability_zone.py
+++ b/tempest/api/compute/servers/test_availability_zone.py
@@ -32,4 +32,4 @@
def test_get_availability_zone_list_with_non_admin_user(self):
# List of availability zone with non-administrator user
availability_zone = self.client.list_availability_zones()
- self.assertTrue(len(availability_zone) > 0)
+ self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
diff --git a/tempest/api/compute/test_extensions.py b/tempest/api/compute/test_extensions.py
index 4cc4328..6e57aff 100644
--- a/tempest/api/compute/test_extensions.py
+++ b/tempest/api/compute/test_extensions.py
@@ -32,7 +32,7 @@
# List of all extensions
if len(CONF.compute_feature_enabled.api_extensions) == 0:
raise self.skipException('There are not any extensions configured')
- extensions = self.extensions_client.list_extensions()
+ extensions = self.extensions_client.list_extensions()['extensions']
ext = CONF.compute_feature_enabled.api_extensions[0]
if ext == 'all':
self.assertIn('Hosts', map(lambda x: x['name'], extensions))
@@ -49,4 +49,4 @@
def test_get_extension(self):
# get the specified extensions
extension = self.extensions_client.show_extension('os-consoles')
- self.assertEqual('os-consoles', extension['alias'])
+ self.assertEqual('os-consoles', extension['extension']['alias'])
diff --git a/tempest/api/database/limits/test_limits.py b/tempest/api/database/limits/test_limits.py
index 7d2fbac..4b7f2d6 100644
--- a/tempest/api/database/limits/test_limits.py
+++ b/tempest/api/database/limits/test_limits.py
@@ -29,7 +29,7 @@
def test_absolute_limits(self):
# Test to verify if all absolute limit paramaters are
# present when verb is ABSOLUTE
- limits = self.client.list_db_limits()
+ limits = self.client.list_db_limits()['limits']
expected_abs_limits = ['max_backups', 'max_volumes',
'max_instances', 'verb']
absolute_limit = [l for l in limits
diff --git a/tempest/api/database/versions/test_versions.py b/tempest/api/database/versions/test_versions.py
index 55d8246..ae568b1 100644
--- a/tempest/api/database/versions/test_versions.py
+++ b/tempest/api/database/versions/test_versions.py
@@ -27,7 +27,7 @@
@test.attr(type='smoke')
@test.idempotent_id('6952cd77-90cd-4dca-bb60-8e2c797940cf')
def test_list_db_versions(self):
- versions = self.client.list_db_versions()
+ versions = self.client.list_db_versions()['versions']
self.assertTrue(len(versions) > 0, "No database versions found")
# List of all versions should contain the current version, and there
# should only be one 'current' version
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index 4572310..da0ce83 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -72,6 +72,10 @@
image = cls.client.create_image(name, container_format,
disk_format, **kwargs)
+ # Image objects returned by the v1 client have the image
+ # data inside a dict that is keyed against 'image'.
+ if 'image' in image:
+ image = image['image']
cls.created_images.append(image['id'])
return image
@@ -90,26 +94,6 @@
super(BaseV1ImageTest, cls).setup_clients()
cls.client = cls.os.image_client
- # TODO(jswarren) Remove this method once the v2 client also returns the
- # full response object, not just the ['image'] value. At that
- # point BaseImageTest.create_image will need to retrieve the
- # ['image'] value.
- @classmethod
- def create_image(cls, **kwargs):
- """Wrapper that returns a test image."""
- name = data_utils.rand_name(cls.__name__ + "-instance")
-
- if 'name' in kwargs:
- name = kwargs.pop('name')
-
- container_format = kwargs.pop('container_format')
- disk_format = kwargs.pop('disk_format')
-
- image = cls.client.create_image(name, container_format,
- disk_format, **kwargs)['image']
- cls.created_images.append(image['id'])
- return image
-
class BaseV1ImageMembersTest(BaseV1ImageTest):
@@ -166,7 +150,7 @@
cls.alt_tenant_id = cls.alt_img_client.tenant_id
def _list_image_ids_as_alt(self):
- image_list = self.alt_img_client.list_images()
+ image_list = self.alt_img_client.list_images()['images']
image_ids = map(lambda x: x['id'], image_list)
return image_ids
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 20e9bca..b446ec3 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -88,7 +88,7 @@
self.client.wait_for_resource_deletion(image_id)
# Verifying deletion
- images = self.client.list_images()
+ images = self.client.list_images()['images']
images_id = [item['id'] for item in images]
self.assertNotIn(image_id, images_id)
@@ -164,7 +164,7 @@
"""
Perform list action with given params and validates result.
"""
- images_list = self.client.list_images(params=params)
+ images_list = self.client.list_images(params=params)['images']
# Validating params of fetched images
for image in images_list:
for key in params:
@@ -174,7 +174,7 @@
@test.idempotent_id('1e341d7a-90a9-494c-b143-2cdf2aeb6aee')
def test_index_no_params(self):
# Simple test to see all fixture images returned
- images_list = self.client.list_images()
+ images_list = self.client.list_images()['images']
image_list = map(lambda x: x['id'], images_list)
for image in self.created_images:
@@ -217,7 +217,7 @@
size = image['size']
params = {"size_min": size - 500, "size_max": size + 500}
- images_list = self.client.list_images(params=params)
+ images_list = self.client.list_images(params=params)['images']
image_size_list = map(lambda x: x['size'], images_list)
for image_size in image_size_list:
@@ -235,7 +235,7 @@
def test_list_images_param_limit(self):
# Test to get images by limit
params = {"limit": 2}
- images_list = self.client.list_images(params=params)
+ images_list = self.client.list_images(params=params)['images']
self.assertEqual(len(images_list), params['limit'],
"Failed to get images by limit")
diff --git a/tempest/api/network/admin/test_routers_dvr.py b/tempest/api/network/admin/test_routers_dvr.py
index 9e2d080..365698d 100644
--- a/tempest/api/network/admin/test_routers_dvr.py
+++ b/tempest/api/network/admin/test_routers_dvr.py
@@ -89,7 +89,9 @@
attribute will be set to True
"""
name = data_utils.rand_name('router')
- router = self.admin_client.create_router(name, distributed=False)
+ # router needs to be in admin state down in order to be upgraded to DVR
+ router = self.admin_client.create_router(name, distributed=False,
+ admin_state_up=False)
self.addCleanup(self.admin_client.delete_router,
router['router']['id'])
self.assertFalse(router['router']['distributed'])
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index f2c59f3..5b6b0fa 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -163,7 +163,7 @@
def list_resources(self, stack_identifier):
"""Get a dict mapping of resource names to types."""
- resources = self.client.list_resources(stack_identifier)
+ resources = self.client.list_resources(stack_identifier)['resources']
self.assertIsInstance(resources, list)
for res in resources:
self.assert_fields_in_dict(res, 'logical_resource_id',
@@ -174,5 +174,5 @@
for r in resources)
def get_stack_output(self, stack_identifier, output_key):
- body = self.client.show_stack(stack_identifier)
+ body = self.client.show_stack(stack_identifier)['stack']
return self.stack_output(body, output_key)
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index b27d6c9..cb6d1db 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -75,7 +75,8 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
try:
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
- resources = cls.client.list_resources(cls.stack_identifier)
+ resources = (cls.client.list_resources(cls.stack_identifier)
+ ['resources'])
except exceptions.TimeoutException as e:
if CONF.compute_feature_enabled.console_output:
# attempt to log the server console to help with debugging
diff --git a/tempest/api/orchestration/stacks/test_non_empty_stack.py b/tempest/api/orchestration/stacks/test_non_empty_stack.py
index 494b6fd..e37587c 100644
--- a/tempest/api/orchestration/stacks/test_non_empty_stack.py
+++ b/tempest/api/orchestration/stacks/test_non_empty_stack.py
@@ -47,7 +47,7 @@
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
def _list_stacks(self, expected_num=None, **filter_kwargs):
- stacks = self.client.list_stacks(params=filter_kwargs)
+ stacks = self.client.list_stacks(params=filter_kwargs)['stacks']
self.assertIsInstance(stacks, list)
if expected_num is not None:
self.assertEqual(expected_num, len(stacks))
@@ -63,7 +63,7 @@
@test.idempotent_id('992f96e3-41ee-4ff6-91c7-bcfb670c0919')
def test_stack_show(self):
"""Getting details about created stack should be possible."""
- stack = self.client.show_stack(self.stack_name)
+ stack = self.client.show_stack(self.stack_name)['stack']
self.assertIsInstance(stack, dict)
self.assert_fields_in_dict(stack, 'stack_name', 'id', 'links',
'parameters', 'outputs', 'disable_rollback',
@@ -100,7 +100,7 @@
def test_show_resource(self):
"""Getting details about created resource should be possible."""
resource = self.client.show_resource(self.stack_identifier,
- self.resource_name)
+ self.resource_name)['resource']
self.assertIsInstance(resource, dict)
self.assert_fields_in_dict(resource, 'resource_name', 'description',
'links', 'logical_resource_id',
@@ -115,14 +115,14 @@
"""Getting metadata for created resources should be possible."""
metadata = self.client.show_resource_metadata(
self.stack_identifier,
- self.resource_name)
+ self.resource_name)['metadata']
self.assertIsInstance(metadata, dict)
self.assertEqual(['Tom', 'Stinky'], metadata.get('kittens', None))
@test.idempotent_id('46567533-0a7f-483b-8942-fa19e0f17839')
def test_list_events(self):
"""Getting list of created events for the stack should be possible."""
- events = self.client.list_events(self.stack_identifier)
+ events = self.client.list_events(self.stack_identifier)['events']
self.assertIsInstance(events, list)
for event in events:
@@ -138,12 +138,12 @@
def test_show_event(self):
"""Getting details about an event should be possible."""
events = self.client.list_resource_events(self.stack_identifier,
- self.resource_name)
+ self.resource_name)['events']
self.assertNotEqual([], events)
events.sort(key=lambda event: event['event_time'])
event_id = events[0]['id']
event = self.client.show_event(self.stack_identifier,
- self.resource_name, event_id)
+ self.resource_name, event_id)['event']
self.assertIsInstance(event, dict)
self.assert_fields_in_dict(event, 'resource_name', 'event_time',
'links', 'logical_resource_id',
diff --git a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
index 6a04dbd..b4d7fa0 100644
--- a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
+++ b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
@@ -43,7 +43,8 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
- resources = cls.client.list_resources(cls.stack_identifier)
+ resources = (cls.client.list_resources(cls.stack_identifier)
+ ['resources'])
cls.test_resources = {}
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
@@ -70,7 +71,7 @@
@test.idempotent_id('8d77dec7-91fd-45a6-943d-5abd45e338a4')
def test_stack_keypairs_output(self):
- stack = self.client.show_stack(self.stack_name)
+ stack = self.client.show_stack(self.stack_name)['stack']
self.assertIsInstance(stack, dict)
output_map = {}
diff --git a/tempest/api/orchestration/stacks/test_resource_types.py b/tempest/api/orchestration/stacks/test_resource_types.py
index 8f15f9c..8cf40de 100644
--- a/tempest/api/orchestration/stacks/test_resource_types.py
+++ b/tempest/api/orchestration/stacks/test_resource_types.py
@@ -20,7 +20,7 @@
@test.idempotent_id('7123d082-3577-4a30-8f00-f805327c4ffd')
def test_resource_type_list(self):
"""Verify it is possible to list resource types."""
- resource_types = self.client.list_resource_types()
+ resource_types = self.client.list_resource_types()['resource_types']
self.assertIsInstance(resource_types, list)
self.assertIn('OS::Nova::Server', resource_types)
@@ -28,7 +28,7 @@
@test.idempotent_id('0e85a483-828b-4a28-a0e3-f0a21809192b')
def test_resource_type_show(self):
"""Verify it is possible to get schema about resource types."""
- resource_types = self.client.list_resource_types()
+ resource_types = self.client.list_resource_types()['resource_types']
self.assertNotEmpty(resource_types)
for resource_type in resource_types:
diff --git a/tempest/api/orchestration/stacks/test_stacks.py b/tempest/api/orchestration/stacks/test_stacks.py
index abec906..f766b00 100644
--- a/tempest/api/orchestration/stacks/test_stacks.py
+++ b/tempest/api/orchestration/stacks/test_stacks.py
@@ -30,7 +30,7 @@
@test.attr(type='smoke')
@test.idempotent_id('d35d628c-07f6-4674-85a1-74db9919e986')
def test_stack_list_responds(self):
- stacks = self.client.list_stacks()
+ stacks = self.client.list_stacks()['stacks']
self.assertIsInstance(stacks, list)
@test.attr(type='smoke')
@@ -47,20 +47,20 @@
self.client.wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
# check for stack in list
- stacks = self.client.list_stacks()
+ stacks = self.client.list_stacks()['stacks']
list_ids = list([stack['id'] for stack in stacks])
self.assertIn(stack_id, list_ids)
# fetch the stack
- stack = self.client.show_stack(stack_identifier)
+ stack = self.client.show_stack(stack_identifier)['stack']
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# fetch the stack by name
- stack = self.client.show_stack(stack_name)
+ stack = self.client.show_stack(stack_name)['stack']
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# fetch the stack by id
- stack = self.client.show_stack(stack_id)
+ stack = self.client.show_stack(stack_id)['stack']
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# delete the stack
diff --git a/tempest/api/orchestration/stacks/test_swift_resources.py b/tempest/api/orchestration/stacks/test_swift_resources.py
index 30166df..c0f1c4b 100644
--- a/tempest/api/orchestration/stacks/test_swift_resources.py
+++ b/tempest/api/orchestration/stacks/test_swift_resources.py
@@ -55,7 +55,8 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
cls.test_resources = {}
- resources = cls.client.list_resources(cls.stack_identifier)
+ resources = (cls.client.list_resources(cls.stack_identifier)
+ ['resources'])
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index c7e989d..bbdf4a8 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -66,7 +66,7 @@
else:
extra_specs = {spec_key_without_prefix: backend_name_key}
self.type = self.volume_types_client.create_volume_type(
- type_name, extra_specs=extra_specs)
+ type_name, extra_specs=extra_specs)['volume_type']
self.volume_type_id_list.append(self.type['id'])
params = {self.name_field: vol_name, 'volume_type': type_name}
diff --git a/tempest/api/volume/admin/test_volume_services.py b/tempest/api/volume/admin/test_volume_services.py
index 4f80a31..74fffb9 100644
--- a/tempest/api/volume/admin/test_volume_services.py
+++ b/tempest/api/volume/admin/test_volume_services.py
@@ -26,19 +26,22 @@
@classmethod
def resource_setup(cls):
super(VolumesServicesV2TestJSON, cls).resource_setup()
- cls.services = cls.admin_volume_services_client.list_services()
+ cls.services = (cls.admin_volume_services_client.list_services()
+ ['services'])
cls.host_name = cls.services[0]['host']
cls.binary_name = cls.services[0]['binary']
@test.idempotent_id('e0218299-0a59-4f43-8b2b-f1c035b3d26d')
def test_list_services(self):
- services = self.admin_volume_services_client.list_services()
+ services = (self.admin_volume_services_client.list_services()
+ ['services'])
self.assertNotEqual(0, len(services))
@test.idempotent_id('63a3e1ca-37ee-4983-826d-83276a370d25')
def test_get_service_by_service_binary_name(self):
params = {'binary': self.binary_name}
- services = self.admin_volume_services_client.list_services(params)
+ services = (self.admin_volume_services_client.list_services(params)
+ ['services'])
self.assertNotEqual(0, len(services))
for service in services:
self.assertEqual(self.binary_name, service['binary'])
@@ -49,7 +52,8 @@
service['host'] == self.host_name]
params = {'host': self.host_name}
- services = self.admin_volume_services_client.list_services(params)
+ services = (self.admin_volume_services_client.list_services(params)
+ ['services'])
# we could have a periodic job checkin between the 2 service
# lookups, so only compare binary lists.
@@ -63,7 +67,8 @@
def test_get_service_by_service_and_host_name(self):
params = {'host': self.host_name, 'binary': self.binary_name}
- services = self.admin_volume_services_client.list_services(params)
+ services = (self.admin_volume_services_client.list_services(params)
+ ['services'])
self.assertEqual(1, len(services))
self.assertEqual(self.host_name, services[0]['host'])
self.assertEqual(self.binary_name, services[0]['binary'])
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index b79c185..dd69b7f 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -33,7 +33,7 @@
@test.idempotent_id('9d9b28e3-1b2e-4483-a2cc-24aa0ea1de54')
def test_volume_type_list(self):
# List Volume types.
- body = self.volume_types_client.list_volume_types()
+ body = self.volume_types_client.list_volume_types()['volume_types']
self.assertIsInstance(body, list)
@test.idempotent_id('c03cc62c-f4e9-4623-91ec-64ce2f9c1260')
@@ -51,7 +51,7 @@
vol_type_name = data_utils.rand_name("volume-type")
vol_type = self.volume_types_client.create_volume_type(
vol_type_name,
- extra_specs=extra_specs)
+ extra_specs=extra_specs)['volume_type']
volume_types.append(vol_type)
self.addCleanup(self._delete_volume_type, vol_type['id'])
params = {self.name_field: vol_name,
@@ -97,7 +97,7 @@
"vendor_name": vendor}
body = self.volume_types_client.create_volume_type(
name,
- extra_specs=extra_specs)
+ extra_specs=extra_specs)['volume_type']
self.assertIn('id', body)
self.addCleanup(self._delete_volume_type, body['id'])
self.assertIn('name', body)
@@ -107,7 +107,7 @@
self.assertTrue(body['id'] is not None,
"Field volume_type id is empty or not found.")
fetched_volume_type = self.volume_types_client.show_volume_type(
- body['id'])
+ body['id'])['volume_type']
self.assertEqual(name, fetched_volume_type['name'],
'The fetched Volume_type is different '
'from the created Volume_type')
@@ -124,13 +124,13 @@
provider = "LuksEncryptor"
control_location = "front-end"
name = data_utils.rand_name("volume-type")
- body = self.volume_types_client.create_volume_type(name)
+ body = self.volume_types_client.create_volume_type(name)['volume_type']
self.addCleanup(self._delete_volume_type, body['id'])
# Create encryption type
encryption_type = self.volume_types_client.create_encryption_type(
body['id'], provider=provider,
- control_location=control_location)
+ control_location=control_location)['encryption']
self.assertIn('volume_type_id', encryption_type)
self.assertEqual(provider, encryption_type['provider'],
"The created encryption_type provider is not equal "
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs.py b/tempest/api/volume/admin/test_volume_types_extra_specs.py
index c840697..bec803c 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs.py
@@ -25,7 +25,7 @@
super(VolumeTypesExtraSpecsV2Test, cls).resource_setup()
vol_type_name = data_utils.rand_name('Volume-type')
cls.volume_type = cls.volume_types_client.create_volume_type(
- vol_type_name)
+ vol_type_name)['volume_type']
@classmethod
def resource_cleanup(cls):
@@ -37,11 +37,11 @@
# List Volume types extra specs.
extra_specs = {"spec1": "val1"}
body = self.volume_types_client.create_volume_type_extra_specs(
- self.volume_type['id'], extra_specs)
+ self.volume_type['id'], extra_specs)['extra_specs']
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
body = self.volume_types_client.list_volume_types_extra_specs(
- self.volume_type['id'])
+ self.volume_type['id'])['extra_specs']
self.assertIsInstance(body, dict)
self.assertIn('spec1', body)
@@ -50,7 +50,7 @@
# Update volume type extra specs
extra_specs = {"spec2": "val1"}
body = self.volume_types_client.create_volume_type_extra_specs(
- self.volume_type['id'], extra_specs)
+ self.volume_type['id'], extra_specs)['extra_specs']
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
@@ -69,7 +69,7 @@
extra_specs = {"spec3": "val1"}
body = self.volume_types_client.create_volume_type_extra_specs(
self.volume_type['id'],
- extra_specs)
+ extra_specs)['extra_specs']
self.assertEqual(extra_specs, body,
"Volume type extra spec incorrectly created")
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
index e49e8b2..040ef53 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
@@ -31,7 +31,7 @@
cls.extra_specs = {"spec1": "val1"}
cls.volume_type = cls.volume_types_client.create_volume_type(
vol_type_name,
- extra_specs=cls.extra_specs)
+ extra_specs=cls.extra_specs)['volume_type']
@classmethod
def resource_cleanup(cls):
diff --git a/tempest/api/volume/test_qos.py b/tempest/api/volume/test_qos.py
index 5a58e2c..2f7c3df 100644
--- a/tempest/api/volume/test_qos.py
+++ b/tempest/api/volume/test_qos.py
@@ -53,7 +53,7 @@
def _create_test_volume_type(self):
vol_type_name = utils.rand_name("volume-type")
vol_type = self.volume_types_client.create_volume_type(
- vol_type_name)
+ vol_type_name)['volume_type']
self.addCleanup(self.volume_types_client.delete_volume_type,
vol_type['id'])
return vol_type
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 3550842..26e4569 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -220,7 +220,7 @@
def list(self):
client = self.client
- stacks = client.list_stacks()
+ stacks = client.list_stacks()['stacks']
LOG.debug("List count, %s Stacks" % len(stacks))
return stacks
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 766042e..7eb718e 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -1286,7 +1286,7 @@
randomized_name = data_utils.rand_name('scenario-type-' + name)
LOG.debug("Creating a volume type: %s", randomized_name)
body = client.create_volume_type(
- randomized_name)
+ randomized_name)['volume_type']
self.assertIn('id', body)
self.addCleanup(client.delete_volume_type, body['id'])
return body
@@ -1302,7 +1302,7 @@
LOG.debug("Creating an encryption type for volume type: %s", type_id)
client.create_encryption_type(
type_id, provider=provider, key_size=key_size, cipher=cipher,
- control_location=control_location)
+ control_location=control_location)['encryption']
class SwiftScenarioTest(ScenarioTest):
diff --git a/tempest/services/compute/json/agents_client.py b/tempest/services/compute/json/agents_client.py
index 1a1d832..d38c8cd 100644
--- a/tempest/services/compute/json/agents_client.py
+++ b/tempest/services/compute/json/agents_client.py
@@ -32,7 +32,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_agents, resp, body)
- return service_client.ResponseBodyList(resp, body['agents'])
+ return service_client.ResponseBody(resp, body)
def create_agent(self, **kwargs):
"""Create an agent build."""
@@ -40,7 +40,7 @@
resp, body = self.post('os-agents', post_body)
body = json.loads(body)
self.validate_response(schema.create_agent, resp, body)
- return service_client.ResponseBody(resp, body['agent'])
+ return service_client.ResponseBody(resp, body)
def delete_agent(self, agent_id):
"""Delete an existing agent build."""
@@ -53,4 +53,4 @@
put_body = json.dumps({'para': kwargs})
resp, body = self.put('os-agents/%s' % agent_id, put_body)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['agent'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/availability_zone_client.py b/tempest/services/compute/json/availability_zone_client.py
index c74fd10..0012637 100644
--- a/tempest/services/compute/json/availability_zone_client.py
+++ b/tempest/services/compute/json/availability_zone_client.py
@@ -32,5 +32,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema_list, resp, body)
- return service_client.ResponseBodyList(resp,
- body['availabilityZoneInfo'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/baremetal_nodes_client.py b/tempest/services/compute/json/baremetal_nodes_client.py
index 8165292..15f883a 100644
--- a/tempest/services/compute/json/baremetal_nodes_client.py
+++ b/tempest/services/compute/json/baremetal_nodes_client.py
@@ -33,7 +33,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_baremetal_nodes, resp, body)
- return service_client.ResponseBodyList(resp, body['nodes'])
+ return service_client.ResponseBody(resp, body)
def show_baremetal_node(self, baremetal_node_id):
"""Returns the details of a single baremetal node."""
@@ -41,4 +41,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_baremetal_node, resp, body)
- return service_client.ResponseBody(resp, body['node'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/extensions_client.py b/tempest/services/compute/json/extensions_client.py
index da342a8..4741812 100644
--- a/tempest/services/compute/json/extensions_client.py
+++ b/tempest/services/compute/json/extensions_client.py
@@ -26,9 +26,9 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_extensions, resp, body)
- return service_client.ResponseBodyList(resp, body['extensions'])
+ return service_client.ResponseBody(resp, body)
def show_extension(self, extension_alias):
resp, body = self.get('extensions/%s' % extension_alias)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['extension'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/fixed_ips_client.py b/tempest/services/compute/json/fixed_ips_client.py
index d0d9ca1..23401c3 100644
--- a/tempest/services/compute/json/fixed_ips_client.py
+++ b/tempest/services/compute/json/fixed_ips_client.py
@@ -26,7 +26,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_fixed_ip, resp, body)
- return service_client.ResponseBody(resp, body['fixed_ip'])
+ return service_client.ResponseBody(resp, body)
def reserve_fixed_ip(self, fixed_ip, **kwargs):
"""This reserves and unreserves fixed ips."""
diff --git a/tempest/services/compute/json/floating_ip_pools_client.py b/tempest/services/compute/json/floating_ip_pools_client.py
index 1e2133b..7a4434f 100644
--- a/tempest/services/compute/json/floating_ip_pools_client.py
+++ b/tempest/services/compute/json/floating_ip_pools_client.py
@@ -24,7 +24,7 @@
class FloatingIPPoolsClient(service_client.ServiceClient):
def list_floating_ip_pools(self, params=None):
- """Returns a list of all floating IP Pools."""
+ """Gets all floating IP Pools list."""
url = 'os-floating-ip-pools'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -32,4 +32,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_floating_ip_pools, resp, body)
- return service_client.ResponseBodyList(resp, body['floating_ip_pools'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/database/json/limits_client.py b/tempest/services/database/json/limits_client.py
index 830b67f..9358a33 100644
--- a/tempest/services/database/json/limits_client.py
+++ b/tempest/services/database/json/limits_client.py
@@ -27,4 +27,4 @@
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, self._parse_resp(body))
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/database/json/versions_client.py b/tempest/services/database/json/versions_client.py
index ed1ba81..43d253b 100644
--- a/tempest/services/database/json/versions_client.py
+++ b/tempest/services/database/json/versions_client.py
@@ -43,4 +43,4 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, self._parse_resp(body))
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index 67f7708..c5aa41a 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -123,7 +123,7 @@
self.expected_success(200, resp.status)
body = json.loads(body)
self._validate_schema(body, type='images')
- return service_client.ResponseBodyList(resp, body['images'])
+ return service_client.ResponseBody(resp, body)
def show_image(self, image_id):
url = 'v2/images/%s' % image_id
diff --git a/tempest/services/orchestration/json/orchestration_client.py b/tempest/services/orchestration/json/orchestration_client.py
index 84a9ed9..22e53f5 100644
--- a/tempest/services/orchestration/json/orchestration_client.py
+++ b/tempest/services/orchestration/json/orchestration_client.py
@@ -36,7 +36,7 @@
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['stacks'])
+ return service_client.ResponseBody(resp, body)
def create_stack(self, name, disable_rollback=True, parameters=None,
timeout_mins=60, template=None, template_url=None,
@@ -111,7 +111,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['stack'])
+ return service_client.ResponseBody(resp, body)
def suspend_stack(self, stack_identifier):
"""Suspend a stack."""
@@ -135,7 +135,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['resources'])
+ return service_client.ResponseBody(resp, body)
def show_resource(self, stack_identifier, resource_name):
"""Returns the details of a single resource."""
@@ -143,7 +143,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['resource'])
+ return service_client.ResponseBody(resp, body)
def delete_stack(self, stack_identifier):
"""Deletes the specified Stack."""
@@ -160,7 +160,7 @@
while True:
try:
body = self.show_resource(
- stack_identifier, resource_name)
+ stack_identifier, resource_name)['resource']
except lib_exc.NotFound:
# ignore this, as the resource may not have
# been created yet
@@ -195,7 +195,7 @@
while True:
try:
- body = self.show_stack(stack_identifier)
+ body = self.show_stack(stack_identifier)['stack']
except lib_exc.NotFound:
if status == 'DELETE_COMPLETE':
return
@@ -224,7 +224,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def list_events(self, stack_identifier):
"""Returns list of all events for a stack."""
@@ -232,7 +232,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['events'])
+ return service_client.ResponseBody(resp, body)
def list_resource_events(self, stack_identifier, resource_name):
"""Returns list of all events for a resource from stack."""
@@ -241,7 +241,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['events'])
+ return service_client.ResponseBody(resp, body)
def show_event(self, stack_identifier, resource_name, event_id):
"""Returns the details of a single stack's event."""
@@ -250,7 +250,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['event'])
+ return service_client.ResponseBody(resp, body)
def show_template(self, stack_identifier):
"""Returns the template for the stack."""
@@ -293,7 +293,7 @@
resp, body = self.get('resource_types')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['resource_types'])
+ return service_client.ResponseBody(resp, body)
def show_resource_type(self, resource_type_name):
"""Return the schema of a resource type."""
diff --git a/tempest/services/volume/json/admin/volume_services_client.py b/tempest/services/volume/json/admin/volume_services_client.py
index c8607c1..798a642 100644
--- a/tempest/services/volume/json/admin/volume_services_client.py
+++ b/tempest/services/volume/json/admin/volume_services_client.py
@@ -29,7 +29,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['services'])
+ return service_client.ResponseBody(resp, body)
class VolumesServicesClient(BaseVolumesServicesClient):
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py
index 84c7bc5..cd61859 100644
--- a/tempest/services/volume/json/admin/volume_types_client.py
+++ b/tempest/services/volume/json/admin/volume_types_client.py
@@ -58,7 +58,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['volume_types'])
+ return service_client.ResponseBody(resp, body)
def show_volume_type(self, volume_id):
"""Returns the details of a single volume_type."""
@@ -66,7 +66,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['volume_type'])
+ return service_client.ResponseBody(resp, body)
def create_volume_type(self, name, **kwargs):
"""
@@ -84,7 +84,7 @@
resp, body = self.post('types', post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['volume_type'])
+ return service_client.ResponseBody(resp, body)
def delete_volume_type(self, volume_id):
"""Deletes the Specified Volume_type."""
@@ -101,7 +101,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['extra_specs'])
+ return service_client.ResponseBody(resp, body)
def show_volume_type_extra_specs(self, vol_type_id, extra_spec_name):
"""Returns the details of a single volume_type extra spec."""
@@ -123,7 +123,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['extra_specs'])
+ return service_client.ResponseBody(resp, body)
def delete_volume_type_extra_specs(self, vol_id, extra_spec_name):
"""Deletes the Specified Volume_type extra spec."""
@@ -177,7 +177,7 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['encryption'])
+ return service_client.ResponseBody(resp, body)
def delete_encryption_type(self, vol_type_id):
"""Delete the encryption type for the specified volume-type."""
diff --git a/tempest/tests/services/compute/test_agents_client.py b/tempest/tests/services/compute/test_agents_client.py
index 8316c90..d14d8bf 100644
--- a/tempest/tests/services/compute/test_agents_client.py
+++ b/tempest/tests/services/compute/test_agents_client.py
@@ -34,7 +34,7 @@
body = '{"agents": []}'
if bytes_body:
body = body.encode('utf-8')
- expected = []
+ expected = {"agents": []}
response = (httplib2.Response({'status': 200}), body)
self.useFixture(mockpatch.Patch(
'tempest.common.service_client.ServiceClient.get',
@@ -42,10 +42,11 @@
self.assertEqual(expected, self.client.list_agents())
def _test_create_agent(self, bytes_body=False):
- expected = {"url": "http://foo.com", "hypervisor": "kvm",
- "md5hash": "md5", "version": "2", "architecture": "x86_64",
- "os": "linux", "agent_id": 1}
- serialized_body = json.dumps({"agent": expected})
+ expected = {"agent": {"url": "http://foo.com", "hypervisor": "kvm",
+ "md5hash": "md5", "version": "2",
+ "architecture": "x86_64",
+ "os": "linux", "agent_id": 1}}
+ serialized_body = json.dumps(expected)
if bytes_body:
serialized_body = serialized_body.encode('utf-8')
@@ -67,9 +68,9 @@
self.client.delete_agent("1")
def _test_update_agent(self, bytes_body=False):
- expected = {"url": "http://foo.com", "md5hash": "md5", "version": "2",
- "agent_id": 1}
- serialized_body = json.dumps({"agent": expected})
+ expected = {"agent": {"url": "http://foo.com", "md5hash": "md5",
+ "version": "2", "agent_id": 1}}
+ serialized_body = json.dumps(expected)
if bytes_body:
serialized_body = serialized_body.encode('utf-8')
diff --git a/tempest/tests/services/compute/test_extensions_client.py b/tempest/tests/services/compute/test_extensions_client.py
index aa46efa..20a5b7b 100644
--- a/tempest/tests/services/compute/test_extensions_client.py
+++ b/tempest/tests/services/compute/test_extensions_client.py
@@ -34,7 +34,7 @@
body = '{"extensions": []}'
if bytes_body:
body = body.encode('utf-8')
- expected = []
+ expected = {"extensions": []}
response = (httplib2.Response({'status': 200}), body)
self.useFixture(mockpatch.Patch(
'tempest.common.service_client.ServiceClient.get',
@@ -48,7 +48,7 @@
self._test_list_extensions(bytes_body=True)
def _test_show_extension(self, bytes_body=False):
- expected = {
+ expected = {"extension": {
"updated": "2011-06-09T00:00:00Z",
"name": "Multinic",
"links": [],
@@ -56,8 +56,8 @@
"http://docs.openstack.org/compute/ext/multinic/api/v1.1",
"alias": "NMN",
"description": u'\u2740(*\xb4\u25e1`*)\u2740'
- }
- serialized_body = json.dumps({"extension": expected})
+ }}
+ serialized_body = json.dumps(expected)
if bytes_body:
serialized_body = serialized_body.encode('utf-8')
diff --git a/tempest/tests/services/compute/test_quotas_client.py b/tempest/tests/services/compute/test_quotas_client.py
new file mode 100644
index 0000000..a9bd0a1
--- /dev/null
+++ b/tempest/tests/services/compute/test_quotas_client.py
@@ -0,0 +1,106 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import copy
+import httplib2
+
+from oslo_serialization import jsonutils as json
+from oslotest import mockpatch
+
+from tempest.services.compute.json import quotas_client
+from tempest.tests import base
+from tempest.tests import fake_auth_provider
+
+
+class TestQuotasClient(base.TestCase):
+
+ FAKE_QUOTA_SET = {"injected_file_content_bytes": 10240,
+ "metadata_items": 128,
+ "server_group_members": 10,
+ "server_groups": 10,
+ "ram": 51200,
+ "floating_ips": 10,
+ "key_pairs": 100,
+ "id": "8421f7be61064f50b680465c07f334af",
+ "instances": 10,
+ "security_group_rules": 20,
+ "injected_files": 5,
+ "cores": 20,
+ "fixed_ips": -1,
+ "injected_file_path_bytes": 255,
+ "security_groups": 10}
+
+ project_id = "8421f7be61064f50b680465c07f334af"
+
+ def setUp(self):
+ super(TestQuotasClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = quotas_client.QuotasClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_show_quota_set(self, bytes_body=False):
+ serialized_body = json.dumps({"quota_set": self.FAKE_QUOTA_SET})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.show_quota_set(self.project_id)
+ self.assertEqual(self.FAKE_QUOTA_SET, resp)
+
+ def test_show_quota_set_with_str_body(self):
+ self._test_show_quota_set()
+
+ def test_show_quota_set_with_bytes_body(self):
+ self._test_show_quota_set(bytes_body=True)
+
+ def _test_show_default_quota_set(self, bytes_body=False):
+ serialized_body = json.dumps({"quota_set": self.FAKE_QUOTA_SET})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.show_default_quota_set(self.project_id)
+ self.assertEqual(self.FAKE_QUOTA_SET, resp)
+
+ def test_show_default_quota_set_with_str_body(self):
+ self._test_show_quota_set()
+
+ def test_show_default_quota_set_with_bytes_body(self):
+ self._test_show_quota_set(bytes_body=True)
+
+ def test_update_quota_set(self):
+ fake_quota_set = copy.deepcopy(self.FAKE_QUOTA_SET)
+ fake_quota_set.pop("id")
+ serialized_body = json.dumps({"quota_set": fake_quota_set})
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.put',
+ return_value=mocked_resp))
+ resp = self.client.update_quota_set(self.project_id)
+ self.assertEqual(fake_quota_set, resp)
+
+ def test_delete_quota_set(self):
+ expected = {}
+ mocked_resp = (httplib2.Response({'status': 202}), None)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.delete',
+ return_value=mocked_resp))
+ resp = self.client.delete_quota_set(self.project_id)
+ self.assertEqual(expected, resp)