Merge "Return complete response from hosts_client"
diff --git a/tempest/api/compute/admin/test_quotas.py b/tempest/api/compute/admin/test_quotas.py
index 47bdfa6..3416eae 100644
--- a/tempest/api/compute/admin/test_quotas.py
+++ b/tempest/api/compute/admin/test_quotas.py
@@ -118,6 +118,8 @@
password=password,
tenant_id=tenant_id,
email=email)
+ if 'user' in user:
+ user = user['user']
user_id = user['id']
self.addCleanup(identity_client.delete_user, user_id)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index b2effc2..1ec2b56 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -129,7 +129,8 @@
for server in cls.servers:
try:
- cls.servers_client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(cls.servers_client,
+ server['id'])
except Exception:
LOG.exception('Waiting for deletion of server %s failed'
% server['id'])
@@ -150,7 +151,8 @@
except Exception as exc:
LOG.exception(exc)
cls.servers_client.delete_server(cls.server_id)
- cls.servers_client.wait_for_server_termination(cls.server_id)
+ waiters.wait_for_server_termination(cls.servers_client,
+ cls.server_id)
cls.server_id = None
raise
@@ -300,7 +302,8 @@
if server_id:
try:
cls.servers_client.delete_server(server_id)
- cls.servers_client.wait_for_server_termination(server_id)
+ waiters.wait_for_server_termination(cls.servers_client,
+ server_id)
except Exception:
LOG.exception('Failed to delete server %s' % server_id)
@@ -316,7 +319,8 @@
"""Deletes an existing server and waits for it to be gone."""
try:
cls.servers_client.delete_server(server_id)
- cls.servers_client.wait_for_server_termination(server_id)
+ waiters.wait_for_server_termination(cls.servers_client,
+ server_id)
except Exception:
LOG.exception('Failed to delete server %s' % server_id)
diff --git a/tempest/api/compute/images/test_images_negative.py b/tempest/api/compute/images/test_images_negative.py
index 84a8258..7f23730 100644
--- a/tempest/api/compute/images/test_images_negative.py
+++ b/tempest/api/compute/images/test_images_negative.py
@@ -50,7 +50,7 @@
# Delete server before trying to create server
self.servers_client.delete_server(server['id'])
- self.servers_client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.servers_client, server['id'])
# Create a new image after server is deleted
name = data_utils.rand_name('image')
meta = {'image_type': 'test'}
diff --git a/tempest/api/compute/keypairs/base.py b/tempest/api/compute/keypairs/base.py
index b742c8c..76e5573 100644
--- a/tempest/api/compute/keypairs/base.py
+++ b/tempest/api/compute/keypairs/base.py
@@ -33,6 +33,6 @@
kwargs = {'name': keypair_name}
if pub_key:
kwargs.update({'public_key': pub_key})
- body = self.client.create_keypair(**kwargs)
+ body = self.client.create_keypair(**kwargs)['keypair']
self.addCleanup(self._delete_keypair, keypair_name)
return body
diff --git a/tempest/api/compute/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py
index 225af12..d10bf14 100644
--- a/tempest/api/compute/keypairs/test_keypairs.py
+++ b/tempest/api/compute/keypairs/test_keypairs.py
@@ -34,9 +34,7 @@
key_list.append(keypair)
# Fetch all keypairs and verify the list
# has all created keypairs
- fetched_list = self.client.list_keypairs()
- # We need to remove the extra 'keypair' element in the
- # returned dict. See comment in keypairs_client.list_keypairs()
+ fetched_list = self.client.list_keypairs()['keypairs']
new_list = list()
for keypair in fetched_list:
new_list.append(keypair['keypair'])
@@ -65,7 +63,7 @@
# Keypair should be created, Got details by name and deleted
k_name = data_utils.rand_name('keypair')
self._create_keypair(k_name)
- keypair_detail = self.client.show_keypair(k_name)
+ keypair_detail = self.client.show_keypair(k_name)['keypair']
self.assertIn('name', keypair_detail)
self.assertIn('public_key', keypair_detail)
self.assertEqual(keypair_detail['name'], k_name,
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index bd252b0..7fff8bf 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -123,7 +123,7 @@
# Shutdown the server and then verify we can destroy the
# security groups, since no active server instance is using them
self.servers_client.delete_server(server_id)
- self.servers_client.wait_for_server_termination(server_id)
+ waiters.wait_for_server_termination(self.servers_client, server_id)
self.client.delete_security_group(sg['id'])
self.client.delete_security_group(sg2['id'])
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index e62a52b..c6fb2fb 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -21,6 +21,7 @@
from tempest.api.compute import base
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
+from tempest.common import waiters
from tempest import config
from tempest import test
@@ -178,7 +179,8 @@
# we're OK.
def cleanup_server():
self.client.delete_server(server_multi_nics['id'])
- self.client.wait_for_server_termination(server_multi_nics['id'])
+ waiters.wait_for_server_termination(self.client,
+ server_multi_nics['id'])
self.addCleanup(cleanup_server)
@@ -218,7 +220,8 @@
def cleanup_server():
self.client.delete_server(server_multi_nics['id'])
- self.client.wait_for_server_termination(server_multi_nics['id'])
+ waiters.wait_for_server_termination(self.client,
+ server_multi_nics['id'])
self.addCleanup(cleanup_server)
diff --git a/tempest/api/compute/servers/test_delete_server.py b/tempest/api/compute/servers/test_delete_server.py
index 673a401..551f8b4 100644
--- a/tempest/api/compute/servers/test_delete_server.py
+++ b/tempest/api/compute/servers/test_delete_server.py
@@ -38,14 +38,14 @@
# Delete a server while it's VM state is Building
server = self.create_test_server(wait_until='BUILD')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('925fdfb4-5b13-47ea-ac8a-c36ae6fddb05')
def test_delete_active_server(self):
# Delete a server while it's VM state is Active
server = self.create_test_server(wait_until='ACTIVE')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('546d368c-bb6c-4645-979a-83ed16f3a6be')
def test_delete_server_while_in_shutoff_state(self):
@@ -54,7 +54,7 @@
self.client.stop(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SHUTOFF')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('943bd6e8-4d7a-4904-be83-7a6cc2d4213b')
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
@@ -65,7 +65,7 @@
self.client.pause_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'PAUSED')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('1f82ebd3-8253-4f4e-b93f-de9b7df56d8b')
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
@@ -76,7 +76,7 @@
self.client.suspend_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SUSPENDED')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('bb0cb402-09dd-4947-b6e5-5e7e1cfa61ad')
@testtools.skipUnless(CONF.compute_feature_enabled.shelve,
@@ -95,7 +95,7 @@
waiters.wait_for_server_status(self.client, server['id'],
'SHELVED')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('ab0c38b4-cdd8-49d3-9b92-0cb898723c01')
@testtools.skipIf(not CONF.compute_feature_enabled.resize,
@@ -107,7 +107,7 @@
waiters.wait_for_server_status(self.client, server['id'],
'VERIFY_RESIZE')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
@test.idempotent_id('d0f3f0d6-d9b6-4a32-8da4-23015dcab23c')
@test.services('volume')
@@ -128,7 +128,7 @@
volume['id'], 'in-use')
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
waiters.wait_for_volume_status(volumes_client,
volume['id'], 'available')
@@ -152,12 +152,13 @@
server = self.non_admin_client.show_server(server['id'])
self.assertEqual(server['status'], 'ERROR')
self.non_admin_client.delete_server(server['id'])
- self.servers_client.wait_for_server_termination(server['id'],
- ignore_error=True)
+ waiters.wait_for_server_termination(self.servers_client,
+ server['id'],
+ ignore_error=True)
@test.idempotent_id('73177903-6737-4f27-a60c-379e8ae8cf48')
def test_admin_delete_servers_of_others(self):
# Administrator can delete servers of others
server = self.create_test_server(wait_until='ACTIVE')
self.admin_client.delete_server(server['id'])
- self.servers_client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.servers_client, server['id'])
diff --git a/tempest/api/compute/servers/test_list_servers_negative.py b/tempest/api/compute/servers/test_list_servers_negative.py
index def6cf5..f205ddf 100644
--- a/tempest/api/compute/servers/test_list_servers_negative.py
+++ b/tempest/api/compute/servers/test_list_servers_negative.py
@@ -17,6 +17,7 @@
from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
+from tempest.common import waiters
from tempest import test
@@ -47,8 +48,8 @@
# be put into ERROR status on a quick spawn, then delete,
# as the compute node expects the instance local status
# to be spawning, not deleted. See LP Bug#1061167
- cls.client.wait_for_server_termination(srv['id'],
- ignore_error=True)
+ waiters.wait_for_server_termination(cls.client, srv['id'],
+ ignore_error=True)
cls.deleted_fixtures.append(srv)
@test.attr(type=['negative'])
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index fe05456..f5d99fc 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -171,7 +171,7 @@
# Rebuild and Reboot a deleted server
server = self.create_test_server()
self.client.delete_server(server['id'])
- self.client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.client, server['id'])
self.assertRaises(lib_exc.NotFound,
self.client.rebuild,
diff --git a/tempest/api/data_processing/base.py b/tempest/api/data_processing/base.py
index 904cbb6..5d78539 100644
--- a/tempest/api/data_processing/base.py
+++ b/tempest/api/data_processing/base.py
@@ -297,6 +297,7 @@
flavor_id,
node_configs,
**kwargs)
+ resp_body = resp_body['node_group_template']
# store id of created node group template
cls._node_group_templates.append(resp_body['id'])
@@ -316,6 +317,7 @@
node_groups,
cluster_configs,
**kwargs)
+ resp_body = resp_body['cluster_template']
# store id of created cluster template
cls._cluster_templates.append(resp_body['id'])
@@ -330,6 +332,7 @@
removed in tearDownClass method.
"""
resp_body = cls.client.create_data_source(name, type, url, **kwargs)
+ resp_body = resp_body['data_source']
# store id of created data source
cls._data_sources.append(resp_body['id'])
@@ -343,6 +346,7 @@
be automatically removed in tearDownClass method.
"""
resp_body = cls.client.create_job_binary_internal(name, data)
+ resp_body = resp_body['job_binary_internal']
# store id of created job binary internal
cls._job_binary_internals.append(resp_body['id'])
@@ -357,6 +361,7 @@
removed in tearDownClass method.
"""
resp_body = cls.client.create_job_binary(name, url, extra, **kwargs)
+ resp_body = resp_body['job_binary']
# store id of created job binary
cls._job_binaries.append(resp_body['id'])
@@ -372,6 +377,7 @@
"""
resp_body = cls.client.create_job(name,
job_type, mains, libs, **kwargs)
+ resp_body = resp_body['job']
# store id of created job
cls._jobs.append(resp_body['id'])
@@ -400,7 +406,7 @@
"""
if not cls.default_plugin:
return None
- plugin = cls.client.get_plugin(cls.default_plugin)
+ plugin = cls.client.get_plugin(cls.default_plugin)['plugin']
for version in DEFAULT_TEMPLATES[cls.default_plugin].keys():
if version in plugin['versions']:
diff --git a/tempest/api/data_processing/test_cluster_templates.py b/tempest/api/data_processing/test_cluster_templates.py
index e357a85..42cbd14 100644
--- a/tempest/api/data_processing/test_cluster_templates.py
+++ b/tempest/api/data_processing/test_cluster_templates.py
@@ -98,7 +98,7 @@
template_info = self._create_cluster_template()
# check for cluster template in list
- templates = self.client.list_cluster_templates()
+ templates = self.client.list_cluster_templates()['cluster_templates']
templates_info = [(template['id'], template['name'])
for template in templates]
self.assertIn(template_info, templates_info)
@@ -110,6 +110,7 @@
# check cluster template fetch by id
template = self.client.get_cluster_template(template_id)
+ template = template['cluster_template']
self.assertEqual(template_name, template['name'])
self.assertDictContainsSubset(self.cluster_template, template)
diff --git a/tempest/api/data_processing/test_data_sources.py b/tempest/api/data_processing/test_data_sources.py
index dd16b2f..67d09a0 100644
--- a/tempest/api/data_processing/test_data_sources.py
+++ b/tempest/api/data_processing/test_data_sources.py
@@ -68,13 +68,13 @@
def _list_data_sources(self, source_info):
# check for data source in list
- sources = self.client.list_data_sources()
+ sources = self.client.list_data_sources()['data_sources']
sources_info = [(source['id'], source['name']) for source in sources]
self.assertIn(source_info, sources_info)
def _get_data_source(self, source_id, source_name, source_body):
# check data source fetch by id
- source = self.client.get_data_source(source_id)
+ source = self.client.get_data_source(source_id)['data_source']
self.assertEqual(source_name, source['name'])
self.assertDictContainsSubset(source_body, source)
diff --git a/tempest/api/data_processing/test_job_binaries.py b/tempest/api/data_processing/test_job_binaries.py
index fb21270..98b7e24 100644
--- a/tempest/api/data_processing/test_job_binaries.py
+++ b/tempest/api/data_processing/test_job_binaries.py
@@ -80,7 +80,7 @@
binary_info = self._create_job_binary(self.swift_job_binary_with_extra)
# check for job binary in list
- binaries = self.client.list_job_binaries()
+ binaries = self.client.list_job_binaries()['binaries']
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@@ -91,7 +91,7 @@
self._create_job_binary(self.swift_job_binary_with_extra))
# check job binary fetch by id
- binary = self.client.get_job_binary(binary_id)
+ binary = self.client.get_job_binary(binary_id)['job_binary']
self.assertEqual(binary_name, binary['name'])
self.assertDictContainsSubset(self.swift_job_binary, binary)
@@ -115,7 +115,7 @@
binary_info = self._create_job_binary(self.internal_db_job_binary)
# check for job binary in list
- binaries = self.client.list_job_binaries()
+ binaries = self.client.list_job_binaries()['binaries']
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@@ -126,7 +126,7 @@
self._create_job_binary(self.internal_db_job_binary))
# check job binary fetch by id
- binary = self.client.get_job_binary(binary_id)
+ binary = self.client.get_job_binary(binary_id)['job_binary']
self.assertEqual(binary_name, binary['name'])
self.assertDictContainsSubset(self.internal_db_job_binary, binary)
diff --git a/tempest/api/data_processing/test_job_binary_internals.py b/tempest/api/data_processing/test_job_binary_internals.py
index 3d76ebe..6919fa5 100644
--- a/tempest/api/data_processing/test_job_binary_internals.py
+++ b/tempest/api/data_processing/test_job_binary_internals.py
@@ -57,7 +57,7 @@
binary_info = self._create_job_binary_internal()
# check for job binary internal in list
- binaries = self.client.list_job_binary_internals()
+ binaries = self.client.list_job_binary_internals()['binaries']
binaries_info = [(binary['id'], binary['name']) for binary in binaries]
self.assertIn(binary_info, binaries_info)
@@ -68,7 +68,7 @@
# check job binary internal fetch by id
binary = self.client.get_job_binary_internal(binary_id)
- self.assertEqual(binary_name, binary['name'])
+ self.assertEqual(binary_name, binary['job_binary_internal']['name'])
@test.attr(type='smoke')
@test.idempotent_id('b3568c33-4eed-40d5-aae4-6ff3b2ac58f5')
diff --git a/tempest/api/data_processing/test_jobs.py b/tempest/api/data_processing/test_jobs.py
index 83eb54d..7798056 100644
--- a/tempest/api/data_processing/test_jobs.py
+++ b/tempest/api/data_processing/test_jobs.py
@@ -71,7 +71,7 @@
job_info = self._create_job()
# check for job in list
- jobs = self.client.list_jobs()
+ jobs = self.client.list_jobs()['jobs']
jobs_info = [(job['id'], job['name']) for job in jobs]
self.assertIn(job_info, jobs_info)
@@ -81,7 +81,7 @@
job_id, job_name = self._create_job()
# check job fetch by id
- job = self.client.get_job(job_id)
+ job = self.client.get_job(job_id)['job']
self.assertEqual(job_name, job['name'])
@test.attr(type='smoke')
diff --git a/tempest/api/data_processing/test_node_group_templates.py b/tempest/api/data_processing/test_node_group_templates.py
index 102799d..388bb58 100644
--- a/tempest/api/data_processing/test_node_group_templates.py
+++ b/tempest/api/data_processing/test_node_group_templates.py
@@ -65,6 +65,7 @@
# check for node group template in list
templates = self.client.list_node_group_templates()
+ templates = templates['node_group_templates']
templates_info = [(template['id'], template['name'])
for template in templates]
self.assertIn(template_info, templates_info)
@@ -76,6 +77,7 @@
# check node group template fetch by id
template = self.client.get_node_group_template(template_id)
+ template = template['node_group_template']
self.assertEqual(template_name, template['name'])
self.assertDictContainsSubset(self.node_group_template, template)
diff --git a/tempest/api/data_processing/test_plugins.py b/tempest/api/data_processing/test_plugins.py
index 92a5bd0..14594e4 100644
--- a/tempest/api/data_processing/test_plugins.py
+++ b/tempest/api/data_processing/test_plugins.py
@@ -25,7 +25,7 @@
It ensures main plugins availability.
"""
- plugins = self.client.list_plugins()
+ plugins = self.client.list_plugins()['plugins']
plugins_names = [plugin['name'] for plugin in plugins]
for enabled_plugin in CONF.data_processing_feature_enabled.plugins:
self.assertIn(enabled_plugin, plugins_names)
@@ -41,12 +41,13 @@
@test.idempotent_id('53cf6487-2cfb-4a6f-8671-97c542c6e901')
def test_plugin_get(self):
for plugin_name in self._list_all_plugin_names():
- plugin = self.client.get_plugin(plugin_name)
+ plugin = self.client.get_plugin(plugin_name)['plugin']
self.assertEqual(plugin_name, plugin['name'])
for plugin_version in plugin['versions']:
detailed_plugin = self.client.get_plugin(plugin_name,
plugin_version)
+ detailed_plugin = detailed_plugin['plugin']
self.assertEqual(plugin_name, detailed_plugin['name'])
# check that required image tags contains name and version
diff --git a/tempest/api/identity/admin/v2/test_roles.py b/tempest/api/identity/admin/v2/test_roles.py
index 1babc45..0b28a07 100644
--- a/tempest/api/identity/admin/v2/test_roles.py
+++ b/tempest/api/identity/admin/v2/test_roles.py
@@ -76,7 +76,7 @@
self.data.setup_test_role()
role_id = self.data.role['id']
role_name = self.data.role['name']
- body = self.client.get_role(role_id)
+ body = self.client.get_role(role_id)['role']
self.assertEqual(role_id, body['id'])
self.assertEqual(role_name, body['name'])
diff --git a/tempest/api/identity/admin/v2/test_tenants.py b/tempest/api/identity/admin/v2/test_tenants.py
index f828f66..9fff5f3 100644
--- a/tempest/api/identity/admin/v2/test_tenants.py
+++ b/tempest/api/identity/admin/v2/test_tenants.py
@@ -32,7 +32,7 @@
self.data.tenants.append(tenant)
tenants.append(tenant)
tenant_ids = map(lambda x: x['id'], tenants)
- body = self.client.list_tenants()
+ body = self.client.list_tenants()['tenants']
found = [t for t in body if t['id'] in tenant_ids]
self.assertEqual(len(found), len(tenants), 'Tenants not created')
@@ -40,7 +40,7 @@
self.client.delete_tenant(tenant['id'])
self.data.tenants.remove(tenant)
- body = self.client.list_tenants()
+ body = self.client.list_tenants()['tenants']
found = [tenant for tenant in body if tenant['id'] in tenant_ids]
self.assertFalse(any(found), 'Tenants failed to delete')
diff --git a/tempest/api/identity/admin/v3/test_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py
index 662d06c..d22b27f 100644
--- a/tempest/api/identity/admin/v3/test_credentials.py
+++ b/tempest/api/identity/admin/v3/test_credentials.py
@@ -33,12 +33,12 @@
for i in range(2):
cls.project = cls.client.create_project(
data_utils.rand_name('project'),
- description=data_utils.rand_name('project-desc'))
+ description=data_utils.rand_name('project-desc'))['project']
cls.projects.append(cls.project['id'])
cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=u_password,
- email=u_email, project_id=cls.projects[0])
+ email=u_email, project_id=cls.projects[0])['user']
@classmethod
def resource_cleanup(cls):
@@ -57,7 +57,7 @@
data_utils.rand_name('Secret')]
cred = self.creds_client.create_credential(
keys[0], keys[1], self.user_body['id'],
- self.projects[0])
+ self.projects[0])['credential']
self.addCleanup(self._delete_credential, cred['id'])
for value1 in self.creds_list[0]:
self.assertIn(value1, cred)
@@ -68,14 +68,14 @@
data_utils.rand_name('NewSecret')]
update_body = self.creds_client.update_credential(
cred['id'], access_key=new_keys[0], secret_key=new_keys[1],
- project_id=self.projects[1])
+ project_id=self.projects[1])['credential']
self.assertEqual(cred['id'], update_body['id'])
self.assertEqual(self.projects[1], update_body['project_id'])
self.assertEqual(self.user_body['id'], update_body['user_id'])
self.assertEqual(update_body['blob']['access'], new_keys[0])
self.assertEqual(update_body['blob']['secret'], new_keys[1])
- get_body = self.creds_client.get_credential(cred['id'])
+ get_body = self.creds_client.get_credential(cred['id'])['credential']
for value1 in self.creds_list[0]:
self.assertEqual(update_body[value1],
get_body[value1])
@@ -92,11 +92,11 @@
cred = self.creds_client.create_credential(
data_utils.rand_name('Access'),
data_utils.rand_name('Secret'),
- self.user_body['id'], self.projects[0])
+ self.user_body['id'], self.projects[0])['credential']
created_cred_ids.append(cred['id'])
self.addCleanup(self._delete_credential, cred['id'])
- creds = self.creds_client.list_credentials()
+ creds = self.creds_client.list_credentials()['credentials']
for i in creds:
fetched_cred_ids.append(i['id'])
diff --git a/tempest/api/identity/admin/v3/test_default_project_id.py b/tempest/api/identity/admin/v3/test_default_project_id.py
index 98fff09..4c69758 100644
--- a/tempest/api/identity/admin/v3/test_default_project_id.py
+++ b/tempest/api/identity/admin/v3/test_default_project_id.py
@@ -39,13 +39,14 @@
def test_default_project_id(self):
# create a domain
dom_name = data_utils.rand_name('dom')
- domain_body = self.client.create_domain(dom_name)
+ domain_body = self.client.create_domain(dom_name)['domain']
dom_id = domain_body['id']
self.addCleanup(self._delete_domain, dom_id)
# create a project in the domain
proj_name = data_utils.rand_name('proj')
- proj_body = self.client.create_project(proj_name, domain_id=dom_id)
+ proj_body = self.client.create_project(proj_name,
+ domain_id=dom_id)['project']
proj_id = proj_body['id']
self.addCleanup(self.client.delete_project, proj_id)
self.assertEqual(proj_body['domain_id'], dom_id,
@@ -57,7 +58,7 @@
user_name = data_utils.rand_name('user')
user_body = self.client.create_user(user_name, password=user_name,
domain_id=dom_id,
- default_project_id=proj_id)
+ default_project_id=proj_id)['user']
user_id = user_body['id']
self.addCleanup(self.client.delete_user, user_id)
self.assertEqual(user_body['domain_id'], dom_id,
@@ -82,6 +83,6 @@
# verify the user's token and see that it is scoped to the project
token, auth_data = admin_client.auth_provider.get_auth()
- result = admin_client.identity_v3_client.get_token(token)
+ result = admin_client.identity_v3_client.get_token(token)['token']
self.assertEqual(result['project']['domain']['id'], dom_id)
self.assertEqual(result['project']['id'], proj_id)
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
index 5bfb981..742d737 100644
--- a/tempest/api/identity/admin/v3/test_domains.py
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -37,12 +37,12 @@
for _ in range(3):
domain = self.client.create_domain(
data_utils.rand_name('domain'),
- description=data_utils.rand_name('domain-desc'))
+ description=data_utils.rand_name('domain-desc'))['domain']
# Delete the domain at the end of this method
self.addCleanup(self._delete_domain, domain['id'])
domain_ids.append(domain['id'])
# List and Verify Domains
- body = self.client.list_domains()
+ body = self.client.list_domains()['domains']
for d in body:
fetched_ids.append(d['id'])
missing_doms = [d for d in domain_ids if d not in fetched_ids]
@@ -54,7 +54,7 @@
d_name = data_utils.rand_name('domain')
d_desc = data_utils.rand_name('domain-desc')
domain = self.client.create_domain(
- d_name, description=d_desc)
+ d_name, description=d_desc)['domain']
self.addCleanup(self._delete_domain, domain['id'])
self.assertIn('id', domain)
self.assertIn('description', domain)
@@ -69,7 +69,7 @@
new_name = data_utils.rand_name('new-name')
updated_domain = self.client.update_domain(
- domain['id'], name=new_name, description=new_desc)
+ domain['id'], name=new_name, description=new_desc)['domain']
self.assertIn('id', updated_domain)
self.assertIn('description', updated_domain)
self.assertIn('name', updated_domain)
@@ -80,7 +80,7 @@
self.assertEqual(new_desc, updated_domain['description'])
self.assertEqual(True, updated_domain['enabled'])
- fetched_domain = self.client.get_domain(domain['id'])
+ fetched_domain = self.client.get_domain(domain['id'])['domain']
self.assertEqual(new_name, fetched_domain['name'])
self.assertEqual(new_desc, fetched_domain['description'])
self.assertEqual(True, fetched_domain['enabled'])
@@ -91,7 +91,7 @@
d_name = data_utils.rand_name('domain')
d_desc = data_utils.rand_name('domain-desc')
domain = self.client.create_domain(
- d_name, description=d_desc, enabled=False)
+ d_name, description=d_desc, enabled=False)['domain']
self.addCleanup(self.client.delete_domain, domain['id'])
self.assertEqual(d_name, domain['name'])
self.assertFalse(domain['enabled'])
@@ -101,7 +101,7 @@
def test_create_domain_without_description(self):
# Create domain only with name
d_name = data_utils.rand_name('domain')
- domain = self.client.create_domain(d_name)
+ domain = self.client.create_domain(d_name)['domain']
self.addCleanup(self._delete_domain, domain['id'])
self.assertIn('id', domain)
expected_data = {'name': d_name, 'enabled': True}
@@ -119,6 +119,6 @@
@test.attr(type='smoke')
@test.idempotent_id('17a5de24-e6a0-4e4a-a9ee-d85b6e5612b5')
def test_default_domain_exists(self):
- domain = self.client.get_domain(self.domain_id)
+ domain = self.client.get_domain(self.domain_id)['domain']
self.assertTrue(domain['enabled'])
diff --git a/tempest/api/identity/admin/v3/test_domains_negative.py b/tempest/api/identity/admin/v3/test_domains_negative.py
index e2f3ef5..156179c 100644
--- a/tempest/api/identity/admin/v3/test_domains_negative.py
+++ b/tempest/api/identity/admin/v3/test_domains_negative.py
@@ -28,7 +28,8 @@
def test_delete_active_domain(self):
d_name = data_utils.rand_name('domain')
d_desc = data_utils.rand_name('domain-desc')
- domain = self.client.create_domain(d_name, description=d_desc)
+ domain = self.client.create_domain(d_name,
+ description=d_desc)['domain']
domain_id = domain['id']
self.addCleanup(self.delete_domain, domain_id)
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index 9a8104f..e44a96b 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -36,6 +36,7 @@
cls.service_data =\
cls.service_client.create_service(s_name, s_type,
description=s_description)
+ cls.service_data = cls.service_data['service']
cls.service_id = cls.service_data['id']
cls.service_ids.append(cls.service_id)
# Create endpoints so as to use for LIST and GET test cases
@@ -44,8 +45,8 @@
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
- endpoint = cls.client.create_endpoint(
- cls.service_id, interface, url, region=region, enabled=True)
+ endpoint = (cls.client.create_endpoint(cls.service_id, interface,
+ url, region=region, enabled=True))['endpoint']
cls.setup_endpoints.append(endpoint)
@classmethod
@@ -59,7 +60,7 @@
@test.idempotent_id('c19ecf90-240e-4e23-9966-21cee3f6a618')
def test_list_endpoints(self):
# Get a list of endpoints
- fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()['endpoints']
# Asserting LIST endpoints
missing_endpoints =\
[e for e in self.setup_endpoints if e not in fetched_endpoints]
@@ -72,21 +73,20 @@
region = data_utils.rand_name('region')
url = data_utils.rand_url()
interface = 'public'
- endpoint =\
- self.client.create_endpoint(self.service_id, interface, url,
- region=region, enabled=True)
+ endpoint = (self.client.create_endpoint(self.service_id, interface,
+ url, region=region, enabled=True)['endpoint'])
# Asserting Create Endpoint response body
self.assertIn('id', endpoint)
self.assertEqual(region, endpoint['region'])
self.assertEqual(url, endpoint['url'])
# Checking if created endpoint is present in the list of endpoints
- fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()['endpoints']
fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
self.assertIn(endpoint['id'], fetched_endpoints_id)
# Deleting the endpoint created in this method
self.client.delete_endpoint(endpoint['id'])
# Checking whether endpoint is deleted successfully
- fetched_endpoints = self.client.list_endpoints()
+ fetched_endpoints = self.client.list_endpoints()['endpoints']
fetched_endpoints_id = [e['id'] for e in fetched_endpoints]
self.assertNotIn(endpoint['id'], fetched_endpoints_id)
@@ -101,7 +101,7 @@
endpoint_for_update =\
self.client.create_endpoint(self.service_id, interface1,
url1, region=region1,
- enabled=True)
+ enabled=True)['endpoint']
self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
# Creating service so as update endpoint with new service ID
s_name = data_utils.rand_name('service')
@@ -110,6 +110,7 @@
service2 =\
self.service_client.create_service(s_name, s_type,
description=s_description)
+ service2 = service2['service']
self.service_ids.append(service2['id'])
# Updating endpoint with new values
region2 = data_utils.rand_name('region')
@@ -119,7 +120,8 @@
self.client.update_endpoint(endpoint_for_update['id'],
service_id=service2['id'],
interface=interface2, url=url2,
- region=region2, enabled=False)
+ region=region2,
+ enabled=False)['endpoint']
# Asserting if the attributes of endpoint are updated
self.assertEqual(service2['id'], endpoint['service_id'])
self.assertEqual(interface2, endpoint['interface'])
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index b043415..8cf853b 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -38,7 +38,8 @@
s_description = data_utils.rand_name('description')
cls.service_data = (
cls.service_client.create_service(s_name, s_type,
- description=s_description))
+ description=s_description)
+ ['service'])
cls.service_id = cls.service_data['id']
cls.service_ids.append(cls.service_id)
@@ -78,7 +79,8 @@
interface1 = 'public'
endpoint_for_update = (
self.client.create_endpoint(self.service_id, interface1,
- url1, region=region1, enabled=True))
+ url1, region=region1,
+ enabled=True))['endpoint']
self.addCleanup(self.client.delete_endpoint, endpoint_for_update['id'])
self.assertRaises(lib_exc.BadRequest, self.client.update_endpoint,
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index 88e2959..5ce6354 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -25,7 +25,7 @@
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
group = self.client.create_group(name,
- description=description)
+ description=description)['group']
self.addCleanup(self.client.delete_group, group['id'])
self.assertEqual(group['name'], name)
self.assertEqual(group['description'], description)
@@ -34,11 +34,11 @@
new_desc = data_utils.rand_name('UpdateDescription')
updated_group = self.client.update_group(group['id'],
name=new_name,
- description=new_desc)
+ description=new_desc)['group']
self.assertEqual(updated_group['name'], new_name)
self.assertEqual(updated_group['description'], new_desc)
- new_group = self.client.get_group(group['id'])
+ new_group = self.client.get_group(group['id'])['group']
self.assertEqual(group['id'], new_group['id'])
self.assertEqual(new_name, new_group['name'])
self.assertEqual(new_desc, new_group['description'])
@@ -47,25 +47,25 @@
@test.idempotent_id('1598521a-2f36-4606-8df9-30772bd51339')
def test_group_users_add_list_delete(self):
name = data_utils.rand_name('Group')
- group = self.client.create_group(name)
+ group = self.client.create_group(name)['group']
self.addCleanup(self.client.delete_group, group['id'])
# add user into group
users = []
for i in range(3):
name = data_utils.rand_name('User')
- user = self.client.create_user(name)
+ user = self.client.create_user(name)['user']
users.append(user)
self.addCleanup(self.client.delete_user, user['id'])
self.client.add_group_user(group['id'], user['id'])
# list users in group
- group_users = self.client.list_group_users(group['id'])
+ group_users = self.client.list_group_users(group['id'])['users']
self.assertEqual(sorted(users), sorted(group_users))
# delete user in group
for user in users:
self.client.delete_group_user(group['id'],
user['id'])
- group_users = self.client.list_group_users(group['id'])
+ group_users = self.client.list_group_users(group['id'])['users']
self.assertEqual(len(group_users), 0)
@test.idempotent_id('64573281-d26a-4a52-b899-503cb0f4e4ec')
@@ -73,18 +73,18 @@
# create a user
user = self.client.create_user(
data_utils.rand_name('User'),
- password=data_utils.rand_name('Pass'))
+ password=data_utils.rand_name('Pass'))['user']
self.addCleanup(self.client.delete_user, user['id'])
# create two groups, and add user into them
groups = []
for i in range(2):
name = data_utils.rand_name('Group')
- group = self.client.create_group(name)
+ group = self.client.create_group(name)['group']
groups.append(group)
self.addCleanup(self.client.delete_group, group['id'])
self.client.add_group_user(group['id'], user['id'])
# list groups which user belongs to
- user_groups = self.client.list_user_groups(user['id'])
+ user_groups = self.client.list_user_groups(user['id'])['groups']
self.assertEqual(sorted(groups), sorted(user_groups))
self.assertEqual(2, len(user_groups))
@@ -97,11 +97,11 @@
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
group = self.client.create_group(name,
- description=description)
+ description=description)['group']
self.addCleanup(self.client.delete_group, group['id'])
group_ids.append(group['id'])
# List and Verify Groups
- body = self.client.list_groups()
+ body = self.client.list_groups()['groups']
for g in body:
fetched_ids.append(g['id'])
missing_groups = [g for g in group_ids if g not in fetched_ids]
diff --git a/tempest/api/identity/admin/v3/test_list_projects.py b/tempest/api/identity/admin/v3/test_list_projects.py
index 12d80bb..5185fea 100644
--- a/tempest/api/identity/admin/v3/test_list_projects.py
+++ b/tempest/api/identity/admin/v3/test_list_projects.py
@@ -28,22 +28,23 @@
# Create project with domain
cls.p1_name = data_utils.rand_name('project')
cls.p1 = cls.client.create_project(
- cls.p1_name, enabled=False, domain_id=cls.data.domain['id'])
+ cls.p1_name, enabled=False,
+ domain_id=cls.data.domain['id'])['project']
cls.data.projects.append(cls.p1)
cls.project_ids.append(cls.p1['id'])
# Create default project
p2_name = data_utils.rand_name('project')
- cls.p2 = cls.client.create_project(p2_name)
+ cls.p2 = cls.client.create_project(p2_name)['project']
cls.data.projects.append(cls.p2)
cls.project_ids.append(cls.p2['id'])
@test.idempotent_id('1d830662-22ad-427c-8c3e-4ec854b0af44')
def test_projects_list(self):
# List projects
- list_projects = self.client.list_projects()
+ list_projects = self.client.list_projects()['projects']
for p in self.project_ids:
- get_project = self.client.get_project(p)
+ get_project = self.client.get_project(p)['project']
self.assertIn(get_project, list_projects)
@test.idempotent_id('fab13f3c-f6a6-4b9f-829b-d32fd44fdf10')
@@ -63,6 +64,6 @@
self._list_projects_with_params({'name': self.p1_name}, 'name')
def _list_projects_with_params(self, params, key):
- body = self.client.list_projects(params)
+ body = self.client.list_projects(params)['projects']
self.assertIn(self.p1[key], map(lambda x: x[key], body))
self.assertNotIn(self.p2[key], map(lambda x: x[key], body))
diff --git a/tempest/api/identity/admin/v3/test_list_users.py b/tempest/api/identity/admin/v3/test_list_users.py
index d3d51b4..320b479 100644
--- a/tempest/api/identity/admin/v3/test_list_users.py
+++ b/tempest/api/identity/admin/v3/test_list_users.py
@@ -25,7 +25,7 @@
# assert the response based on expected and not_expected
# expected: user expected in the list response
# not_expected: user, which should not be present in list response
- body = self.client.get_users(params)
+ body = self.client.get_users(params)['users']
self.assertIn(expected[key], map(lambda x: x[key], body))
self.assertNotIn(not_expected[key],
map(lambda x: x[key], body))
@@ -41,13 +41,13 @@
u1_name = data_utils.rand_name('test_user')
cls.domain_enabled_user = cls.client.create_user(
u1_name, password=alt_password,
- email=cls.alt_email, domain_id=cls.data.domain['id'])
+ email=cls.alt_email, domain_id=cls.data.domain['id'])['user']
cls.data.v3_users.append(cls.domain_enabled_user)
# Create default not enabled user
u2_name = data_utils.rand_name('test_user')
cls.non_domain_enabled_user = cls.client.create_user(
u2_name, password=alt_password,
- email=cls.alt_email, enabled=False)
+ email=cls.alt_email, enabled=False)['user']
cls.data.v3_users.append(cls.non_domain_enabled_user)
@test.idempotent_id('08f9aabb-dcfe-41d0-8172-82b5fa0bd73d')
@@ -77,7 +77,7 @@
@test.idempotent_id('b30d4651-a2ea-4666-8551-0c0e49692635')
def test_list_users(self):
# List users
- body = self.client.get_users()
+ body = self.client.get_users()['users']
fetched_ids = [u['id'] for u in body]
missing_users = [u['id'] for u in self.data.v3_users
if u['id'] not in fetched_ids]
@@ -88,7 +88,7 @@
@test.idempotent_id('b4baa3ae-ac00-4b4e-9e27-80deaad7771f')
def test_get_user(self):
# Get a user detail
- user = self.client.get_user(self.data.v3_users[0]['id'])
+ user = self.client.get_user(self.data.v3_users[0]['id'])['user']
self.assertEqual(self.data.v3_users[0]['id'], user['id'])
self.assertEqual(self.data.v3_users[0]['name'], user['name'])
self.assertEqual(self.alt_email, user['email'])
diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py
index 17712f3..f014307 100644
--- a/tempest/api/identity/admin/v3/test_projects.py
+++ b/tempest/api/identity/admin/v3/test_projects.py
@@ -26,13 +26,13 @@
project_name = data_utils.rand_name('project')
project_desc = data_utils.rand_name('desc')
project = self.client.create_project(
- project_name, description=project_desc)
+ project_name, description=project_desc)['project']
self.data.projects.append(project)
project_id = project['id']
desc1 = project['description']
self.assertEqual(desc1, project_desc, 'Description should have '
'been sent in response for create')
- body = self.client.get_project(project_id)
+ body = self.client.get_project(project_id)['project']
desc2 = body['description']
self.assertEqual(desc2, project_desc, 'Description does not appear'
'to be set')
@@ -43,12 +43,12 @@
self.data.setup_test_domain()
project_name = data_utils.rand_name('project')
project = self.client.create_project(
- project_name, domain_id=self.data.domain['id'])
+ project_name, domain_id=self.data.domain['id'])['project']
self.data.projects.append(project)
project_id = project['id']
self.assertEqual(project_name, project['name'])
self.assertEqual(self.data.domain['id'], project['domain_id'])
- body = self.client.get_project(project_id)
+ body = self.client.get_project(project_id)['project']
self.assertEqual(project_name, body['name'])
self.assertEqual(self.data.domain['id'], body['domain_id'])
@@ -57,12 +57,12 @@
# Create a project that is enabled
project_name = data_utils.rand_name('project')
project = self.client.create_project(
- project_name, enabled=True)
+ project_name, enabled=True)['project']
self.data.projects.append(project)
project_id = project['id']
en1 = project['enabled']
self.assertTrue(en1, 'Enable should be True in response')
- body = self.client.get_project(project_id)
+ body = self.client.get_project(project_id)['project']
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
@@ -71,12 +71,12 @@
# Create a project that is not enabled
project_name = data_utils.rand_name('project')
project = self.client.create_project(
- project_name, enabled=False)
+ project_name, enabled=False)['project']
self.data.projects.append(project)
en1 = project['enabled']
self.assertEqual('false', str(en1).lower(),
'Enable should be False in response')
- body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])['project']
en2 = body['enabled']
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
@@ -85,17 +85,18 @@
def test_project_update_name(self):
# Update name attribute of a project
p_name1 = data_utils.rand_name('project')
- project = self.client.create_project(p_name1)
+ project = self.client.create_project(p_name1)['project']
self.data.projects.append(project)
resp1_name = project['name']
p_name2 = data_utils.rand_name('project2')
- body = self.client.update_project(project['id'], name=p_name2)
+ body = self.client.update_project(project['id'],
+ name=p_name2)['project']
resp2_name = body['name']
self.assertNotEqual(resp1_name, resp2_name)
- body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])['project']
resp3_name = body['name']
self.assertNotEqual(resp1_name, resp3_name)
@@ -108,17 +109,17 @@
p_name = data_utils.rand_name('project')
p_desc = data_utils.rand_name('desc')
project = self.client.create_project(
- p_name, description=p_desc)
+ p_name, description=p_desc)['project']
self.data.projects.append(project)
resp1_desc = project['description']
p_desc2 = data_utils.rand_name('desc2')
body = self.client.update_project(
- project['id'], description=p_desc2)
+ project['id'], description=p_desc2)['project']
resp2_desc = body['description']
self.assertNotEqual(resp1_desc, resp2_desc)
- body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])['project']
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
@@ -130,18 +131,18 @@
# Update the enabled attribute of a project
p_name = data_utils.rand_name('project')
p_en = False
- project = self.client.create_project(p_name, enabled=p_en)
+ project = self.client.create_project(p_name, enabled=p_en)['project']
self.data.projects.append(project)
resp1_en = project['enabled']
p_en2 = True
body = self.client.update_project(
- project['id'], enabled=p_en2)
+ project['id'], enabled=p_en2)['project']
resp2_en = body['enabled']
self.assertNotEqual(resp1_en, resp2_en)
- body = self.client.get_project(project['id'])
+ body = self.client.get_project(project['id'])['project']
resp3_en = body['enabled']
self.assertNotEqual(resp1_en, resp3_en)
@@ -153,7 +154,7 @@
# Associate a user to a project
# Create a Project
p_name = data_utils.rand_name('project')
- project = self.client.create_project(p_name)
+ project = self.client.create_project(p_name)['project']
self.data.projects.append(project)
# Create a User
@@ -163,12 +164,12 @@
u_password = data_utils.rand_name('pass')
user = self.client.create_user(
u_name, description=u_desc, password=u_password,
- email=u_email, project_id=project['id'])
+ email=u_email, project_id=project['id'])['user']
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user['id'])
# Get User To validate the user details
- new_user_get = self.client.get_user(user['id'])
+ new_user_get = self.client.get_user(user['id'])['user']
# Assert response body of GET
self.assertEqual(u_name, new_user_get['name'])
self.assertEqual(u_desc, new_user_get['description'])
diff --git a/tempest/api/identity/admin/v3/test_projects_negative.py b/tempest/api/identity/admin/v3/test_projects_negative.py
index d5ee5a7..9b60d54 100644
--- a/tempest/api/identity/admin/v3/test_projects_negative.py
+++ b/tempest/api/identity/admin/v3/test_projects_negative.py
@@ -34,7 +34,7 @@
def test_project_create_duplicate(self):
# Project names should be unique
project_name = data_utils.rand_name('project-dup')
- project = self.client.create_project(project_name)
+ project = self.client.create_project(project_name)['project']
self.data.projects.append(project)
self.assertRaises(
@@ -69,7 +69,7 @@
def test_project_delete_by_unauthorized_user(self):
# Non-admin user should not be able to delete a project
project_name = data_utils.rand_name('project')
- project = self.client.create_project(project_name)
+ project = self.client.create_project(project_name)['project']
self.data.projects.append(project)
self.assertRaises(
lib_exc.Forbidden, self.non_admin_client.delete_project,
diff --git a/tempest/api/identity/admin/v3/test_regions.py b/tempest/api/identity/admin/v3/test_regions.py
index 7eb92bc..e96e0f5 100644
--- a/tempest/api/identity/admin/v3/test_regions.py
+++ b/tempest/api/identity/admin/v3/test_regions.py
@@ -33,7 +33,7 @@
cls.setup_regions = list()
for i in range(2):
r_description = data_utils.rand_name('description')
- region = cls.client.create_region(r_description)
+ region = cls.client.create_region(r_description)['region']
cls.setup_regions.append(region)
@classmethod
@@ -51,7 +51,8 @@
def test_create_update_get_delete_region(self):
r_description = data_utils.rand_name('description')
region = self.client.create_region(
- r_description, parent_region_id=self.setup_regions[0]['id'])
+ r_description,
+ parent_region_id=self.setup_regions[0]['id'])['region']
self.addCleanup(self._delete_region, region['id'])
self.assertEqual(r_description, region['description'])
self.assertEqual(self.setup_regions[0]['id'],
@@ -61,12 +62,12 @@
region = self.client.update_region(
region['id'],
description=r_alt_description,
- parent_region_id=self.setup_regions[1]['id'])
+ parent_region_id=self.setup_regions[1]['id'])['region']
self.assertEqual(r_alt_description, region['description'])
self.assertEqual(self.setup_regions[1]['id'],
region['parent_region_id'])
# Get the details of region
- region = self.client.get_region(region['id'])
+ region = self.client.get_region(region['id'])['region']
self.assertEqual(r_alt_description, region['description'])
self.assertEqual(self.setup_regions[1]['id'],
region['parent_region_id'])
@@ -78,7 +79,7 @@
r_region_id = data_utils.rand_uuid()
r_description = data_utils.rand_name('description')
region = self.client.create_region(
- r_description, unique_region_id=r_region_id)
+ r_description, unique_region_id=r_region_id)['region']
self.addCleanup(self._delete_region, region['id'])
# Asserting Create Region with specific id response body
self.assertEqual(r_region_id, region['id'])
@@ -87,7 +88,7 @@
@test.idempotent_id('d180bf99-544a-445c-ad0d-0c0d27663796')
def test_list_regions(self):
# Get a list of regions
- fetched_regions = self.client.list_regions()
+ fetched_regions = self.client.list_regions()['regions']
missing_regions =\
[e for e in self.setup_regions if e not in fetched_regions]
# Asserting List Regions response
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index f58a5c5..ffc991a 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -25,7 +25,7 @@
super(RolesV3TestJSON, cls).resource_setup()
for _ in range(3):
role_name = data_utils.rand_name(name='role')
- role = cls.client.create_role(role_name)
+ role = cls.client.create_role(role_name)['role']
cls.data.v3_roles.append(role)
cls.fetched_role_ids = list()
u_name = data_utils.rand_name('user')
@@ -34,20 +34,20 @@
cls.u_password = data_utils.rand_name('pass')
cls.domain = cls.client.create_domain(
data_utils.rand_name('domain'),
- description=data_utils.rand_name('domain-desc'))
+ description=data_utils.rand_name('domain-desc'))['domain']
cls.project = cls.client.create_project(
data_utils.rand_name('project'),
description=data_utils.rand_name('project-desc'),
- domain_id=cls.domain['id'])
+ domain_id=cls.domain['id'])['project']
cls.group_body = cls.client.create_group(
data_utils.rand_name('Group'), project_id=cls.project['id'],
- domain_id=cls.domain['id'])
+ domain_id=cls.domain['id'])['group']
cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=cls.u_password,
email=u_email, project_id=cls.project['id'],
- domain_id=cls.domain['id'])
+ domain_id=cls.domain['id'])['user']
cls.role = cls.client.create_role(
- data_utils.rand_name('Role'))
+ data_utils.rand_name('Role'))['role']
@classmethod
def resource_cleanup(cls):
@@ -69,23 +69,23 @@
@test.idempotent_id('18afc6c0-46cf-4911-824e-9989cc056c3a')
def test_role_create_update_get_list(self):
r_name = data_utils.rand_name('Role')
- role = self.client.create_role(r_name)
+ role = self.client.create_role(r_name)['role']
self.addCleanup(self.client.delete_role, role['id'])
self.assertIn('name', role)
self.assertEqual(role['name'], r_name)
new_name = data_utils.rand_name('NewRole')
- updated_role = self.client.update_role(new_name, role['id'])
+ updated_role = self.client.update_role(new_name, role['id'])['role']
self.assertIn('name', updated_role)
self.assertIn('id', updated_role)
self.assertIn('links', updated_role)
self.assertNotEqual(r_name, updated_role['name'])
- new_role = self.client.get_role(role['id'])
+ new_role = self.client.get_role(role['id'])['role']
self.assertEqual(new_name, new_role['name'])
self.assertEqual(updated_role['id'], new_role['id'])
- roles = self.client.list_roles()
+ roles = self.client.list_roles()['roles']
self.assertIn(role['id'], [r['id'] for r in roles])
@test.idempotent_id('c6b80012-fe4a-498b-9ce8-eb391c05169f')
@@ -94,7 +94,7 @@
self.project['id'], self.user_body['id'], self.role['id'])
roles = self.client.list_user_roles_on_project(
- self.project['id'], self.user_body['id'])
+ self.project['id'], self.user_body['id'])['roles']
for i in roles:
self.fetched_role_ids.append(i['id'])
@@ -111,7 +111,7 @@
self.domain['id'], self.user_body['id'], self.role['id'])
roles = self.client.list_user_roles_on_domain(
- self.domain['id'], self.user_body['id'])
+ self.domain['id'], self.user_body['id'])['roles']
for i in roles:
self.fetched_role_ids.append(i['id'])
@@ -129,7 +129,7 @@
self.project['id'], self.group_body['id'], self.role['id'])
# List group roles on project
roles = self.client.list_group_roles_on_project(
- self.project['id'], self.group_body['id'])
+ self.project['id'], self.group_body['id'])['roles']
for i in roles:
self.fetched_role_ids.append(i['id'])
@@ -158,7 +158,7 @@
self.domain['id'], self.group_body['id'], self.role['id'])
roles = self.client.list_group_roles_on_domain(
- self.domain['id'], self.group_body['id'])
+ self.domain['id'], self.group_body['id'])['roles']
for i in roles:
self.fetched_role_ids.append(i['id'])
@@ -172,6 +172,6 @@
@test.idempotent_id('f5654bcc-08c4-4f71-88fe-05d64e06de94')
def test_list_roles(self):
# Return a list of all roles
- body = self.client.list_roles()
+ body = self.client.list_roles()['roles']
found = [role for role in body if role in self.data.v3_roles]
self.assertEqual(len(found), len(self.data.v3_roles))
diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py
index 95a7dcc..d920f64 100644
--- a/tempest/api/identity/admin/v3/test_services.py
+++ b/tempest/api/identity/admin/v3/test_services.py
@@ -37,7 +37,7 @@
serv_type = data_utils.rand_name('type')
desc = data_utils.rand_name('description')
create_service = self.service_client.create_service(
- serv_type, name=name, description=desc)
+ serv_type, name=name, description=desc)['service']
self.addCleanup(self._del_service, create_service['id'])
self.assertIsNotNone(create_service['id'])
@@ -50,13 +50,13 @@
resp1_desc = create_service['description']
s_desc2 = data_utils.rand_name('desc2')
update_service = self.service_client.update_service(
- s_id, description=s_desc2)
+ s_id, description=s_desc2)['service']
resp2_desc = update_service['description']
self.assertNotEqual(resp1_desc, resp2_desc)
# Get service
- fetched_service = self.service_client.get_service(s_id)
+ fetched_service = self.service_client.get_service(s_id)['service']
resp3_desc = fetched_service['description']
self.assertEqual(resp2_desc, resp3_desc)
@@ -68,7 +68,7 @@
name = data_utils.rand_name('service')
serv_type = data_utils.rand_name('type')
service = self.service_client.create_service(
- serv_type, name=name)
+ serv_type, name=name)['service']
self.addCleanup(self.service_client.delete_service, service['id'])
self.assertIn('id', service)
expected_data = {'name': name, 'type': serv_type}
@@ -82,13 +82,13 @@
name = data_utils.rand_name('service')
serv_type = data_utils.rand_name('type')
create_service = self.service_client.create_service(
- serv_type, name=name)
+ serv_type, name=name)['service']
self.addCleanup(self.service_client.delete_service,
create_service['id'])
service_ids.append(create_service['id'])
# List and Verify Services
- services = self.service_client.list_services()
+ services = self.service_client.list_services()['services']
fetched_ids = [service['id'] for service in services]
found = [s for s in fetched_ids if s in service_ids]
self.assertEqual(len(found), len(service_ids))
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index 951bc78..5681ac6 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -32,14 +32,14 @@
u_password = data_utils.rand_name('pass')
user = self.client.create_user(
u_name, description=u_desc, password=u_password,
- email=u_email)
+ email=u_email)['user']
self.addCleanup(self.client.delete_user, user['id'])
# Perform Authentication
resp = self.token.auth(user_id=user['id'],
password=u_password).response
subject_token = resp['x-subject-token']
# Perform GET Token
- token_details = self.client.get_token(subject_token)
+ token_details = self.client.get_token(subject_token)['token']
self.assertEqual(resp['x-subject-token'], subject_token)
self.assertEqual(token_details['user']['id'], user['id'])
self.assertEqual(token_details['user']['name'], u_name)
@@ -61,21 +61,22 @@
# Create a user.
user_name = data_utils.rand_name(name='user')
user_password = data_utils.rand_name(name='pass')
- user = self.client.create_user(user_name, password=user_password)
+ user = self.client.create_user(user_name,
+ password=user_password)['user']
self.addCleanup(self.client.delete_user, user['id'])
# Create a couple projects
project1_name = data_utils.rand_name(name='project')
- project1 = self.client.create_project(project1_name)
+ project1 = self.client.create_project(project1_name)['project']
self.addCleanup(self.client.delete_project, project1['id'])
project2_name = data_utils.rand_name(name='project')
- project2 = self.client.create_project(project2_name)
+ project2 = self.client.create_project(project2_name)['project']
self.addCleanup(self.client.delete_project, project2['id'])
# Create a role
role_name = data_utils.rand_name(name='role')
- role = self.client.create_role(role_name)
+ role = self.client.create_role(role_name)['role']
self.addCleanup(self.client.delete_role, role['id'])
# Grant the user the role on both projects.
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index 8fe24c7..b8700a6 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -48,7 +48,7 @@
# create a project that trusts will be granted on
self.trustor_project_name = data_utils.rand_name(name='project')
project = self.client.create_project(self.trustor_project_name,
- domain_id='default')
+ domain_id='default')['project']
self.trustor_project_id = project['id']
self.assertIsNotNone(self.trustor_project_id)
@@ -63,17 +63,17 @@
password=self.trustor_password,
email=u_email,
project_id=self.trustor_project_id,
- domain_id='default')
+ domain_id='default')['user']
self.trustor_user_id = user['id']
# And two roles, one we'll delegate and one we won't
self.delegated_role = data_utils.rand_name('DelegatedRole')
self.not_delegated_role = data_utils.rand_name('NotDelegatedRole')
- role = self.client.create_role(self.delegated_role)
+ role = self.client.create_role(self.delegated_role)['role']
self.delegated_role_id = role['id']
- role = self.client.create_role(self.not_delegated_role)
+ role = self.client.create_role(self.not_delegated_role)['role']
self.not_delegated_role_id = role['id']
# Assign roles to trustor
@@ -118,7 +118,7 @@
project_id=self.trustor_project_id,
role_names=[self.delegated_role],
impersonation=impersonate,
- expires_at=expires)
+ expires_at=expires)['trust']
self.trust_id = trust_create['id']
return trust_create
@@ -141,7 +141,7 @@
self.assertEqual(1, len(trust['roles']))
def get_trust(self):
- trust_get = self.trustor_client.get_trust(self.trust_id)
+ trust_get = self.trustor_client.get_trust(self.trust_id)['trust']
return trust_get
def validate_role(self, role):
@@ -157,12 +157,12 @@
def check_trust_roles(self):
# Check we find the delegated role
roles_get = self.trustor_client.get_trust_roles(
- self.trust_id)
+ self.trust_id)['roles']
self.assertEqual(1, len(roles_get))
self.validate_role(roles_get[0])
role_get = self.trustor_client.get_trust_role(
- self.trust_id, self.delegated_role_id)
+ self.trust_id, self.delegated_role_id)['role']
self.validate_role(role_get)
role_get = self.trustor_client.check_trust_role(
@@ -257,7 +257,7 @@
def test_get_trusts_query(self):
self.create_trust()
trusts_get = self.trustor_client.get_trusts(
- trustor_user_id=self.trustor_user_id)
+ trustor_user_id=self.trustor_user_id)['trusts']
self.assertEqual(1, len(trusts_get))
self.validate_trust(trusts_get[0], summary=True)
@@ -265,7 +265,7 @@
@test.idempotent_id('4773ebd5-ecbf-4255-b8d8-b63e6f72b65d')
def test_get_trusts_all(self):
self.create_trust()
- trusts_get = self.client.get_trusts()
+ trusts_get = self.client.get_trusts()['trusts']
trusts = [t for t in trusts_get
if t['id'] == self.trust_id]
self.assertEqual(1, len(trusts))
diff --git a/tempest/api/identity/admin/v3/test_users.py b/tempest/api/identity/admin/v3/test_users.py
index 19cb24e..8fac0b3 100644
--- a/tempest/api/identity/admin/v3/test_users.py
+++ b/tempest/api/identity/admin/v3/test_users.py
@@ -30,13 +30,13 @@
u_password = data_utils.rand_name('pass')
user = self.client.create_user(
u_name, description=u_desc, password=u_password,
- email=u_email, enabled=False)
+ email=u_email, enabled=False)['user']
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user['id'])
# Creating second project for updation
project = self.client.create_project(
data_utils.rand_name('project'),
- description=data_utils.rand_name('project-desc'))
+ description=data_utils.rand_name('project-desc'))['project']
# Delete the Project at the end of this method
self.addCleanup(self.client.delete_project, project['id'])
# Updating user details with new values
@@ -46,7 +46,7 @@
update_user = self.client.update_user(
user['id'], name=u_name2, description=u_description2,
project_id=project['id'],
- email=u_email2, enabled=False)
+ email=u_email2, enabled=False)['user']
self.assertEqual(u_name2, update_user['name'])
self.assertEqual(u_description2, update_user['description'])
self.assertEqual(project['id'],
@@ -54,7 +54,7 @@
self.assertEqual(u_email2, update_user['email'])
self.assertEqual(False, update_user['enabled'])
# GET by id after updation
- new_user_get = self.client.get_user(user['id'])
+ new_user_get = self.client.get_user(user['id'])['user']
# Assert response body of GET after updation
self.assertEqual(u_name2, new_user_get['name'])
self.assertEqual(u_description2, new_user_get['description'])
@@ -69,7 +69,7 @@
u_name = data_utils.rand_name('user')
original_password = data_utils.rand_name('pass')
user = self.client.create_user(
- u_name, password=original_password)
+ u_name, password=original_password)['user']
# Delete the User at the end all test methods
self.addCleanup(self.client.delete_user, user['id'])
# Update user with new password
@@ -80,7 +80,7 @@
password=new_password).response
subject_token = resp['x-subject-token']
# Perform GET Token to verify and confirm password is updated
- token_details = self.client.get_token(subject_token)
+ token_details = self.client.get_token(subject_token)['token']
self.assertEqual(resp['x-subject-token'], subject_token)
self.assertEqual(token_details['user']['id'], user['id'])
self.assertEqual(token_details['user']['name'], u_name)
@@ -92,7 +92,7 @@
fetched_project_ids = list()
u_project = self.client.create_project(
data_utils.rand_name('project'),
- description=data_utils.rand_name('project-desc'))
+ description=data_utils.rand_name('project-desc'))['project']
# Delete the Project at the end of this method
self.addCleanup(self.client.delete_project, u_project['id'])
# Create a user.
@@ -102,23 +102,23 @@
u_password = data_utils.rand_name('pass')
user_body = self.client.create_user(
u_name, description=u_desc, password=u_password,
- email=u_email, enabled=False, project_id=u_project['id'])
+ email=u_email, enabled=False, project_id=u_project['id'])['user']
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user_body['id'])
# Creating Role
role_body = self.client.create_role(
- data_utils.rand_name('role'))
+ data_utils.rand_name('role'))['role']
# Delete the Role at the end of this method
self.addCleanup(self.client.delete_role, role_body['id'])
- user = self.client.get_user(user_body['id'])
- role = self.client.get_role(role_body['id'])
+ user = self.client.get_user(user_body['id'])['user']
+ role = self.client.get_role(role_body['id'])['role']
for i in range(2):
# Creating project so as to assign role
project_body = self.client.create_project(
data_utils.rand_name('project'),
- description=data_utils.rand_name('project-desc'))
- project = self.client.get_project(project_body['id'])
+ description=data_utils.rand_name('project-desc'))['project']
+ project = self.client.get_project(project_body['id'])['project']
# Delete the Project at the end of this method
self.addCleanup(self.client.delete_project, project_body['id'])
# Assigning roles to user on project
@@ -126,7 +126,7 @@
user['id'],
role['id'])
assigned_project_ids.append(project['id'])
- body = self.client.list_user_projects(user['id'])
+ body = self.client.list_user_projects(user['id'])['projects']
for i in body:
fetched_project_ids.append(i['id'])
# verifying the project ids in list
@@ -142,5 +142,5 @@
def test_get_user(self):
# Get a user detail
self.data.setup_test_v3_user()
- user = self.client.get_user(self.data.v3_user['id'])
+ user = self.client.get_user(self.data.v3_user['id'])['user']
self.assertEqual(self.data.v3_user['id'], user['id'])
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 0654f37..7b23e66 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -48,8 +48,12 @@
def get_tenant_by_name(cls, name):
try:
tenants = cls.client.list_tenants()
+ # TODO(jswarren): always retrieve 'tenants' value
+ # once both clients return full response objects
+ if 'tenants' in tenants:
+ tenants = tenants['tenants']
except AttributeError:
- tenants = cls.client.list_projects()
+ tenants = cls.client.list_projects()['projects']
tenant = [t for t in tenants if t['name'] == name]
if len(tenant) > 0:
return tenant[0]
@@ -153,21 +157,21 @@
@classmethod
def get_user_by_name(cls, name):
- users = cls.client.get_users()
+ users = cls.client.get_users()['users']
user = [u for u in users if u['name'] == name]
if len(user) > 0:
return user[0]
@classmethod
def get_tenant_by_name(cls, name):
- tenants = cls.client.list_projects()
+ tenants = cls.client.list_projects()['projects']
tenant = [t for t in tenants if t['name'] == name]
if len(tenant) > 0:
return tenant[0]
@classmethod
def get_role_by_name(cls, name):
- roles = cls.client.list_roles()
+ roles = cls.client.list_roles()['roles']
role = [r for r in roles if r['name'] == name]
if len(role) > 0:
return role[0]
@@ -237,7 +241,7 @@
self.test_user,
password=self.test_password,
project_id=self.project['id'],
- email=self.test_email)
+ email=self.test_email)['user']
self.v3_users.append(self.v3_user)
def setup_test_project(self):
@@ -246,13 +250,13 @@
self.test_description = data_utils.rand_name('desc')
self.project = self.client.create_project(
name=self.test_project,
- description=self.test_description)
+ description=self.test_description)['project']
self.projects.append(self.project)
def setup_test_v3_role(self):
"""Set up a test v3 role."""
self.test_role = data_utils.rand_name('role')
- self.v3_role = self.client.create_role(self.test_role)
+ self.v3_role = self.client.create_role(self.test_role)['role']
self.v3_roles.append(self.v3_role)
def setup_test_domain(self):
@@ -261,7 +265,7 @@
self.test_description = data_utils.rand_name('desc')
self.domain = self.client.create_domain(
name=self.test_domain,
- description=self.test_description)
+ description=self.test_description)['domain']
self.domains.append(self.domain)
@staticmethod
diff --git a/tempest/api/network/test_floating_ips.py b/tempest/api/network/test_floating_ips.py
index f0923d2..4b4a4e2 100644
--- a/tempest/api/network/test_floating_ips.py
+++ b/tempest/api/network/test_floating_ips.py
@@ -25,7 +25,7 @@
class FloatingIPTestJSON(base.BaseNetworkTest):
"""
- Tests the following operations in the Quantum API using the REST client for
+ Tests the following operations in the Neutron API using the REST client for
Neutron:
Create a Floating IP
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 6578680..f2c59f3 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -96,7 +96,7 @@
@classmethod
def _create_keypair(cls, name_start='keypair-heat-'):
kp_name = data_utils.rand_name(name_start)
- body = cls.keypairs_client.create_keypair(name=kp_name)
+ body = cls.keypairs_client.create_keypair(name=kp_name)['keypair']
cls.keypairs.append(kp_name)
return body
diff --git a/tempest/api/volume/admin/test_volume_hosts.py b/tempest/api/volume/admin/test_volume_hosts.py
index dd14d8c..b28488a 100644
--- a/tempest/api/volume/admin/test_volume_hosts.py
+++ b/tempest/api/volume/admin/test_volume_hosts.py
@@ -21,7 +21,7 @@
@test.idempotent_id('d5f3efa2-6684-4190-9ced-1c2f526352ad')
def test_list_hosts(self):
- hosts = self.hosts_client.list_hosts()
+ hosts = self.hosts_client.list_hosts()['hosts']
self.assertTrue(len(hosts) >= 2, "No. of hosts are < 2,"
"response of list hosts is: % s" % hosts)
diff --git a/tempest/api/volume/test_availability_zone.py b/tempest/api/volume/test_availability_zone.py
index f188fa9..366b8d2 100644
--- a/tempest/api/volume/test_availability_zone.py
+++ b/tempest/api/volume/test_availability_zone.py
@@ -31,7 +31,8 @@
@test.idempotent_id('01f1ae88-eba9-4c6b-a011-6f7ace06b725')
def test_get_availability_zone_list(self):
# List of availability zone
- availability_zone = self.client.list_availability_zones()
+ availability_zone = (self.client.list_availability_zones()
+ ['availabilityZoneInfo'])
self.assertTrue(len(availability_zone) > 0)
diff --git a/tempest/api/volume/test_extensions.py b/tempest/api/volume/test_extensions.py
index 17db45f..cce9ace 100644
--- a/tempest/api/volume/test_extensions.py
+++ b/tempest/api/volume/test_extensions.py
@@ -30,7 +30,8 @@
@test.idempotent_id('94607eb0-43a5-47ca-82aa-736b41bd2e2c')
def test_list_extensions(self):
# List of all extensions
- extensions = self.volumes_extension_client.list_extensions()
+ extensions = (self.volumes_extension_client.list_extensions()
+ ['extensions'])
if len(CONF.volume_feature_enabled.api_extensions) == 0:
raise self.skipException('There are not any extensions configured')
extension_list = [extension.get('alias') for extension in extensions]
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 067c0c1..58c5ba9 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -53,7 +53,8 @@
def resource_cleanup(cls):
# Delete the test instance
cls.servers_client.delete_server(cls.server['id'])
- cls.servers_client.wait_for_server_termination(cls.server['id'])
+ waiters.wait_for_server_termination(cls.servers_client,
+ cls.server['id'])
super(VolumesV2ActionsTest, cls).resource_cleanup()
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index 5203444..48f40f0 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -181,8 +181,8 @@
def test_attach_volumes_with_nonexistent_volume_id(self):
srv_name = data_utils.rand_name('Instance')
server = self.create_server(srv_name)
- self.addCleanup(self.servers_client.wait_for_server_termination,
- server['id'])
+ self.addCleanup(waiters.wait_for_server_termination,
+ self.servers_client, server['id'])
self.addCleanup(self.servers_client.delete_server, server['id'])
waiters.wait_for_server_status(self.servers_client, server['id'],
'ACTIVE')
diff --git a/tempest/api/volume/v2/test_volumes_list.py b/tempest/api/volume/v2/test_volumes_list.py
index d1eb694..ddc6822 100644
--- a/tempest/api/volume/v2/test_volumes_list.py
+++ b/tempest/api/volume/v2/test_volumes_list.py
@@ -118,7 +118,7 @@
else:
remaining = None
- # Mark that we are not comming from a next link
+ # Mark that the current iteration is not from a 'next' link
next = None
while True:
@@ -149,8 +149,8 @@
# We no longer expect it
remaining.remove(element_id)
- # If we come from a next link check that absolute url is the same
- # as the one used for this request
+ # If the current iteration is from a 'next' link, check that the
+ # absolute url is the same as the one used for this request
if next:
self.assertEqual(next, response.response['content-location'])
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index 0360146..e05cab3 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -160,7 +160,7 @@
raise exceptions.TempestException(
"Role: %s - doesn't exist" % r
)
- existing = [x['name'] for x in identity_admin.list_tenants()]
+ existing = [x['name'] for x in identity_admin.list_tenants()['tenants']]
for tenant in resources['tenants']:
if tenant not in existing:
identity_admin.create_tenant(tenant)
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 2e96c81..3550842 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -245,7 +245,7 @@
def list(self):
client = self.client
- keypairs = client.list_keypairs()
+ keypairs = client.list_keypairs()['keypairs']
LOG.debug("List count, %s Keypairs" % len(keypairs))
return keypairs
@@ -889,7 +889,7 @@
def list(self):
client = self.client
- tenants = client.list_tenants()
+ tenants = client.list_tenants()['tenants']
if not self.is_save_state:
tenants = [tenant for tenant in tenants if (tenant['id']
not in self.saved_state_json['tenants'].keys()
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index aef42be..71aacbd 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -119,6 +119,7 @@
from tempest_lib import exceptions as lib_exc
import yaml
+from tempest.common import waiters
from tempest import config
from tempest.services.compute.json import flavors_client
from tempest.services.compute.json import floating_ips_client
@@ -273,7 +274,7 @@
Don't create the tenants if they already exist.
"""
admin = keystone_admin()
- body = admin.identity.list_tenants()
+ body = admin.identity.list_tenants()['tenants']
existing = [x['name'] for x in body]
for tenant in tenants:
if tenant not in existing:
@@ -896,8 +897,8 @@
# TODO(EmilienM): disassociate floating IP from server and release it.
client.servers.delete_server(response['id'])
- client.servers.wait_for_server_termination(response['id'],
- ignore_error=True)
+ waiters.wait_for_server_termination(client.servers, response['id'],
+ ignore_error=True)
def create_secgroups(secgroups):
diff --git a/tempest/common/compute.py b/tempest/common/compute.py
index 06e3493..05ea393 100644
--- a/tempest/common/compute.py
+++ b/tempest/common/compute.py
@@ -26,7 +26,7 @@
LOG = logging.getLogger(__name__)
-def create_test_server(clients, validatable, validation_resources=None,
+def create_test_server(clients, validatable=False, validation_resources=None,
tenant_network=None, **kwargs):
"""Common wrapper utility returning a test server.
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index 7888811..6dca3a3 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -45,6 +45,8 @@
def create_user(self, username, password, project, email):
user = self.identity_client.create_user(
username, password, project['id'], email)
+ if 'user' in user:
+ user = user['user']
return user
@abc.abstractmethod
@@ -113,7 +115,7 @@
# Domain names must be unique, in any case a list is returned,
# selecting the first (and only) element
self.creds_domain = self.identity_client.list_domains(
- params={'name': domain_name})[0]
+ params={'name': domain_name})['domains'][0]
except lib_exc.NotFound:
# TODO(andrea) we could probably create the domain on the fly
msg = "Configured domain %s could not be found" % domain_name
@@ -122,7 +124,7 @@
def create_project(self, name, description):
project = self.identity_client.create_project(
name=name, description=description,
- domain_id=self.creds_domain['id'])
+ domain_id=self.creds_domain['id'])['project']
return project
def get_credentials(self, user, project, password):
@@ -136,6 +138,10 @@
def delete_project(self, project_id):
self.identity_client.delete_project(project_id)
+ def _list_roles(self):
+ roles = self.identity_client.list_roles()['roles']
+ return roles
+
def get_creds_client(identity_client, project_domain_name=None):
if isinstance(identity_client, v2_identity.IdentityClient):
@@ -206,6 +212,8 @@
email = data_utils.rand_name(root) + suffix + "@example.com"
user = self.creds_client.create_user(
username, user_password, project, email)
+ if 'user' in user:
+ user = user['user']
role_assigned = False
if admin:
self.creds_client.assign_user_role(user, project,
diff --git a/tempest/common/validation_resources.py b/tempest/common/validation_resources.py
index 14730cf..d018aed 100644
--- a/tempest/common/validation_resources.py
+++ b/tempest/common/validation_resources.py
@@ -48,8 +48,8 @@
if validation_resources:
if validation_resources['keypair']:
keypair_name = data_utils.rand_name('keypair')
- validation_data['keypair'] = \
- os.keypairs_client.create_keypair(name=keypair_name)
+ validation_data.update(os.keypairs_client.create_keypair(
+ name=keypair_name))
LOG.debug("Validation resource key %s created" % keypair_name)
add_rule = False
if validation_resources['security_group']:
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index 8112e9e..7aa4fc2 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -15,6 +15,7 @@
from oslo_log import log as logging
from tempest_lib.common.utils import misc as misc_utils
+from tempest_lib import exceptions as lib_exc
from tempest import config
from tempest import exceptions
@@ -96,6 +97,25 @@
old_task_state = task_state
+def wait_for_server_termination(client, server_id, ignore_error=False):
+ """Waits for server to reach termination."""
+ start_time = int(time.time())
+ while True:
+ try:
+ body = client.show_server(server_id)
+ except lib_exc.NotFound:
+ return
+
+ server_status = body['status']
+ if server_status == 'ERROR' and not ignore_error:
+ raise exceptions.BuildErrorException(server_id=server_id)
+
+ if int(time.time()) - start_time >= client.build_timeout:
+ raise exceptions.TimeoutException
+
+ time.sleep(client.build_interval)
+
+
def wait_for_image_status(client, image_id, status):
"""Waits for an image to reach a given status.
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index e9530a2..766042e 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -96,10 +96,11 @@
def addCleanup_with_wait(self, waiter_callable, thing_id, thing_id_param,
cleanup_callable, cleanup_args=None,
- cleanup_kwargs=None):
+ cleanup_kwargs=None, waiter_client=None):
"""Adds wait for async resource deletion at the end of cleanups
@param waiter_callable: callable to wait for the resource to delete
+ with the following waiter_client if specified.
@param thing_id: the id of the resource to be cleaned-up
@param thing_id_param: the name of the id param in the waiter
@param cleanup_callable: method to load pass to self.addCleanup with
@@ -115,6 +116,8 @@
'waiter_callable': waiter_callable,
thing_id_param: thing_id
}
+ if waiter_client:
+ wait_dict['client'] = waiter_client
self.cleanup_waits.append(wait_dict)
def _wait_for_cleanups(self):
@@ -142,7 +145,7 @@
# We don't need to create a keypair by pubkey in scenario
body = client.create_keypair(name=name)
self.addCleanup(client.delete_keypair, name)
- return body
+ return body['keypair']
def create_server(self, name=None, image=None, flavor=None,
wait_on_boot=True, wait_on_delete=True,
@@ -172,13 +175,15 @@
server = self.servers_client.create_server(name, image, flavor,
**create_kwargs)
if wait_on_delete:
- self.addCleanup(self.servers_client.wait_for_server_termination,
+ self.addCleanup(waiters.wait_for_server_termination,
+ self.servers_client,
server['id'])
self.addCleanup_with_wait(
- waiter_callable=self.servers_client.wait_for_server_termination,
+ waiter_callable=waiters.wait_for_server_termination,
thing_id=server['id'], thing_id_param='server_id',
cleanup_callable=self.delete_wrapper,
- cleanup_args=[self.servers_client.delete_server, server['id']])
+ cleanup_args=[self.servers_client.delete_server, server['id']],
+ waiter_client=self.servers_client)
if wait_on_boot:
waiters.wait_for_server_status(self.servers_client,
server_id=server['id'],
diff --git a/tempest/scenario/test_dashboard_basic_ops.py b/tempest/scenario/test_dashboard_basic_ops.py
index eb018eb..8e91a6d 100644
--- a/tempest/scenario/test_dashboard_basic_ops.py
+++ b/tempest/scenario/test_dashboard_basic_ops.py
@@ -26,6 +26,7 @@
class HorizonHTMLParser(HTMLParser.HTMLParser):
csrf_token = None
region = None
+ login = None
def _find_name(self, attrs, name):
for attrpair in attrs:
@@ -39,12 +40,20 @@
return attrpair[1]
return None
+ def _find_attr_value(self, attrs, attr_name):
+ for attrpair in attrs:
+ if attrpair[0] == attr_name:
+ return attrpair[1]
+ return None
+
def handle_starttag(self, tag, attrs):
if tag == 'input':
if self._find_name(attrs, 'csrfmiddlewaretoken'):
self.csrf_token = self._find_value(attrs)
if self._find_name(attrs, 'region'):
self.region = self._find_value(attrs)
+ if tag == 'form':
+ self.login = self._find_attr_value(attrs, 'action')
class TestDashboardBasicOps(manager.ScenarioTest):
@@ -79,8 +88,12 @@
parser = HorizonHTMLParser()
parser.feed(response)
+ # construct login url for dashboard, discovery accomodates non-/ web
+ # root for dashboard
+ login_url = CONF.dashboard.dashboard_url + parser.login[1:]
+
# Prepare login form request
- req = request.Request(CONF.dashboard.login_url)
+ req = request.Request(login_url)
req.add_header('Content-type', 'application/x-www-form-urlencoded')
req.add_header('Referer', CONF.dashboard.dashboard_url)
params = {'username': username,
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index c44557e..4e6358e 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -109,8 +109,8 @@
for server in self.servers:
# after deleting all servers - wait for all servers to clear
# before cleanup continues
- self.addCleanupClass(self.servers_client.
- wait_for_server_termination,
+ self.addCleanupClass(waiters.wait_for_server_termination,
+ self.servers_client,
server['id'])
for server in self.servers:
self.addCleanupClass(self.servers_client.delete_server,
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 12af667..c194103 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -20,6 +20,7 @@
import testtools
from tempest.common.utils import data_utils
+from tempest.common import waiters
from tempest import config
from tempest import exceptions
from tempest.scenario import manager
@@ -643,7 +644,7 @@
self.assertEqual(self.port_id, port_list[0]['id'])
# Delete the server.
self.servers_client.delete_server(server['id'])
- self.servers_client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.servers_client, server['id'])
# Assert the port still exists on the network but is unbound from
# the deleted server.
port = self.network_client.show_port(self.port_id)['port']
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index f61b151..3019cc4 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -16,6 +16,7 @@
from oslo_log import log as logging
from tempest import config
+from tempest import exceptions
from tempest.scenario import manager
from tempest.scenario import utils as test_utils
from tempest import test
@@ -98,9 +99,24 @@
def verify_metadata(self):
if self.run_ssh and CONF.compute_feature_enabled.metadata_service:
# Verify metadata service
- result = self.ssh_client.exec_command(
- "curl http://169.254.169.254/latest/meta-data/public-ipv4")
- self.assertEqual(self.floating_ip['ip'], result)
+ md_url = 'http://169.254.169.254/latest/meta-data/public-ipv4'
+
+ def exec_cmd_and_verify_output():
+ cmd = 'curl ' + md_url
+ floating_ip = self.floating_ip['ip']
+ result = self.ssh_client.exec_command(cmd)
+ if result:
+ msg = ('Failed while verifying metadata on server. Result '
+ 'of command "%s" is NOT "%s".' % (cmd, floating_ip))
+ self.assertEqual(floating_ip, result, msg)
+ return 'Verification is successful!'
+
+ if not test.call_until_true(exec_cmd_and_verify_output,
+ CONF.compute.build_timeout,
+ CONF.compute.build_interval):
+ raise exceptions.TimeoutException('Timed out while waiting to '
+ 'verify metadata on server. '
+ '%s is empty.' % md_url)
@test.idempotent_id('7fff3fb3-91d8-4fd0-bd7d-0204f1f180ba')
@test.attr(type='smoke')
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 3809831..03f80d5 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -122,7 +122,7 @@
def _delete_server(self, server):
self.servers_client.delete_server(server['id'])
- self.servers_client.wait_for_server_termination(server['id'])
+ waiters.wait_for_server_termination(self.servers_client, server['id'])
def _check_content_of_written_file(self, ssh_client, expected):
actual = self._get_content(ssh_client)
diff --git a/tempest/services/compute/json/keypairs_client.py b/tempest/services/compute/json/keypairs_client.py
index e51671f..2e22bc6 100644
--- a/tempest/services/compute/json/keypairs_client.py
+++ b/tempest/services/compute/json/keypairs_client.py
@@ -24,26 +24,21 @@
def list_keypairs(self):
resp, body = self.get("os-keypairs")
body = json.loads(body)
- # Each returned keypair is embedded within an unnecessary 'keypair'
- # element which is a deviation from other resources like floating-ips,
- # servers, etc. A bug?
- # For now we shall adhere to the spec, but the spec for keypairs
- # is yet to be found
self.validate_response(schema.list_keypairs, resp, body)
- return service_client.ResponseBodyList(resp, body['keypairs'])
+ return service_client.ResponseBody(resp, body)
def show_keypair(self, keypair_name):
resp, body = self.get("os-keypairs/%s" % keypair_name)
body = json.loads(body)
self.validate_response(schema.get_keypair, resp, body)
- return service_client.ResponseBody(resp, body['keypair'])
+ return service_client.ResponseBody(resp, body)
def create_keypair(self, **kwargs):
post_body = json.dumps({'keypair': kwargs})
resp, body = self.post("os-keypairs", body=post_body)
body = json.loads(body)
self.validate_response(schema.create_keypair, resp, body)
- return service_client.ResponseBody(resp, body['keypair'])
+ return service_client.ResponseBody(resp, body)
def delete_keypair(self, keypair_name):
resp, body = self.delete("os-keypairs/%s" % keypair_name)
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index a99a1f5..7022418 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -14,15 +14,11 @@
# License for the specific language governing permissions and limitations
# under the License.
-import time
-
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
-from tempest_lib import exceptions as lib_exc
from tempest.api_schema.response.compute.v2_1 import servers as schema
from tempest.common import service_client
-from tempest import exceptions
class ServersClient(service_client.ServiceClient):
@@ -165,24 +161,6 @@
self.validate_response(_schema, resp, body)
return service_client.ResponseBody(resp, body)
- def wait_for_server_termination(self, server_id, ignore_error=False):
- """Waits for server to reach termination."""
- start_time = int(time.time())
- while True:
- try:
- body = self.show_server(server_id)
- except lib_exc.NotFound:
- return
-
- server_status = body['status']
- if server_status == 'ERROR' and not ignore_error:
- raise exceptions.BuildErrorException(server_id=server_id)
-
- if int(time.time()) - start_time >= self.build_timeout:
- raise exceptions.TimeoutException
-
- time.sleep(self.build_interval)
-
def list_addresses(self, server_id):
"""Lists all addresses for a server."""
resp, body = self.get("servers/%s/ips" % server_id)
@@ -206,15 +184,7 @@
post_body)
if response_key is not None:
body = json.loads(body)
- # Check for Schema as 'None' because if we do not have any server
- # action schema implemented yet then they can pass 'None' to skip
- # the validation.Once all server action has their schema
- # implemented then, this check can be removed if every actions are
- # supposed to validate their response.
- # TODO(GMann): Remove the below 'if' check once all server actions
- # schema are implemented.
- if schema is not None:
- self.validate_response(schema, resp, body)
+ self.validate_response(schema, resp, body)
body = body[response_key]
else:
self.validate_response(schema, resp, body)
diff --git a/tempest/services/data_processing/v1_1/data_processing_client.py b/tempest/services/data_processing/v1_1/data_processing_client.py
index bbc0f2a..cba4c42 100644
--- a/tempest/services/data_processing/v1_1/data_processing_client.py
+++ b/tempest/services/data_processing/v1_1/data_processing_client.py
@@ -39,8 +39,8 @@
self.expected_success(resp_status, resp.status)
return resp, body
- def _request_check_and_parse_resp(self, request_func, uri, resp_status,
- resource_name, *args, **kwargs):
+ def _request_check_and_parse_resp(self, request_func, uri,
+ resp_status, *args, **kwargs):
"""Make a request using specified request_func, check response status
code and parse response body.
@@ -50,36 +50,19 @@
resp, body = request_func(uri, headers=headers, *args, **kwargs)
self.expected_success(resp_status, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body[resource_name])
-
- def _request_check_and_parse_resp_list(self, request_func, uri,
- resp_status, resource_name,
- *args, **kwargs):
- """Make a request using specified request_func, check response status
- code and parse response body.
-
- It returns a ResponseBodyList.
- """
- headers = {'Content-Type': 'application/json'}
- resp, body = request_func(uri, headers=headers, *args, **kwargs)
- self.expected_success(resp_status, resp.status)
- body = json.loads(body)
- return service_client.ResponseBodyList(resp, body[resource_name])
+ return service_client.ResponseBody(resp, body)
def list_node_group_templates(self):
"""List all node group templates for a user."""
uri = 'node-group-templates'
- return self._request_check_and_parse_resp_list(self.get, uri,
- 200,
- 'node_group_templates')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_node_group_template(self, tmpl_id):
"""Returns the details of a single node group template."""
uri = 'node-group-templates/%s' % tmpl_id
- return self._request_check_and_parse_resp(self.get, uri,
- 200, 'node_group_template')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_node_group_template(self, name, plugin_name, hadoop_version,
node_processes, flavor_id,
@@ -100,7 +83,6 @@
'node_configs': node_configs or dict(),
})
return self._request_check_and_parse_resp(self.post, uri, 202,
- 'node_group_template',
body=json.dumps(body))
def delete_node_group_template(self, tmpl_id):
@@ -113,8 +95,7 @@
"""List all enabled plugins."""
uri = 'plugins'
- return self._request_check_and_parse_resp_list(self.get,
- uri, 200, 'plugins')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_plugin(self, plugin_name, plugin_version=None):
"""Returns the details of a single plugin."""
@@ -122,22 +103,19 @@
uri = 'plugins/%s' % plugin_name
if plugin_version:
uri += '/%s' % plugin_version
- return self._request_check_and_parse_resp(self.get, uri, 200, 'plugin')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def list_cluster_templates(self):
"""List all cluster templates for a user."""
uri = 'cluster-templates'
- return self._request_check_and_parse_resp_list(self.get, uri,
- 200,
- 'cluster_templates')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_cluster_template(self, tmpl_id):
"""Returns the details of a single cluster template."""
uri = 'cluster-templates/%s' % tmpl_id
- return self._request_check_and_parse_resp(self.get,
- uri, 200, 'cluster_template')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_cluster_template(self, name, plugin_name, hadoop_version,
node_groups, cluster_configs=None,
@@ -157,7 +135,6 @@
'cluster_configs': cluster_configs or dict(),
})
return self._request_check_and_parse_resp(self.post, uri, 202,
- 'cluster_template',
body=json.dumps(body))
def delete_cluster_template(self, tmpl_id):
@@ -170,16 +147,13 @@
"""List all data sources for a user."""
uri = 'data-sources'
- return self._request_check_and_parse_resp_list(self.get,
- uri, 200,
- 'data_sources')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_data_source(self, source_id):
"""Returns the details of a single data source."""
uri = 'data-sources/%s' % source_id
- return self._request_check_and_parse_resp(self.get,
- uri, 200, 'data_source')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_data_source(self, name, data_source_type, url, **kwargs):
"""Creates data source with specified params.
@@ -195,8 +169,7 @@
'url': url
})
return self._request_check_and_parse_resp(self.post, uri,
- 202, 'data_source',
- body=json.dumps(body))
+ 202, body=json.dumps(body))
def delete_data_source(self, source_id):
"""Deletes the specified data source by id."""
@@ -208,22 +181,19 @@
"""List all job binary internals for a user."""
uri = 'job-binary-internals'
- return self._request_check_and_parse_resp_list(self.get,
- uri, 200, 'binaries')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_job_binary_internal(self, job_binary_id):
"""Returns the details of a single job binary internal."""
uri = 'job-binary-internals/%s' % job_binary_id
- return self._request_check_and_parse_resp(self.get, uri,
- 200, 'job_binary_internal')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_job_binary_internal(self, name, data):
"""Creates job binary internal with specified params."""
uri = 'job-binary-internals/%s' % name
- return self._request_check_and_parse_resp(self.put, uri, 202,
- 'job_binary_internal', data)
+ return self._request_check_and_parse_resp(self.put, uri, 202, data)
def delete_job_binary_internal(self, job_binary_id):
"""Deletes the specified job binary internal by id."""
@@ -241,15 +211,13 @@
"""List all job binaries for a user."""
uri = 'job-binaries'
- return self._request_check_and_parse_resp_list(self.get,
- uri, 200, 'binaries')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_job_binary(self, job_binary_id):
"""Returns the details of a single job binary."""
uri = 'job-binaries/%s' % job_binary_id
- return self._request_check_and_parse_resp(self.get,
- uri, 200, 'job_binary')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_job_binary(self, name, url, extra=None, **kwargs):
"""Creates job binary with specified params.
@@ -265,8 +233,7 @@
'extra': extra or dict(),
})
return self._request_check_and_parse_resp(self.post, uri,
- 202, 'job_binary',
- body=json.dumps(body))
+ 202, body=json.dumps(body))
def delete_job_binary(self, job_binary_id):
"""Deletes the specified job binary by id."""
@@ -284,14 +251,13 @@
"""List all jobs for a user."""
uri = 'jobs'
- return self._request_check_and_parse_resp_list(self.get,
- uri, 200, 'jobs')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def get_job(self, job_id):
"""Returns the details of a single job."""
uri = 'jobs/%s' % job_id
- return self._request_check_and_parse_resp(self.get, uri, 200, 'job')
+ return self._request_check_and_parse_resp(self.get, uri, 200)
def create_job(self, name, job_type, mains, libs=None, **kwargs):
"""Creates job with specified params.
@@ -307,8 +273,8 @@
'mains': mains,
'libs': libs or list(),
})
- return self._request_check_and_parse_resp(self.post, uri, 202,
- 'job', body=json.dumps(body))
+ return self._request_check_and_parse_resp(self.post, uri,
+ 202, body=json.dumps(body))
def delete_job(self, job_id):
"""Deletes the specified job by id."""
diff --git a/tempest/services/identity/v2/json/identity_client.py b/tempest/services/identity/v2/json/identity_client.py
index c9345e0..e6416d6 100644
--- a/tempest/services/identity/v2/json/identity_client.py
+++ b/tempest/services/identity/v2/json/identity_client.py
@@ -56,7 +56,7 @@
resp, body = self.get('OS-KSADM/roles/%s' % role_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body)
def create_tenant(self, name, **kwargs):
"""
@@ -125,10 +125,10 @@
resp, body = self.get('tenants')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['tenants'])
+ return service_client.ResponseBody(resp, body)
def get_tenant_by_name(self, tenant_name):
- tenants = self.list_tenants()
+ tenants = self.list_tenants()['tenants']
for tenant in tenants:
if tenant['name'] == tenant_name:
return tenant
diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py
index e27f960..decf3a8 100644
--- a/tempest/services/identity/v3/json/credentials_client.py
+++ b/tempest/services/identity/v3/json/credentials_client.py
@@ -36,11 +36,11 @@
self.expected_success(201, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return service_client.ResponseBody(resp, body['credential'])
+ return service_client.ResponseBody(resp, body)
def update_credential(self, credential_id, **kwargs):
"""Updates a credential."""
- body = self.get_credential(credential_id)
+ body = self.get_credential(credential_id)['credential']
cred_type = kwargs.get('type', body['type'])
access_key = kwargs.get('access_key', body['blob']['access'])
secret_key = kwargs.get('secret_key', body['blob']['secret'])
@@ -59,7 +59,7 @@
self.expected_success(200, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return service_client.ResponseBody(resp, body['credential'])
+ return service_client.ResponseBody(resp, body)
def get_credential(self, credential_id):
"""To GET Details of a credential."""
@@ -67,14 +67,14 @@
self.expected_success(200, resp.status)
body = json.loads(body)
body['credential']['blob'] = json.loads(body['credential']['blob'])
- return service_client.ResponseBody(resp, body['credential'])
+ return service_client.ResponseBody(resp, body)
def list_credentials(self):
"""Lists out all the available credentials."""
resp, body = self.get('credentials')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['credentials'])
+ return service_client.ResponseBody(resp, body)
def delete_credential(self, credential_id):
"""Deletes a credential."""
diff --git a/tempest/services/identity/v3/json/endpoints_client.py b/tempest/services/identity/v3/json/endpoints_client.py
index f93fb74..6bdf8b3 100644
--- a/tempest/services/identity/v3/json/endpoints_client.py
+++ b/tempest/services/identity/v3/json/endpoints_client.py
@@ -26,7 +26,7 @@
resp, body = self.get('endpoints')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['endpoints'])
+ return service_client.ResponseBody(resp, body)
def create_endpoint(self, service_id, interface, url, **kwargs):
"""Create endpoint.
@@ -51,7 +51,7 @@
resp, body = self.post('endpoints', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['endpoint'])
+ return service_client.ResponseBody(resp, body)
def update_endpoint(self, endpoint_id, service_id=None, interface=None,
url=None, region=None, enabled=None, **kwargs):
@@ -78,7 +78,7 @@
resp, body = self.patch('endpoints/%s' % endpoint_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['endpoint'])
+ return service_client.ResponseBody(resp, body)
def delete_endpoint(self, endpoint_id):
"""Delete endpoint."""
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 87d4b79..9a60a24 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -49,11 +49,11 @@
resp, body = self.post('users', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['user'])
+ return service_client.ResponseBody(resp, body)
def update_user(self, user_id, name, **kwargs):
"""Updates a user."""
- body = self.get_user(user_id)
+ body = self.get_user(user_id)['user']
email = kwargs.get('email', body['email'])
en = kwargs.get('enabled', body['enabled'])
project_id = kwargs.get('project_id', body['project_id'])
@@ -78,7 +78,7 @@
resp, body = self.patch('users/%s' % user_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['user'])
+ return service_client.ResponseBody(resp, body)
def update_user_password(self, user_id, password, original_password):
"""Updates a user password."""
@@ -96,7 +96,7 @@
resp, body = self.get('users/%s/projects' % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['projects'])
+ return service_client.ResponseBody(resp, body)
def get_users(self, params=None):
"""Get the list of users."""
@@ -106,14 +106,14 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['users'])
+ return service_client.ResponseBody(resp, body)
def get_user(self, user_id):
"""GET a user."""
resp, body = self.get("users/%s" % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['user'])
+ return service_client.ResponseBody(resp, body)
def delete_user(self, user_id):
"""Deletes a User."""
@@ -136,7 +136,7 @@
resp, body = self.post('projects', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['project'])
+ return service_client.ResponseBody(resp, body)
def list_projects(self, params=None):
url = "projects"
@@ -145,10 +145,10 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['projects'])
+ return service_client.ResponseBody(resp, body)
def update_project(self, project_id, **kwargs):
- body = self.get_project(project_id)
+ body = self.get_project(project_id)['project']
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
@@ -164,14 +164,14 @@
resp, body = self.patch('projects/%s' % project_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['project'])
+ return service_client.ResponseBody(resp, body)
def get_project(self, project_id):
"""GET a Project."""
resp, body = self.get("projects/%s" % project_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['project'])
+ return service_client.ResponseBody(resp, body)
def delete_project(self, project_id):
"""Delete a project."""
@@ -188,21 +188,21 @@
resp, body = self.post('roles', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body)
def get_role(self, role_id):
"""GET a Role."""
resp, body = self.get('roles/%s' % str(role_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body)
def list_roles(self):
"""Get the list of Roles."""
resp, body = self.get("roles")
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def update_role(self, name, role_id):
"""Create a Role."""
@@ -213,7 +213,7 @@
resp, body = self.patch('roles/%s' % str(role_id), post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body)
def delete_role(self, role_id):
"""Delete a role."""
@@ -241,7 +241,7 @@
resp, body = self.post('domains', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['domain'])
+ return service_client.ResponseBody(resp, body)
def delete_domain(self, domain_id):
"""Delete a domain."""
@@ -257,11 +257,11 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['domains'])
+ return service_client.ResponseBody(resp, body)
def update_domain(self, domain_id, **kwargs):
"""Updates a domain."""
- body = self.get_domain(domain_id)
+ body = self.get_domain(domain_id)['domain']
description = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
name = kwargs.get('name', body['name'])
@@ -274,14 +274,14 @@
resp, body = self.patch('domains/%s' % domain_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['domain'])
+ return service_client.ResponseBody(resp, body)
def get_domain(self, domain_id):
"""Get Domain details."""
resp, body = self.get('domains/%s' % domain_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['domain'])
+ return service_client.ResponseBody(resp, body)
def get_token(self, resp_token):
"""Get token details."""
@@ -289,7 +289,7 @@
resp, body = self.get("auth/tokens", headers=headers)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['token'])
+ return service_client.ResponseBody(resp, body)
def delete_token(self, resp_token):
"""Deletes token."""
@@ -313,25 +313,25 @@
resp, body = self.post('groups', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['group'])
+ return service_client.ResponseBody(resp, body)
def get_group(self, group_id):
"""Get group details."""
resp, body = self.get('groups/%s' % group_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['group'])
+ return service_client.ResponseBody(resp, body)
def list_groups(self):
"""Lists the groups."""
resp, body = self.get('groups')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['groups'])
+ return service_client.ResponseBody(resp, body)
def update_group(self, group_id, **kwargs):
"""Updates a group."""
- body = self.get_group(group_id)
+ body = self.get_group(group_id)['group']
name = kwargs.get('name', body['name'])
description = kwargs.get('description', body['description'])
post_body = {
@@ -342,7 +342,7 @@
resp, body = self.patch('groups/%s' % group_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['group'])
+ return service_client.ResponseBody(resp, body)
def delete_group(self, group_id):
"""Delete a group."""
@@ -362,14 +362,14 @@
resp, body = self.get('groups/%s/users' % group_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['users'])
+ return service_client.ResponseBody(resp, body)
def list_user_groups(self, user_id):
"""Lists groups which a user belongs to."""
resp, body = self.get('users/%s/groups' % user_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['groups'])
+ return service_client.ResponseBody(resp, body)
def delete_group_user(self, group_id, user_id):
"""Delete user in group."""
@@ -397,7 +397,7 @@
(project_id, user_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def list_user_roles_on_domain(self, domain_id, user_id):
"""list roles of a user on a domain."""
@@ -405,7 +405,7 @@
(domain_id, user_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def revoke_role_from_user_on_project(self, project_id, user_id, role_id):
"""Delete role of a user on a project."""
@@ -441,7 +441,7 @@
(project_id, group_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def list_group_roles_on_domain(self, domain_id, group_id):
"""list roles of a user on a domain."""
@@ -449,7 +449,7 @@
(domain_id, group_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def revoke_role_from_group_on_project(self, project_id, group_id, role_id):
"""Delete role of a user on a project."""
@@ -481,7 +481,7 @@
resp, body = self.post('OS-TRUST/trusts', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['trust'])
+ return service_client.ResponseBody(resp, body)
def delete_trust(self, trust_id):
"""Deletes a trust."""
@@ -501,21 +501,21 @@
resp, body = self.get("OS-TRUST/trusts")
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['trusts'])
+ return service_client.ResponseBody(resp, body)
def get_trust(self, trust_id):
"""GET trust."""
resp, body = self.get("OS-TRUST/trusts/%s" % trust_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['trust'])
+ return service_client.ResponseBody(resp, body)
def get_trust_roles(self, trust_id):
"""GET roles delegated by a trust."""
resp, body = self.get("OS-TRUST/trusts/%s/roles" % trust_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['roles'])
+ return service_client.ResponseBody(resp, body)
def get_trust_role(self, trust_id, role_id):
"""GET role delegated by a trust."""
@@ -523,7 +523,7 @@
% (trust_id, role_id))
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['role'])
+ return service_client.ResponseBody(resp, body)
def check_trust_role(self, trust_id, role_id):
"""HEAD Check if role is delegated by a trust."""
diff --git a/tempest/services/identity/v3/json/region_client.py b/tempest/services/identity/v3/json/region_client.py
index 43226be..24c6f33 100644
--- a/tempest/services/identity/v3/json/region_client.py
+++ b/tempest/services/identity/v3/json/region_client.py
@@ -37,7 +37,7 @@
resp, body = self.post('regions', req_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['region'])
+ return service_client.ResponseBody(resp, body)
def update_region(self, region_id, **kwargs):
"""Updates a region."""
@@ -50,7 +50,7 @@
resp, body = self.patch('regions/%s' % region_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['region'])
+ return service_client.ResponseBody(resp, body)
def get_region(self, region_id):
"""Get region."""
@@ -58,7 +58,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['region'])
+ return service_client.ResponseBody(resp, body)
def list_regions(self, params=None):
"""List regions."""
@@ -68,7 +68,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['regions'])
+ return service_client.ResponseBody(resp, body)
def delete_region(self, region_id):
"""Delete region."""
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py
index 52ff479..2acc3a8 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/service_client.py
@@ -23,7 +23,7 @@
def update_service(self, service_id, **kwargs):
"""Updates a service."""
- body = self.get_service(service_id)
+ body = self.get_service(service_id)['service']
name = kwargs.get('name', body['name'])
type = kwargs.get('type', body['type'])
desc = kwargs.get('description', body['description'])
@@ -36,7 +36,7 @@
resp, body = self.patch('services/%s' % service_id, patch_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['service'])
+ return service_client.ResponseBody(resp, body)
def get_service(self, service_id):
"""Get Service."""
@@ -44,7 +44,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['service'])
+ return service_client.ResponseBody(resp, body)
def create_service(self, serv_type, name=None, description=None,
enabled=True):
@@ -58,7 +58,7 @@
resp, body = self.post("services", body)
self.expected_success(201, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body["service"])
+ return service_client.ResponseBody(resp, body)
def delete_service(self, serv_id):
url = "services/" + serv_id
@@ -70,4 +70,4 @@
resp, body = self.get('services')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['services'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/volume/json/admin/volume_hosts_client.py b/tempest/services/volume/json/admin/volume_hosts_client.py
index 6801453..ab9cd5a 100644
--- a/tempest/services/volume/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/json/admin/volume_hosts_client.py
@@ -34,7 +34,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['hosts'])
+ return service_client.ResponseBody(resp, body)
class VolumeHostsClient(BaseVolumeHostsClient):
diff --git a/tempest/services/volume/json/availability_zone_client.py b/tempest/services/volume/json/availability_zone_client.py
index 13d5d55..4d24ede 100644
--- a/tempest/services/volume/json/availability_zone_client.py
+++ b/tempest/services/volume/json/availability_zone_client.py
@@ -24,7 +24,7 @@
resp, body = self.get('os-availability-zone')
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['availabilityZoneInfo'])
+ return service_client.ResponseBody(resp, body)
class VolumeAvailabilityZoneClient(BaseVolumeAvailabilityZoneClient):
diff --git a/tempest/services/volume/json/extensions_client.py b/tempest/services/volume/json/extensions_client.py
index 1098e1e..5744d4a 100644
--- a/tempest/services/volume/json/extensions_client.py
+++ b/tempest/services/volume/json/extensions_client.py
@@ -25,7 +25,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['extensions'])
+ return service_client.ResponseBody(resp, body)
class ExtensionsClient(BaseExtensionsClient):
diff --git a/tempest/stress/actions/server_create_destroy.py b/tempest/stress/actions/server_create_destroy.py
index 9f41526..17f4bc9 100644
--- a/tempest/stress/actions/server_create_destroy.py
+++ b/tempest/stress/actions/server_create_destroy.py
@@ -37,5 +37,6 @@
self.logger.info("created %s" % server_id)
self.logger.info("deleting %s" % name)
self.manager.servers_client.delete_server(server_id)
- self.manager.servers_client.wait_for_server_termination(server_id)
+ waiters.wait_for_server_termination(self.manager.servers_client,
+ server_id)
self.logger.info("deleted %s" % server_id)
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index 09e6d88..2a7a85c 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -86,7 +86,8 @@
def _destroy_vm(self):
self.logger.info("deleting %s" % self.server_id)
self.manager.servers_client.delete_server(self.server_id)
- self.manager.servers_client.wait_for_server_termination(self.server_id)
+ waiters.wait_for_server_termination(self.manager.servers_client,
+ self.server_id)
self.logger.info("deleted %s" % self.server_id)
def _create_sec_group(self):
diff --git a/tempest/stress/actions/volume_attach_delete.py b/tempest/stress/actions/volume_attach_delete.py
index 99e9eb6..68e2989 100644
--- a/tempest/stress/actions/volume_attach_delete.py
+++ b/tempest/stress/actions/volume_attach_delete.py
@@ -59,7 +59,8 @@
# Step 4: delete vm
self.logger.info("deleting vm: %s" % vm_name)
self.manager.servers_client.delete_server(server_id)
- self.manager.servers_client.wait_for_server_termination(server_id)
+ waiters.wait_for_server_termination(self.manager.servers_client,
+ server_id)
self.logger.info("deleted vm: %s" % server_id)
# Step 5: delete volume
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index e30ca0c..038569a 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -26,7 +26,8 @@
def _create_keypair(self):
keyname = data_utils.rand_name("key")
- self.key = self.manager.keypairs_client.create_keypair(name=keyname)
+ self.key = (self.manager.keypairs_client.create_keypair(name=keyname)
+ ['keypair'])
def _delete_keypair(self):
self.manager.keypairs_client.delete_keypair(self.key['name'])
@@ -48,7 +49,8 @@
def _destroy_vm(self):
self.logger.info("deleting server: %s" % self.server_id)
self.manager.servers_client.delete_server(self.server_id)
- self.manager.servers_client.wait_for_server_termination(self.server_id)
+ waiters.wait_for_server_termination(self.manager.servers_client,
+ self.server_id)
self.logger.info("deleted server: %s" % self.server_id)
def _create_sec_group(self):
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index b785156..c60f45a 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -17,6 +17,7 @@
from oslo_log import log as logging
from tempest import clients
+from tempest.common import waiters
LOG = logging.getLogger(__name__)
@@ -34,11 +35,12 @@
for s in body['servers']:
try:
- admin_manager.servers_client.wait_for_server_termination(s['id'])
+ waiters.wait_for_server_termination(admin_manager.servers_client,
+ s['id'])
except Exception:
pass
- keypairs = admin_manager.keypairs_client.list_keypairs()
+ keypairs = admin_manager.keypairs_client.list_keypairs()['keypairs']
LOG.info("Cleanup::remove %s keypairs" % len(keypairs))
for k in keypairs:
try:
@@ -70,7 +72,7 @@
if user['name'].startswith("stress_user"):
admin_manager.identity_client.delete_user(user['id'])
- tenants = admin_manager.identity_client.list_tenants()
+ tenants = admin_manager.identity_client.list_tenants()['tenants']
LOG.info("Cleanup::remove %s tenants" % len(tenants))
for tenant in tenants:
if tenant['name'].startswith("stress_tenant"):
diff --git a/tempest/tests/cmd/test_javelin.py b/tempest/tests/cmd/test_javelin.py
index 3a3e46e..d1dee54 100644
--- a/tempest/tests/cmd/test_javelin.py
+++ b/tempest/tests/cmd/test_javelin.py
@@ -85,7 +85,7 @@
class TestCreateResources(JavelinUnitTest):
def test_create_tenants(self):
- self.fake_client.identity.list_tenants.return_value = []
+ self.fake_client.identity.list_tenants.return_value = {'tenants': []}
self.useFixture(mockpatch.PatchObject(javelin, "keystone_admin",
return_value=self.fake_client))
@@ -95,8 +95,8 @@
mocked_function.assert_called_once_with(self.fake_object['name'])
def test_create_duplicate_tenant(self):
- self.fake_client.identity.list_tenants.return_value = [
- {'name': self.fake_object['name']}]
+ self.fake_client.identity.list_tenants.return_value = {'tenants': [
+ {'name': self.fake_object['name']}]}
self.useFixture(mockpatch.PatchObject(javelin, "keystone_admin",
return_value=self.fake_client))
diff --git a/tempest/tests/services/compute/test_keypairs_client.py b/tempest/tests/services/compute/test_keypairs_client.py
index a0022b4..8a0edd0 100644
--- a/tempest/tests/services/compute/test_keypairs_client.py
+++ b/tempest/tests/services/compute/test_keypairs_client.py
@@ -25,12 +25,12 @@
class TestKeyPairsClient(base.TestCase):
- FAKE_KEYPAIR = {
+ FAKE_KEYPAIR = {"keypair": {
"public_key": "ssh-rsa foo Generated-by-Nova",
"name": u'\u2740(*\xb4\u25e1`*)\u2740',
"user_id": "525d55f98980415ba98e634972fa4a10",
"fingerprint": "76:24:66:49:d7:ca:6e:5c:77:ea:8e:bb:9c:15:5f:98"
- }
+ }}
def setUp(self):
super(TestKeyPairsClient, self).setUp()
@@ -42,7 +42,7 @@
body = '{"keypairs": []}'
if bytes_body:
body = body.encode('utf-8')
- expected = []
+ expected = {"keypairs": []}
response = (httplib2.Response({'status': 200}), body)
self.useFixture(mockpatch.Patch(
'tempest.common.service_client.ServiceClient.get',
@@ -57,14 +57,14 @@
def _test_show_keypair(self, bytes_body=False):
fake_keypair = copy.deepcopy(self.FAKE_KEYPAIR)
- fake_keypair.update({
+ fake_keypair["keypair"].update({
"deleted": False,
"created_at": "2015-07-22T04:53:52.000000",
"updated_at": None,
"deleted_at": None,
"id": 1
})
- serialized_body = json.dumps({"keypair": fake_keypair})
+ serialized_body = json.dumps(fake_keypair)
if bytes_body:
serialized_body = serialized_body.encode('utf-8')
@@ -83,8 +83,8 @@
def _test_create_keypair(self, bytes_body=False):
fake_keypair = copy.deepcopy(self.FAKE_KEYPAIR)
- fake_keypair.update({"private_key": "foo"})
- serialized_body = json.dumps({"keypair": fake_keypair})
+ fake_keypair["keypair"].update({"private_key": "foo"})
+ serialized_body = json.dumps(fake_keypair)
if bytes_body:
serialized_body = serialized_body.encode('utf-8')