Merge "Fix misspelling in the "README.rst""
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 3e6013d..3c109b5 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -24,7 +24,7 @@
Tempest currently has 2 different ways in configuration to provide credentials
to use when running tempest. One is a traditional set of configuration options
in the tempest.conf file. These options are in the identity section and let you
-specify a regular user, a global admin user, and a alternate user set of
+specify a regular user, a global admin user, and an alternate user set of
credentials. (which consist of a username, password, and project/tenant name)
These options should be clearly labelled in the sample config file in the
identity section.
@@ -187,7 +187,7 @@
#. image_ref_alt
Both options are expecting an image id (not name) from nova. The *image_ref*
-option is what what will be used for booting the majority of servers in tempest.
+option is what will be used for booting the majority of servers in tempest.
*image_ref_alt* is used for tests that require 2 images such as rebuild. If 2
images are not available you can set both options to the same image_ref and
those tests will be skipped.
diff --git a/tempest/api/compute/admin/test_agents.py b/tempest/api/compute/admin/test_agents.py
index d9a1ee5..38f5fb7 100644
--- a/tempest/api/compute/admin/test_agents.py
+++ b/tempest/api/compute/admin/test_agents.py
@@ -38,7 +38,7 @@
hypervisor='common', os='linux', architecture='x86_64',
version='7.0', url='xxx://xxxx/xxx/xxx',
md5hash='add6bb58e139be103324d04d82d8f545')
- body = self.client.create_agent(**params)
+ body = self.client.create_agent(**params)['agent']
self.agent_id = body['agent_id']
def tearDown(self):
@@ -67,7 +67,7 @@
hypervisor='kvm', os='win', architecture='x86',
version='7.0', url='xxx://xxxx/xxx/xxx',
md5hash='add6bb58e139be103324d04d82d8f545')
- body = self.client.create_agent(**params)
+ body = self.client.create_agent(**params)['agent']
self.addCleanup(self.client.delete_agent, body['agent_id'])
for expected_item, value in params.items():
self.assertEqual(value, body[expected_item])
@@ -78,7 +78,7 @@
params = self._param_helper(
version='8.0', url='xxx://xxxx/xxx/xxx2',
md5hash='add6bb58e139be103324d04d82d8f547')
- body = self.client.update_agent(self.agent_id, **params)
+ body = self.client.update_agent(self.agent_id, **params)['agent']
for expected_item, value in params.items():
self.assertEqual(value, body[expected_item])
@@ -88,13 +88,13 @@
self.client.delete_agent(self.agent_id)
# Verify the list doesn't contain the deleted agent.
- agents = self.client.list_agents()
+ agents = self.client.list_agents()['agents']
self.assertNotIn(self.agent_id, map(lambda x: x['agent_id'], agents))
@test.idempotent_id('6a326c69-654b-438a-80a3-34bcc454e138')
def test_list_agents(self):
# List all agents.
- agents = self.client.list_agents()
+ agents = self.client.list_agents()['agents']
self.assertTrue(len(agents) > 0, 'Cannot get any agents.(%s)' % agents)
self.assertIn(self.agent_id, map(lambda x: x['agent_id'], agents))
@@ -105,11 +105,12 @@
hypervisor='xen', os='linux', architecture='x86',
version='7.0', url='xxx://xxxx/xxx/xxx1',
md5hash='add6bb58e139be103324d04d82d8f546')
- agent_xen = self.client.create_agent(**params)
+ agent_xen = self.client.create_agent(**params)['agent']
self.addCleanup(self.client.delete_agent, agent_xen['agent_id'])
agent_id_xen = agent_xen['agent_id']
- agents = self.client.list_agents(hypervisor=agent_xen['hypervisor'])
+ agents = (self.client.list_agents(hypervisor=agent_xen['hypervisor'])
+ ['agents'])
self.assertTrue(len(agents) > 0, 'Cannot get any agents.(%s)' % agents)
self.assertIn(agent_id_xen, map(lambda x: x['agent_id'], agents))
self.assertNotIn(self.agent_id, map(lambda x: x['agent_id'], agents))
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index 9334fb6..e42131d 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -40,7 +40,7 @@
cls.aggregate_name_prefix = 'test_aggregate'
cls.az_name_prefix = 'test_az'
- hosts_all = cls.os_adm.hosts_client.list_hosts()
+ hosts_all = cls.os_adm.hosts_client.list_hosts()['hosts']
hosts = map(lambda x: x['host_name'],
filter(lambda y: y['service'] == 'compute', hosts_all))
cls.host = hosts[0]
diff --git a/tempest/api/compute/admin/test_aggregates_negative.py b/tempest/api/compute/admin/test_aggregates_negative.py
index 231c88f..02e0af0 100644
--- a/tempest/api/compute/admin/test_aggregates_negative.py
+++ b/tempest/api/compute/admin/test_aggregates_negative.py
@@ -39,7 +39,7 @@
cls.aggregate_name_prefix = 'test_aggregate'
cls.az_name_prefix = 'test_az'
- hosts_all = cls.os_adm.hosts_client.list_hosts()
+ hosts_all = cls.os_adm.hosts_client.list_hosts()['hosts']
hosts = map(lambda x: x['host_name'],
filter(lambda y: y['service'] == 'compute', hosts_all))
cls.host = hosts[0]
@@ -131,7 +131,7 @@
@test.idempotent_id('0ef07828-12b4-45ba-87cc-41425faf5711')
def test_aggregate_add_non_exist_host(self):
# Adding a non-exist host to an aggregate should raise exceptions.
- hosts_all = self.os_adm.hosts_client.list_hosts()
+ hosts_all = self.os_adm.hosts_client.list_hosts()['hosts']
hosts = map(lambda x: x['host_name'], hosts_all)
while True:
non_exist_host = data_utils.rand_name('nonexist_host')
diff --git a/tempest/api/compute/admin/test_availability_zone.py b/tempest/api/compute/admin/test_availability_zone.py
index 22eae03..1b36ff2 100644
--- a/tempest/api/compute/admin/test_availability_zone.py
+++ b/tempest/api/compute/admin/test_availability_zone.py
@@ -32,10 +32,10 @@
def test_get_availability_zone_list(self):
# List of availability zone
availability_zone = self.client.list_availability_zones()
- self.assertTrue(len(availability_zone) > 0)
+ self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
@test.idempotent_id('ef726c58-530f-44c2-968c-c7bed22d5b8c')
def test_get_availability_zone_list_detail(self):
# List of availability zones and available services
availability_zone = self.client.list_availability_zones(detail=True)
- self.assertTrue(len(availability_zone) > 0)
+ self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
diff --git a/tempest/api/compute/admin/test_baremetal_nodes.py b/tempest/api/compute/admin/test_baremetal_nodes.py
index 4d95f0a..2599d86 100644
--- a/tempest/api/compute/admin/test_baremetal_nodes.py
+++ b/tempest/api/compute/admin/test_baremetal_nodes.py
@@ -46,11 +46,11 @@
# List all baremetal nodes and ensure our created test nodes are
# listed
bm_node_ids = set([n['id'] for n in
- self.client.list_baremetal_nodes()])
+ self.client.list_baremetal_nodes()['nodes']])
test_node_ids = set([n['uuid'] for n in test_nodes])
self.assertTrue(test_node_ids.issubset(bm_node_ids))
# Test getting each individually
for node in test_nodes:
baremetal_node = self.client.show_baremetal_node(node['uuid'])
- self.assertEqual(node['uuid'], baremetal_node['id'])
+ self.assertEqual(node['uuid'], baremetal_node['node']['id'])
diff --git a/tempest/api/compute/admin/test_fixed_ips.py b/tempest/api/compute/admin/test_fixed_ips.py
index 3e20b46..669585c 100644
--- a/tempest/api/compute/admin/test_fixed_ips.py
+++ b/tempest/api/compute/admin/test_fixed_ips.py
@@ -51,7 +51,7 @@
@test.services('network')
def test_list_fixed_ip_details(self):
fixed_ip = self.client.show_fixed_ip(self.ip)
- self.assertEqual(fixed_ip['address'], self.ip)
+ self.assertEqual(fixed_ip['fixed_ip']['address'], self.ip)
@test.idempotent_id('5485077b-7e46-4cec-b402-91dc3173433b')
@test.services('network')
diff --git a/tempest/api/compute/admin/test_floating_ips_bulk.py b/tempest/api/compute/admin/test_floating_ips_bulk.py
index 4ac1915..c8ca938 100644
--- a/tempest/api/compute/admin/test_floating_ips_bulk.py
+++ b/tempest/api/compute/admin/test_floating_ips_bulk.py
@@ -45,7 +45,7 @@
@classmethod
def verify_unallocated_floating_ip_range(cls, ip_range):
# Verify whether configure floating IP range is not already allocated.
- body = cls.client.list_floating_ips_bulk()
+ body = cls.client.list_floating_ips_bulk()['floating_ip_info']
allocated_ips_list = map(lambda x: x['address'], body)
for ip_addr in netaddr.IPNetwork(ip_range).iter_hosts():
if str(ip_addr) in allocated_ips_list:
@@ -70,12 +70,13 @@
# anywhere. Using the below mentioned interface which is not ever
# expected to be used. Clean Up has been done for created IP range
interface = 'eth0'
- body = self.client.create_floating_ips_bulk(self.ip_range,
- pool,
- interface)
+ body = (self.client.create_floating_ips_bulk(self.ip_range,
+ pool,
+ interface)
+ ['floating_ips_bulk_create'])
self.addCleanup(self._delete_floating_ips_bulk, self.ip_range)
self.assertEqual(self.ip_range, body['ip_range'])
- ips_list = self.client.list_floating_ips_bulk()
+ ips_list = self.client.list_floating_ips_bulk()['floating_ip_info']
self.assertNotEqual(0, len(ips_list))
for ip in netaddr.IPNetwork(self.ip_range).iter_hosts():
self.assertIn(str(ip), map(lambda x: x['address'], ips_list))
diff --git a/tempest/api/compute/admin/test_hosts.py b/tempest/api/compute/admin/test_hosts.py
index 0dadea5..6d8788f 100644
--- a/tempest/api/compute/admin/test_hosts.py
+++ b/tempest/api/compute/admin/test_hosts.py
@@ -30,15 +30,15 @@
@test.idempotent_id('9bfaf98d-e2cb-44b0-a07e-2558b2821e4f')
def test_list_hosts(self):
- hosts = self.client.list_hosts()
+ hosts = self.client.list_hosts()['hosts']
self.assertTrue(len(hosts) >= 2, str(hosts))
@test.idempotent_id('5dc06f5b-d887-47a2-bb2a-67762ef3c6de')
def test_list_hosts_with_zone(self):
self.useFixture(fixtures.LockFixture('availability_zone'))
- hosts = self.client.list_hosts()
+ hosts = self.client.list_hosts()['hosts']
host = hosts[0]
- hosts = self.client.list_hosts(zone=host['zone'])
+ hosts = self.client.list_hosts(zone=host['zone'])['hosts']
self.assertTrue(len(hosts) >= 1)
self.assertIn(host, hosts)
@@ -46,26 +46,26 @@
def test_list_hosts_with_a_blank_zone(self):
# If send the request with a blank zone, the request will be successful
# and it will return all the hosts list
- hosts = self.client.list_hosts(zone='')
+ hosts = self.client.list_hosts(zone='')['hosts']
self.assertNotEqual(0, len(hosts))
@test.idempotent_id('c6ddbadb-c94e-4500-b12f-8ffc43843ff8')
def test_list_hosts_with_nonexistent_zone(self):
# If send the request with a nonexistent zone, the request will be
# successful and no hosts will be retured
- hosts = self.client.list_hosts(zone='xxx')
+ hosts = self.client.list_hosts(zone='xxx')['hosts']
self.assertEqual(0, len(hosts))
@test.idempotent_id('38adbb12-aee2-4498-8aec-329c72423aa4')
def test_show_host_detail(self):
- hosts = self.client.list_hosts()
+ hosts = self.client.list_hosts()['hosts']
hosts = [host for host in hosts if host['service'] == 'compute']
self.assertTrue(len(hosts) >= 1)
for host in hosts:
hostname = host['host_name']
- resources = self.client.show_host(hostname)
+ resources = self.client.show_host(hostname)['host']
self.assertTrue(len(resources) >= 1)
host_resource = resources[0]['resource']
self.assertIsNotNone(host_resource)
diff --git a/tempest/api/compute/admin/test_hosts_negative.py b/tempest/api/compute/admin/test_hosts_negative.py
index b2d2a04..2ea7f1a 100644
--- a/tempest/api/compute/admin/test_hosts_negative.py
+++ b/tempest/api/compute/admin/test_hosts_negative.py
@@ -32,7 +32,7 @@
cls.non_admin_client = cls.os.hosts_client
def _get_host_name(self):
- hosts = self.client.list_hosts()
+ hosts = self.client.list_hosts()['hosts']
self.assertTrue(len(hosts) >= 1)
hostname = hosts[0]['host_name']
return hostname
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index 79c2ac9..d6bc6f5 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -41,7 +41,7 @@
cls.created_server_ids = []
def _get_compute_hostnames(self):
- body = self.admin_hosts_client.list_hosts()
+ body = self.admin_hosts_client.list_hosts()['hosts']
return [
host_record['host_name']
for host_record in body
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/certificates/test_certificates.py b/tempest/api/compute/certificates/test_certificates.py
index 5f68786..78a0a93 100644
--- a/tempest/api/compute/certificates/test_certificates.py
+++ b/tempest/api/compute/certificates/test_certificates.py
@@ -24,13 +24,14 @@
@test.idempotent_id('c070a441-b08e-447e-a733-905909535b1b')
def test_create_root_certificate(self):
# create certificates
- body = self.certificates_client.create_certificate()
+ body = self.certificates_client.create_certificate()['certificate']
self.assertIn('data', body)
self.assertIn('private_key', body)
@test.idempotent_id('3ac273d0-92d2-4632-bdfc-afbc21d4606c')
def test_get_root_certificate(self):
# get the root certificate
- body = self.certificates_client.show_certificate('root')
+ body = (self.certificates_client.show_certificate('root')
+ ['certificate'])
self.assertIn('data', body)
self.assertIn('private_key', body)
diff --git a/tempest/api/compute/floating_ips/test_list_floating_ips.py b/tempest/api/compute/floating_ips/test_list_floating_ips.py
index d26a5e5..7a5bcff 100644
--- a/tempest/api/compute/floating_ips/test_list_floating_ips.py
+++ b/tempest/api/compute/floating_ips/test_list_floating_ips.py
@@ -78,5 +78,5 @@
def test_list_floating_ip_pools(self):
# Positive test:Should return the list of floating IP Pools
floating_ip_pools = self.pools_client.list_floating_ip_pools()
- self.assertNotEqual(0, len(floating_ip_pools),
+ self.assertNotEqual(0, len(floating_ip_pools['floating_ip_pools']),
"Expected floating IP Pools. Got zero.")
diff --git a/tempest/api/compute/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/servers/test_availability_zone.py b/tempest/api/compute/servers/test_availability_zone.py
index d1fbcec..080441a 100644
--- a/tempest/api/compute/servers/test_availability_zone.py
+++ b/tempest/api/compute/servers/test_availability_zone.py
@@ -32,4 +32,4 @@
def test_get_availability_zone_list_with_non_admin_user(self):
# List of availability zone with non-administrator user
availability_zone = self.client.list_availability_zones()
- self.assertTrue(len(availability_zone) > 0)
+ self.assertTrue(len(availability_zone['availabilityZoneInfo']) > 0)
diff --git a/tempest/api/database/limits/test_limits.py b/tempest/api/database/limits/test_limits.py
index 7d2fbac..4b7f2d6 100644
--- a/tempest/api/database/limits/test_limits.py
+++ b/tempest/api/database/limits/test_limits.py
@@ -29,7 +29,7 @@
def test_absolute_limits(self):
# Test to verify if all absolute limit paramaters are
# present when verb is ABSOLUTE
- limits = self.client.list_db_limits()
+ limits = self.client.list_db_limits()['limits']
expected_abs_limits = ['max_backups', 'max_volumes',
'max_instances', 'verb']
absolute_limit = [l for l in limits
diff --git a/tempest/api/database/versions/test_versions.py b/tempest/api/database/versions/test_versions.py
index 55d8246..ae568b1 100644
--- a/tempest/api/database/versions/test_versions.py
+++ b/tempest/api/database/versions/test_versions.py
@@ -27,7 +27,7 @@
@test.attr(type='smoke')
@test.idempotent_id('6952cd77-90cd-4dca-bb60-8e2c797940cf')
def test_list_db_versions(self):
- versions = self.client.list_db_versions()
+ versions = self.client.list_db_versions()['versions']
self.assertTrue(len(versions) > 0, "No database versions found")
# List of all versions should contain the current version, and there
# should only be one 'current' version
diff --git a/tempest/api/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 26109cf..e44a96b 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -45,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
@@ -60,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]
@@ -73,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)
@@ -102,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')
@@ -121,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 87c30dc..8cf853b 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -79,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_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..5b6b0fa 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
@@ -163,7 +163,7 @@
def list_resources(self, stack_identifier):
"""Get a dict mapping of resource names to types."""
- resources = self.client.list_resources(stack_identifier)
+ resources = self.client.list_resources(stack_identifier)['resources']
self.assertIsInstance(resources, list)
for res in resources:
self.assert_fields_in_dict(res, 'logical_resource_id',
@@ -174,5 +174,5 @@
for r in resources)
def get_stack_output(self, stack_identifier, output_key):
- body = self.client.show_stack(stack_identifier)
+ body = self.client.show_stack(stack_identifier)['stack']
return self.stack_output(body, output_key)
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index b27d6c9..cb6d1db 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -75,7 +75,8 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
try:
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
- resources = cls.client.list_resources(cls.stack_identifier)
+ resources = (cls.client.list_resources(cls.stack_identifier)
+ ['resources'])
except exceptions.TimeoutException as e:
if CONF.compute_feature_enabled.console_output:
# attempt to log the server console to help with debugging
diff --git a/tempest/api/orchestration/stacks/test_non_empty_stack.py b/tempest/api/orchestration/stacks/test_non_empty_stack.py
index 494b6fd..e37587c 100644
--- a/tempest/api/orchestration/stacks/test_non_empty_stack.py
+++ b/tempest/api/orchestration/stacks/test_non_empty_stack.py
@@ -47,7 +47,7 @@
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
def _list_stacks(self, expected_num=None, **filter_kwargs):
- stacks = self.client.list_stacks(params=filter_kwargs)
+ stacks = self.client.list_stacks(params=filter_kwargs)['stacks']
self.assertIsInstance(stacks, list)
if expected_num is not None:
self.assertEqual(expected_num, len(stacks))
@@ -63,7 +63,7 @@
@test.idempotent_id('992f96e3-41ee-4ff6-91c7-bcfb670c0919')
def test_stack_show(self):
"""Getting details about created stack should be possible."""
- stack = self.client.show_stack(self.stack_name)
+ stack = self.client.show_stack(self.stack_name)['stack']
self.assertIsInstance(stack, dict)
self.assert_fields_in_dict(stack, 'stack_name', 'id', 'links',
'parameters', 'outputs', 'disable_rollback',
@@ -100,7 +100,7 @@
def test_show_resource(self):
"""Getting details about created resource should be possible."""
resource = self.client.show_resource(self.stack_identifier,
- self.resource_name)
+ self.resource_name)['resource']
self.assertIsInstance(resource, dict)
self.assert_fields_in_dict(resource, 'resource_name', 'description',
'links', 'logical_resource_id',
@@ -115,14 +115,14 @@
"""Getting metadata for created resources should be possible."""
metadata = self.client.show_resource_metadata(
self.stack_identifier,
- self.resource_name)
+ self.resource_name)['metadata']
self.assertIsInstance(metadata, dict)
self.assertEqual(['Tom', 'Stinky'], metadata.get('kittens', None))
@test.idempotent_id('46567533-0a7f-483b-8942-fa19e0f17839')
def test_list_events(self):
"""Getting list of created events for the stack should be possible."""
- events = self.client.list_events(self.stack_identifier)
+ events = self.client.list_events(self.stack_identifier)['events']
self.assertIsInstance(events, list)
for event in events:
@@ -138,12 +138,12 @@
def test_show_event(self):
"""Getting details about an event should be possible."""
events = self.client.list_resource_events(self.stack_identifier,
- self.resource_name)
+ self.resource_name)['events']
self.assertNotEqual([], events)
events.sort(key=lambda event: event['event_time'])
event_id = events[0]['id']
event = self.client.show_event(self.stack_identifier,
- self.resource_name, event_id)
+ self.resource_name, event_id)['event']
self.assertIsInstance(event, dict)
self.assert_fields_in_dict(event, 'resource_name', 'event_time',
'links', 'logical_resource_id',
diff --git a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
index 6a04dbd..b4d7fa0 100644
--- a/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
+++ b/tempest/api/orchestration/stacks/test_nova_keypair_resources.py
@@ -43,7 +43,8 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
- resources = cls.client.list_resources(cls.stack_identifier)
+ resources = (cls.client.list_resources(cls.stack_identifier)
+ ['resources'])
cls.test_resources = {}
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
@@ -70,7 +71,7 @@
@test.idempotent_id('8d77dec7-91fd-45a6-943d-5abd45e338a4')
def test_stack_keypairs_output(self):
- stack = self.client.show_stack(self.stack_name)
+ stack = self.client.show_stack(self.stack_name)['stack']
self.assertIsInstance(stack, dict)
output_map = {}
diff --git a/tempest/api/orchestration/stacks/test_resource_types.py b/tempest/api/orchestration/stacks/test_resource_types.py
index 8f15f9c..8cf40de 100644
--- a/tempest/api/orchestration/stacks/test_resource_types.py
+++ b/tempest/api/orchestration/stacks/test_resource_types.py
@@ -20,7 +20,7 @@
@test.idempotent_id('7123d082-3577-4a30-8f00-f805327c4ffd')
def test_resource_type_list(self):
"""Verify it is possible to list resource types."""
- resource_types = self.client.list_resource_types()
+ resource_types = self.client.list_resource_types()['resource_types']
self.assertIsInstance(resource_types, list)
self.assertIn('OS::Nova::Server', resource_types)
@@ -28,7 +28,7 @@
@test.idempotent_id('0e85a483-828b-4a28-a0e3-f0a21809192b')
def test_resource_type_show(self):
"""Verify it is possible to get schema about resource types."""
- resource_types = self.client.list_resource_types()
+ resource_types = self.client.list_resource_types()['resource_types']
self.assertNotEmpty(resource_types)
for resource_type in resource_types:
diff --git a/tempest/api/orchestration/stacks/test_stacks.py b/tempest/api/orchestration/stacks/test_stacks.py
index abec906..f766b00 100644
--- a/tempest/api/orchestration/stacks/test_stacks.py
+++ b/tempest/api/orchestration/stacks/test_stacks.py
@@ -30,7 +30,7 @@
@test.attr(type='smoke')
@test.idempotent_id('d35d628c-07f6-4674-85a1-74db9919e986')
def test_stack_list_responds(self):
- stacks = self.client.list_stacks()
+ stacks = self.client.list_stacks()['stacks']
self.assertIsInstance(stacks, list)
@test.attr(type='smoke')
@@ -47,20 +47,20 @@
self.client.wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
# check for stack in list
- stacks = self.client.list_stacks()
+ stacks = self.client.list_stacks()['stacks']
list_ids = list([stack['id'] for stack in stacks])
self.assertIn(stack_id, list_ids)
# fetch the stack
- stack = self.client.show_stack(stack_identifier)
+ stack = self.client.show_stack(stack_identifier)['stack']
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# fetch the stack by name
- stack = self.client.show_stack(stack_name)
+ stack = self.client.show_stack(stack_name)['stack']
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# fetch the stack by id
- stack = self.client.show_stack(stack_id)
+ stack = self.client.show_stack(stack_id)['stack']
self.assertEqual('CREATE_COMPLETE', stack['stack_status'])
# delete the stack
diff --git a/tempest/api/orchestration/stacks/test_swift_resources.py b/tempest/api/orchestration/stacks/test_swift_resources.py
index 30166df..c0f1c4b 100644
--- a/tempest/api/orchestration/stacks/test_swift_resources.py
+++ b/tempest/api/orchestration/stacks/test_swift_resources.py
@@ -55,7 +55,8 @@
cls.stack_id = cls.stack_identifier.split('/')[1]
cls.client.wait_for_stack_status(cls.stack_id, 'CREATE_COMPLETE')
cls.test_resources = {}
- resources = cls.client.list_resources(cls.stack_identifier)
+ resources = (cls.client.list_resources(cls.stack_identifier)
+ ['resources'])
for resource in resources:
cls.test_resources[resource['logical_resource_id']] = resource
diff --git a/tempest/api/volume/admin/test_snapshots_actions.py b/tempest/api/volume/admin/test_snapshots_actions.py
index c860b4b..66973a7 100644
--- a/tempest/api/volume/admin/test_snapshots_actions.py
+++ b/tempest/api/volume/admin/test_snapshots_actions.py
@@ -41,8 +41,8 @@
# Create a test shared snapshot for tests
snap_name = data_utils.rand_name(cls.__name__ + '-Snapshot')
params = {cls.name_field: snap_name}
- cls.snapshot = \
- cls.client.create_snapshot(cls.volume['id'], **params)
+ cls.snapshot = cls.client.create_snapshot(
+ cls.volume['id'], **params)['snapshot']
cls.client.wait_for_snapshot_status(cls.snapshot['id'],
'available')
@@ -86,8 +86,8 @@
status = 'creating'
self.admin_snapshots_client.\
reset_snapshot_status(self.snapshot['id'], status)
- snapshot_get \
- = self.admin_snapshots_client.show_snapshot(self.snapshot['id'])
+ snapshot_get = self.admin_snapshots_client.show_snapshot(
+ self.snapshot['id'])['snapshot']
self.assertEqual(status, snapshot_get['status'])
@test.idempotent_id('41288afd-d463-485e-8f6e-4eea159413eb')
@@ -103,8 +103,8 @@
progress_alias = self._get_progress_alias()
self.client.update_snapshot_status(self.snapshot['id'],
status, progress)
- snapshot_get \
- = self.admin_snapshots_client.show_snapshot(self.snapshot['id'])
+ snapshot_get = self.admin_snapshots_client.show_snapshot(
+ self.snapshot['id'])['snapshot']
self.assertEqual(status, snapshot_get['status'])
self.assertEqual(progress, snapshot_get[progress_alias])
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index b67a6d2..c987100 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -122,8 +122,8 @@
@classmethod
def create_snapshot(cls, volume_id=1, **kwargs):
"""Wrapper utility that returns a test snapshot."""
- snapshot = cls.snapshots_client.create_snapshot(volume_id,
- **kwargs)
+ snapshot = cls.snapshots_client.create_snapshot(
+ volume_id, **kwargs)['snapshot']
cls.snapshots.append(snapshot)
cls.snapshots_client.wait_for_snapshot_status(snapshot['id'],
'available')
@@ -217,7 +217,7 @@
name = name or data_utils.rand_name(cls.__name__ + '-QoS')
consumer = consumer or 'front-end'
qos_specs = cls.volume_qos_client.create_qos(name, consumer,
- **kwargs)
+ **kwargs)['qos_specs']
cls.qos_specs.append(qos_specs['id'])
return qos_specs
diff --git a/tempest/api/volume/test_qos.py b/tempest/api/volume/test_qos.py
index 84fd7f6..5a58e2c 100644
--- a/tempest/api/volume/test_qos.py
+++ b/tempest/api/volume/test_qos.py
@@ -47,7 +47,7 @@
self.volume_qos_client.wait_for_resource_deletion(body['id'])
# validate the deletion
- list_qos = self.volume_qos_client.list_qos()
+ list_qos = self.volume_qos_client.list_qos()['qos_specs']
self.assertNotIn(body, list_qos)
def _create_test_volume_type(self):
@@ -64,7 +64,7 @@
def _test_get_association_qos(self):
body = self.volume_qos_client.show_association_qos(
- self.created_qos['id'])
+ self.created_qos['id'])['qos_associations']
associations = []
for association in body:
@@ -99,24 +99,27 @@
@test.idempotent_id('7aa214cc-ac1a-4397-931f-3bb2e83bb0fd')
def test_get_qos(self):
"""Tests the detail of a given qos-specs"""
- body = self.volume_qos_client.show_qos(self.created_qos['id'])
+ body = self.volume_qos_client.show_qos(
+ self.created_qos['id'])['qos_specs']
self.assertEqual(self.qos_name, body['name'])
self.assertEqual(self.qos_consumer, body['consumer'])
@test.idempotent_id('75e04226-bcf7-4595-a34b-fdf0736f38fc')
def test_list_qos(self):
"""Tests the list of all qos-specs"""
- body = self.volume_qos_client.list_qos()
+ body = self.volume_qos_client.list_qos()['qos_specs']
self.assertIn(self.created_qos, body)
@test.idempotent_id('ed00fd85-4494-45f2-8ceb-9e2048919aed')
def test_set_unset_qos_key(self):
"""Test the addition of a specs key to qos-specs"""
args = {'iops_bytes': '500'}
- body = self.volume_qos_client.set_qos_key(self.created_qos['id'],
- iops_bytes='500')
+ body = self.volume_qos_client.set_qos_key(
+ self.created_qos['id'],
+ iops_bytes='500')['qos_specs']
self.assertEqual(args, body)
- body = self.volume_qos_client.show_qos(self.created_qos['id'])
+ body = self.volume_qos_client.show_qos(
+ self.created_qos['id'])['qos_specs']
self.assertEqual(args['iops_bytes'], body['specs']['iops_bytes'])
# test the deletion of a specs key from qos-specs
@@ -125,7 +128,8 @@
operation = 'qos-key-unset'
self.volume_qos_client.wait_for_qos_operations(self.created_qos['id'],
operation, keys)
- body = self.volume_qos_client.show_qos(self.created_qos['id'])
+ body = self.volume_qos_client.show_qos(
+ self.created_qos['id'])['qos_specs']
self.assertNotIn(keys[0], body['specs'])
@test.idempotent_id('1dd93c76-6420-485d-a771-874044c416ac')
diff --git a/tempest/api/volume/test_snapshot_metadata.py b/tempest/api/volume/test_snapshot_metadata.py
index 641317a..ce6ba90 100644
--- a/tempest/api/volume/test_snapshot_metadata.py
+++ b/tempest/api/volume/test_snapshot_metadata.py
@@ -48,16 +48,18 @@
"key3": "value3"}
expected = {"key2": "value2",
"key3": "value3"}
- body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(
+ self.snapshot_id, metadata)['metadata']
# Get the metadata of the snapshot
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Delete one item metadata of the snapshot
self.client.delete_snapshot_metadata_item(
self.snapshot_id, "key1")
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(expected.items()))
self.assertNotIn("key1", body)
@@ -70,17 +72,19 @@
update = {"key3": "value3_update",
"key4": "value4"}
# Create metadata for the snapshot
- body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(
+ self.snapshot_id, metadata)['metadata']
# Get the metadata of the snapshot
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata item
body = self.client.update_snapshot_metadata(
- self.snapshot_id, update)
+ self.snapshot_id, update)['metadata']
# Get the metadata of the snapshot
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertEqual(update, body)
@test.idempotent_id('e8ff85c5-8f97-477f-806a-3ac364a949ed')
@@ -94,16 +98,18 @@
"key2": "value2",
"key3": "value3_update"}
# Create metadata for the snapshot
- body = self.client.create_snapshot_metadata(self.snapshot_id,
- metadata)
+ body = self.client.create_snapshot_metadata(
+ self.snapshot_id, metadata)['metadata']
# Get the metadata of the snapshot
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))
# Update metadata item
body = self.client.update_snapshot_metadata_item(
- self.snapshot_id, "key3", update_item)
+ self.snapshot_id, "key3", update_item)['meta']
# Get the metadata of the snapshot
- body = self.client.show_snapshot_metadata(self.snapshot_id)
+ body = self.client.show_snapshot_metadata(
+ self.snapshot_id)['metadata']
self.assertThat(body.items(), matchers.ContainsAll(expect.items()))
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 5860501..058e220 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -49,12 +49,11 @@
and validates result.
"""
if with_detail:
- fetched_snap_list = \
- self.snapshots_client.\
- list_snapshots(detail=True, params=params)
+ fetched_snap_list = self.snapshots_client.list_snapshots(
+ detail=True, params=params)['snapshots']
else:
- fetched_snap_list = \
- self.snapshots_client.list_snapshots(params=params)
+ fetched_snap_list = self.snapshots_client.list_snapshots(
+ params=params)['snapshots']
# Validating params of fetched snapshots
for snap in fetched_snap_list:
@@ -99,14 +98,15 @@
snapshot = self.create_snapshot(self.volume_origin['id'], **params)
# Get the snap and check for some of its details
- snap_get = self.snapshots_client.show_snapshot(snapshot['id'])
+ snap_get = self.snapshots_client.show_snapshot(
+ snapshot['id'])['snapshot']
self.assertEqual(self.volume_origin['id'],
snap_get['volume_id'],
"Referred volume origin mismatch")
# Compare also with the output from the list action
tracking_data = (snapshot['id'], snapshot[self.name_field])
- snaps_list = self.snapshots_client.list_snapshots()
+ snaps_list = self.snapshots_client.list_snapshots()['snapshots']
snaps_data = [(f['id'], f[self.name_field]) for f in snaps_list]
self.assertIn(tracking_data, snaps_data)
@@ -115,14 +115,14 @@
new_desc = 'This is the new description of snapshot.'
params = {self.name_field: new_s_name,
self.descrip_field: new_desc}
- update_snapshot = \
- self.snapshots_client.update_snapshot(snapshot['id'], **params)
+ update_snapshot = self.snapshots_client.update_snapshot(
+ snapshot['id'], **params)['snapshot']
# Assert response body for update_snapshot method
self.assertEqual(new_s_name, update_snapshot[self.name_field])
self.assertEqual(new_desc, update_snapshot[self.descrip_field])
# Assert response body for show_snapshot method
- updated_snapshot = \
- self.snapshots_client.show_snapshot(snapshot['id'])
+ updated_snapshot = self.snapshots_client.show_snapshot(
+ snapshot['id'])['snapshot']
self.assertEqual(new_s_name, updated_snapshot[self.name_field])
self.assertEqual(new_desc, updated_snapshot[self.descrip_field])
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..26e4569 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -220,7 +220,7 @@
def list(self):
client = self.client
- stacks = client.list_stacks()
+ stacks = client.list_stacks()['stacks']
LOG.debug("List count, %s Stacks" % len(stacks))
return stacks
@@ -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 740363b..71aacbd 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -274,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:
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/scenario/manager.py b/tempest/scenario/manager.py
index 5d9880b..766042e 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -145,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,
diff --git a/tempest/scenario/test_aggregates_basic_ops.py b/tempest/scenario/test_aggregates_basic_ops.py
index f5f4a61..fcde561 100644
--- a/tempest/scenario/test_aggregates_basic_ops.py
+++ b/tempest/scenario/test_aggregates_basic_ops.py
@@ -58,7 +58,7 @@
self.aggregates_client.delete_aggregate(aggregate['id'])
def _get_host_name(self):
- hosts = self.hosts_client.list_hosts()
+ hosts = self.hosts_client.list_hosts()['hosts']
self.assertTrue(len(hosts) >= 1)
computes = [x for x in hosts if x['service'] == 'compute']
return computes[0]['host_name']
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index 8b5a595..a7bdba3 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -80,12 +80,13 @@
def _create_volume_snapshot(self, volume):
snapshot_name = data_utils.rand_name('scenario-snapshot')
_, snapshot = self.snapshots_client.create_snapshot(
- volume['id'], display_name=snapshot_name)
+ volume['id'], display_name=snapshot_name)['snapshot']
def cleaner():
self.snapshots_client.delete_snapshot(snapshot['id'])
try:
- while self.snapshots_client.show_snapshot(snapshot['id']):
+ while self.snapshots_client.show_snapshot(
+ snapshot['id'])['snapshot']:
time.sleep(1)
except lib_exc.NotFound:
pass
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 03f80d5..f69b7d2 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -69,7 +69,7 @@
snap = self.snapshots_client.create_snapshot(
volume_id=vol_id,
force=True,
- display_name=snap_name)
+ display_name=snap_name)['snapshot']
self.addCleanup(
self.snapshots_client.wait_for_resource_deletion, snap['id'])
self.addCleanup(self.snapshots_client.delete_snapshot, snap['id'])
diff --git a/tempest/services/compute/json/agents_client.py b/tempest/services/compute/json/agents_client.py
index 1a1d832..d38c8cd 100644
--- a/tempest/services/compute/json/agents_client.py
+++ b/tempest/services/compute/json/agents_client.py
@@ -32,7 +32,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_agents, resp, body)
- return service_client.ResponseBodyList(resp, body['agents'])
+ return service_client.ResponseBody(resp, body)
def create_agent(self, **kwargs):
"""Create an agent build."""
@@ -40,7 +40,7 @@
resp, body = self.post('os-agents', post_body)
body = json.loads(body)
self.validate_response(schema.create_agent, resp, body)
- return service_client.ResponseBody(resp, body['agent'])
+ return service_client.ResponseBody(resp, body)
def delete_agent(self, agent_id):
"""Delete an existing agent build."""
@@ -53,4 +53,4 @@
put_body = json.dumps({'para': kwargs})
resp, body = self.put('os-agents/%s' % agent_id, put_body)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['agent'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/availability_zone_client.py b/tempest/services/compute/json/availability_zone_client.py
index c74fd10..0012637 100644
--- a/tempest/services/compute/json/availability_zone_client.py
+++ b/tempest/services/compute/json/availability_zone_client.py
@@ -32,5 +32,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema_list, resp, body)
- return service_client.ResponseBodyList(resp,
- body['availabilityZoneInfo'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/baremetal_nodes_client.py b/tempest/services/compute/json/baremetal_nodes_client.py
index 8165292..15f883a 100644
--- a/tempest/services/compute/json/baremetal_nodes_client.py
+++ b/tempest/services/compute/json/baremetal_nodes_client.py
@@ -33,7 +33,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_baremetal_nodes, resp, body)
- return service_client.ResponseBodyList(resp, body['nodes'])
+ return service_client.ResponseBody(resp, body)
def show_baremetal_node(self, baremetal_node_id):
"""Returns the details of a single baremetal node."""
@@ -41,4 +41,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_baremetal_node, resp, body)
- return service_client.ResponseBody(resp, body['node'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/certificates_client.py b/tempest/services/compute/json/certificates_client.py
index c25b273..d6c72f4 100644
--- a/tempest/services/compute/json/certificates_client.py
+++ b/tempest/services/compute/json/certificates_client.py
@@ -26,7 +26,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_certificate, resp, body)
- return service_client.ResponseBody(resp, body['certificate'])
+ return service_client.ResponseBody(resp, body)
def create_certificate(self):
"""create certificates."""
@@ -34,4 +34,4 @@
resp, body = self.post(url, None)
body = json.loads(body)
self.validate_response(schema.create_certificate, resp, body)
- return service_client.ResponseBody(resp, body['certificate'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/fixed_ips_client.py b/tempest/services/compute/json/fixed_ips_client.py
index d0d9ca1..23401c3 100644
--- a/tempest/services/compute/json/fixed_ips_client.py
+++ b/tempest/services/compute/json/fixed_ips_client.py
@@ -26,7 +26,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_fixed_ip, resp, body)
- return service_client.ResponseBody(resp, body['fixed_ip'])
+ return service_client.ResponseBody(resp, body)
def reserve_fixed_ip(self, fixed_ip, **kwargs):
"""This reserves and unreserves fixed ips."""
diff --git a/tempest/services/compute/json/floating_ip_pools_client.py b/tempest/services/compute/json/floating_ip_pools_client.py
index 1e2133b..7a4434f 100644
--- a/tempest/services/compute/json/floating_ip_pools_client.py
+++ b/tempest/services/compute/json/floating_ip_pools_client.py
@@ -24,7 +24,7 @@
class FloatingIPPoolsClient(service_client.ServiceClient):
def list_floating_ip_pools(self, params=None):
- """Returns a list of all floating IP Pools."""
+ """Gets all floating IP Pools list."""
url = 'os-floating-ip-pools'
if params:
url += '?%s' % urllib.urlencode(params)
@@ -32,4 +32,4 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_floating_ip_pools, resp, body)
- return service_client.ResponseBodyList(resp, body['floating_ip_pools'])
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/floating_ips_bulk_client.py b/tempest/services/compute/json/floating_ips_bulk_client.py
index 8b1c5a9..c51f77e 100644
--- a/tempest/services/compute/json/floating_ips_bulk_client.py
+++ b/tempest/services/compute/json/floating_ips_bulk_client.py
@@ -32,18 +32,17 @@
resp, body = self.post('os-floating-ips-bulk', post_body)
body = json.loads(body)
self.validate_response(schema.create_floating_ips_bulk, resp, body)
- return service_client.ResponseBody(resp,
- body['floating_ips_bulk_create'])
+ return service_client.ResponseBody(resp, body)
def list_floating_ips_bulk(self):
- """Returns a list of all floating IPs bulk."""
+ """Gets all floating IPs in bulk."""
resp, body = self.get('os-floating-ips-bulk')
body = json.loads(body)
self.validate_response(schema.list_floating_ips_bulk, resp, body)
- return service_client.ResponseBodyList(resp, body['floating_ip_info'])
+ return service_client.ResponseBody(resp, body)
def delete_floating_ips_bulk(self, ip_range):
- """Deletes the provided floating IPs bulk."""
+ """Deletes the provided floating IPs in bulk."""
post_body = json.dumps({'ip_range': ip_range})
resp, body = self.put('os-floating-ips-bulk/delete', post_body)
body = json.loads(body)
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
index 752af68..3d3cb18 100644
--- a/tempest/services/compute/json/hosts_client.py
+++ b/tempest/services/compute/json/hosts_client.py
@@ -31,7 +31,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_hosts, resp, body)
- return service_client.ResponseBodyList(resp, body['hosts'])
+ return service_client.ResponseBody(resp, body)
def show_host(self, hostname):
"""Show detail information for the host."""
@@ -39,7 +39,7 @@
resp, body = self.get("os-hosts/%s" % hostname)
body = json.loads(body)
self.validate_response(schema.get_host_detail, resp, body)
- return service_client.ResponseBodyList(resp, body['host'])
+ return service_client.ResponseBody(resp, body)
def update_host(self, hostname, **kwargs):
"""Update a host."""
@@ -62,7 +62,7 @@
resp, body = self.get("os-hosts/%s/startup" % hostname)
body = json.loads(body)
self.validate_response(schema.startup_host, resp, body)
- return service_client.ResponseBody(resp, body['host'])
+ return service_client.ResponseBody(resp, body)
def shutdown_host(self, hostname):
"""Shutdown a host."""
@@ -70,7 +70,7 @@
resp, body = self.get("os-hosts/%s/shutdown" % hostname)
body = json.loads(body)
self.validate_response(schema.shutdown_host, resp, body)
- return service_client.ResponseBody(resp, body['host'])
+ return service_client.ResponseBody(resp, body)
def reboot_host(self, hostname):
"""reboot a host."""
@@ -78,4 +78,4 @@
resp, body = self.get("os-hosts/%s/reboot" % hostname)
body = json.loads(body)
self.validate_response(schema.reboot_host, resp, body)
- return service_client.ResponseBody(resp, body['host'])
+ return service_client.ResponseBody(resp, body)
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/database/json/limits_client.py b/tempest/services/database/json/limits_client.py
index 830b67f..9358a33 100644
--- a/tempest/services/database/json/limits_client.py
+++ b/tempest/services/database/json/limits_client.py
@@ -27,4 +27,4 @@
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, self._parse_resp(body))
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/database/json/versions_client.py b/tempest/services/database/json/versions_client.py
index ed1ba81..43d253b 100644
--- a/tempest/services/database/json/versions_client.py
+++ b/tempest/services/database/json/versions_client.py
@@ -43,4 +43,4 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, self._parse_resp(body))
+ return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/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/orchestration/json/orchestration_client.py b/tempest/services/orchestration/json/orchestration_client.py
index 84a9ed9..22e53f5 100644
--- a/tempest/services/orchestration/json/orchestration_client.py
+++ b/tempest/services/orchestration/json/orchestration_client.py
@@ -36,7 +36,7 @@
resp, body = self.get(uri)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['stacks'])
+ return service_client.ResponseBody(resp, body)
def create_stack(self, name, disable_rollback=True, parameters=None,
timeout_mins=60, template=None, template_url=None,
@@ -111,7 +111,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['stack'])
+ return service_client.ResponseBody(resp, body)
def suspend_stack(self, stack_identifier):
"""Suspend a stack."""
@@ -135,7 +135,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['resources'])
+ return service_client.ResponseBody(resp, body)
def show_resource(self, stack_identifier, resource_name):
"""Returns the details of a single resource."""
@@ -143,7 +143,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['resource'])
+ return service_client.ResponseBody(resp, body)
def delete_stack(self, stack_identifier):
"""Deletes the specified Stack."""
@@ -160,7 +160,7 @@
while True:
try:
body = self.show_resource(
- stack_identifier, resource_name)
+ stack_identifier, resource_name)['resource']
except lib_exc.NotFound:
# ignore this, as the resource may not have
# been created yet
@@ -195,7 +195,7 @@
while True:
try:
- body = self.show_stack(stack_identifier)
+ body = self.show_stack(stack_identifier)['stack']
except lib_exc.NotFound:
if status == 'DELETE_COMPLETE':
return
@@ -224,7 +224,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def list_events(self, stack_identifier):
"""Returns list of all events for a stack."""
@@ -232,7 +232,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['events'])
+ return service_client.ResponseBody(resp, body)
def list_resource_events(self, stack_identifier, resource_name):
"""Returns list of all events for a resource from stack."""
@@ -241,7 +241,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['events'])
+ return service_client.ResponseBody(resp, body)
def show_event(self, stack_identifier, resource_name, event_id):
"""Returns the details of a single stack's event."""
@@ -250,7 +250,7 @@
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['event'])
+ return service_client.ResponseBody(resp, body)
def show_template(self, stack_identifier):
"""Returns the template for the stack."""
@@ -293,7 +293,7 @@
resp, body = self.get('resource_types')
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBodyList(resp, body['resource_types'])
+ return service_client.ResponseBody(resp, body)
def show_resource_type(self, resource_type_name):
"""Return the schema of a resource type."""
diff --git a/tempest/services/volume/json/qos_client.py b/tempest/services/volume/json/qos_client.py
index e3d6a29..c79168c 100644
--- a/tempest/services/volume/json/qos_client.py
+++ b/tempest/services/volume/json/qos_client.py
@@ -48,15 +48,15 @@
start_time = int(time.time())
while True:
if operation == 'qos-key-unset':
- body = self.show_qos(qos_id)
+ body = self.show_qos(qos_id)['qos_specs']
if not any(key in body['specs'] for key in args):
return
elif operation == 'disassociate':
- body = self.show_association_qos(qos_id)
+ body = self.show_association_qos(qos_id)['qos_associations']
if not any(args in body[i]['id'] for i in range(0, len(body))):
return
elif operation == 'disassociate-all':
- body = self.show_association_qos(qos_id)
+ body = self.show_association_qos(qos_id)['qos_associations']
if not body:
return
else:
@@ -79,7 +79,7 @@
resp, body = self.post('qos-specs', post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- return service_client.ResponseBody(resp, body['qos_specs'])
+ return service_client.ResponseBody(resp, body)
def delete_qos(self, qos_id, force=False):
"""Delete the specified QoS specification."""
@@ -94,7 +94,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['qos_specs'])
+ return service_client.ResponseBody(resp, body)
def show_qos(self, qos_id):
"""Get the specified QoS specification."""
@@ -102,7 +102,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['qos_specs'])
+ return service_client.ResponseBody(resp, body)
def set_qos_key(self, qos_id, **kwargs):
"""Set the specified keys/values of QoS specification.
@@ -113,7 +113,7 @@
resp, body = self.put('qos-specs/%s' % qos_id, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['qos_specs'])
+ return service_client.ResponseBody(resp, body)
def unset_qos_key(self, qos_id, keys):
"""Unset the specified keys of QoS specification.
@@ -139,7 +139,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['qos_associations'])
+ return service_client.ResponseBody(resp, body)
def disassociate_qos(self, qos_id, vol_type_id):
"""Disassociate the specified QoS with specified volume-type."""
diff --git a/tempest/services/volume/json/snapshots_client.py b/tempest/services/volume/json/snapshots_client.py
index fa1f9dd..3fcf18c 100644
--- a/tempest/services/volume/json/snapshots_client.py
+++ b/tempest/services/volume/json/snapshots_client.py
@@ -40,7 +40,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBodyList(resp, body['snapshots'])
+ return service_client.ResponseBody(resp, body)
def show_snapshot(self, snapshot_id):
"""Returns the details of a single snapshot."""
@@ -48,7 +48,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['snapshot'])
+ return service_client.ResponseBody(resp, body)
def create_snapshot(self, volume_id, **kwargs):
"""
@@ -64,7 +64,7 @@
resp, body = self.post('snapshots', post_body)
body = json.loads(body)
self.expected_success(self.create_resp, resp.status)
- return service_client.ResponseBody(resp, body['snapshot'])
+ return service_client.ResponseBody(resp, body)
def update_snapshot(self, snapshot_id, **kwargs):
"""Updates a snapshot."""
@@ -72,11 +72,11 @@
resp, body = self.put('snapshots/%s' % snapshot_id, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['snapshot'])
+ return service_client.ResponseBody(resp, body)
# NOTE(afazekas): just for the wait function
def _get_snapshot_status(self, snapshot_id):
- body = self.show_snapshot(snapshot_id)
+ body = self.show_snapshot(snapshot_id)['snapshot']
status = body['status']
# NOTE(afazekas): snapshot can reach an "error"
# state in a "normal" lifecycle
@@ -155,7 +155,7 @@
resp, body = self.post(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def show_snapshot_metadata(self, snapshot_id):
"""Get metadata of the snapshot."""
@@ -163,7 +163,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def update_snapshot_metadata(self, snapshot_id, metadata):
"""Update metadata for the snapshot."""
@@ -172,7 +172,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['metadata'])
+ return service_client.ResponseBody(resp, body)
def update_snapshot_metadata_item(self, snapshot_id, id, meta_item):
"""Update metadata item for the snapshot."""
@@ -181,7 +181,7 @@
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body['meta'])
+ return service_client.ResponseBody(resp, body)
def delete_snapshot_metadata_item(self, snapshot_id, id):
"""Delete metadata item for the snapshot."""
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index 5d1dd36..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'])
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index 2675a1c..9e21326 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -40,7 +40,7 @@
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:
@@ -72,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"):
@@ -81,8 +81,8 @@
# We have to delete snapshots first or
# volume deletion may block
- _, snaps = admin_manager.snapshots_client.\
- list_snapshots(params={"all_tenants": True})
+ _, snaps = admin_manager.snapshots_client.list_snapshots(
+ params={"all_tenants": True})['snapshots']
LOG.info("Cleanup::remove %s snapshots" % len(snaps))
for v in snaps:
try:
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_agents_client.py b/tempest/tests/services/compute/test_agents_client.py
index 8316c90..d14d8bf 100644
--- a/tempest/tests/services/compute/test_agents_client.py
+++ b/tempest/tests/services/compute/test_agents_client.py
@@ -34,7 +34,7 @@
body = '{"agents": []}'
if bytes_body:
body = body.encode('utf-8')
- expected = []
+ expected = {"agents": []}
response = (httplib2.Response({'status': 200}), body)
self.useFixture(mockpatch.Patch(
'tempest.common.service_client.ServiceClient.get',
@@ -42,10 +42,11 @@
self.assertEqual(expected, self.client.list_agents())
def _test_create_agent(self, bytes_body=False):
- expected = {"url": "http://foo.com", "hypervisor": "kvm",
- "md5hash": "md5", "version": "2", "architecture": "x86_64",
- "os": "linux", "agent_id": 1}
- serialized_body = json.dumps({"agent": expected})
+ expected = {"agent": {"url": "http://foo.com", "hypervisor": "kvm",
+ "md5hash": "md5", "version": "2",
+ "architecture": "x86_64",
+ "os": "linux", "agent_id": 1}}
+ serialized_body = json.dumps(expected)
if bytes_body:
serialized_body = serialized_body.encode('utf-8')
@@ -67,9 +68,9 @@
self.client.delete_agent("1")
def _test_update_agent(self, bytes_body=False):
- expected = {"url": "http://foo.com", "md5hash": "md5", "version": "2",
- "agent_id": 1}
- serialized_body = json.dumps({"agent": expected})
+ expected = {"agent": {"url": "http://foo.com", "md5hash": "md5",
+ "version": "2", "agent_id": 1}}
+ serialized_body = json.dumps(expected)
if bytes_body:
serialized_body = serialized_body.encode('utf-8')
diff --git a/tempest/tests/services/compute/test_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')
diff --git a/tempest/tests/services/compute/test_networks_client.py b/tempest/tests/services/compute/test_networks_client.py
new file mode 100644
index 0000000..5e57dea
--- /dev/null
+++ b/tempest/tests/services/compute/test_networks_client.py
@@ -0,0 +1,106 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import httplib2
+
+from oslo_serialization import jsonutils as json
+from oslotest import mockpatch
+
+from tempest.services.compute.json import networks_client
+from tempest.tests import base
+from tempest.tests import fake_auth_provider
+
+
+class TestNetworksClient(base.TestCase):
+
+ FAKE_NETWORK = {
+ "bridge": None,
+ "vpn_public_port": None,
+ "dhcp_start": None,
+ "bridge_interface": None,
+ "share_address": None,
+ "updated_at": None,
+ "id": "34d5ae1e-5659-49cf-af80-73bccd7d7ad3",
+ "cidr_v6": None,
+ "deleted_at": None,
+ "gateway": None,
+ "rxtx_base": None,
+ "label": u'30d7',
+ "priority": None,
+ "project_id": None,
+ "vpn_private_address": None,
+ "deleted": None,
+ "vlan": None,
+ "broadcast": None,
+ "netmask": None,
+ "injected": None,
+ "cidr": None,
+ "vpn_public_address": None,
+ "multi_host": None,
+ "enable_dhcp": None,
+ "dns2": None,
+ "created_at": None,
+ "host": None,
+ "mtu": None,
+ "gateway_v6": None,
+ "netmask_v6": None,
+ "dhcp_server": None,
+ "dns1": None
+ }
+
+ network_id = "34d5ae1e-5659-49cf-af80-73bccd7d7ad3"
+
+ FAKE_NETWORKS = [FAKE_NETWORK]
+
+ def setUp(self):
+ super(TestNetworksClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = networks_client.NetworksClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_list_networks(self, bytes_body=False):
+ serialized_body = json.dumps({"networks": self.FAKE_NETWORKS})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.list_networks()
+ self.assertEqual(self.FAKE_NETWORKS, resp)
+
+ def test_list_networks_with_str_body(self):
+ self._test_list_networks()
+
+ def test_list_networks_with_bytes_body(self):
+ self._test_list_networks(bytes_body=True)
+
+ def _test_show_network(self, bytes_body=False):
+ serialized_body = json.dumps({"network": self.FAKE_NETWORK})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.show_network(self.network_id)
+ self.assertEqual(self.FAKE_NETWORK, resp)
+
+ def test_show_network_with_str_body(self):
+ self._test_show_network()
+
+ def test_show_network_with_bytes_body(self):
+ self._test_show_network(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_quotas_client.py b/tempest/tests/services/compute/test_quotas_client.py
new file mode 100644
index 0000000..a9bd0a1
--- /dev/null
+++ b/tempest/tests/services/compute/test_quotas_client.py
@@ -0,0 +1,106 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import copy
+import httplib2
+
+from oslo_serialization import jsonutils as json
+from oslotest import mockpatch
+
+from tempest.services.compute.json import quotas_client
+from tempest.tests import base
+from tempest.tests import fake_auth_provider
+
+
+class TestQuotasClient(base.TestCase):
+
+ FAKE_QUOTA_SET = {"injected_file_content_bytes": 10240,
+ "metadata_items": 128,
+ "server_group_members": 10,
+ "server_groups": 10,
+ "ram": 51200,
+ "floating_ips": 10,
+ "key_pairs": 100,
+ "id": "8421f7be61064f50b680465c07f334af",
+ "instances": 10,
+ "security_group_rules": 20,
+ "injected_files": 5,
+ "cores": 20,
+ "fixed_ips": -1,
+ "injected_file_path_bytes": 255,
+ "security_groups": 10}
+
+ project_id = "8421f7be61064f50b680465c07f334af"
+
+ def setUp(self):
+ super(TestQuotasClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = quotas_client.QuotasClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_show_quota_set(self, bytes_body=False):
+ serialized_body = json.dumps({"quota_set": self.FAKE_QUOTA_SET})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.show_quota_set(self.project_id)
+ self.assertEqual(self.FAKE_QUOTA_SET, resp)
+
+ def test_show_quota_set_with_str_body(self):
+ self._test_show_quota_set()
+
+ def test_show_quota_set_with_bytes_body(self):
+ self._test_show_quota_set(bytes_body=True)
+
+ def _test_show_default_quota_set(self, bytes_body=False):
+ serialized_body = json.dumps({"quota_set": self.FAKE_QUOTA_SET})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.show_default_quota_set(self.project_id)
+ self.assertEqual(self.FAKE_QUOTA_SET, resp)
+
+ def test_show_default_quota_set_with_str_body(self):
+ self._test_show_quota_set()
+
+ def test_show_default_quota_set_with_bytes_body(self):
+ self._test_show_quota_set(bytes_body=True)
+
+ def test_update_quota_set(self):
+ fake_quota_set = copy.deepcopy(self.FAKE_QUOTA_SET)
+ fake_quota_set.pop("id")
+ serialized_body = json.dumps({"quota_set": fake_quota_set})
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.put',
+ return_value=mocked_resp))
+ resp = self.client.update_quota_set(self.project_id)
+ self.assertEqual(fake_quota_set, resp)
+
+ def test_delete_quota_set(self):
+ expected = {}
+ mocked_resp = (httplib2.Response({'status': 202}), None)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.delete',
+ return_value=mocked_resp))
+ resp = self.client.delete_quota_set(self.project_id)
+ self.assertEqual(expected, resp)
diff --git a/tempest/tests/services/compute/test_services_client.py b/tempest/tests/services/compute/test_services_client.py
new file mode 100644
index 0000000..61ca830
--- /dev/null
+++ b/tempest/tests/services/compute/test_services_client.py
@@ -0,0 +1,106 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import copy
+import httplib2
+
+from oslo_serialization import jsonutils as json
+from oslotest import mockpatch
+
+from tempest.services.compute.json import services_client
+from tempest.tests import base
+from tempest.tests import fake_auth_provider
+
+
+class TestServicesClient(base.TestCase):
+
+ FAKE_SERVICES = [{
+ "status": "enabled",
+ "binary": "nova-conductor",
+ "zone": "internal",
+ "state": "up",
+ "updated_at": "2015-08-19T06:50:55.000000",
+ "host": "controller",
+ "disabled_reason": None,
+ "id": 1
+ }]
+
+ FAKE_SERVICE = {
+ "status": "enabled",
+ "binary": "nova-conductor",
+ "host": "controller"
+ }
+
+ def setUp(self):
+ super(TestServicesClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = services_client.ServicesClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_list_services(self, bytes_body=False):
+ serialized_body = json.dumps({"services": self.FAKE_SERVICES})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.get',
+ return_value=mocked_resp))
+ resp = self.client.list_services()
+ self.assertEqual(self.FAKE_SERVICES, resp)
+
+ def test_list_services_with_str_body(self):
+ self._test_list_services()
+
+ def test_list_services_with_bytes_body(self):
+ self._test_list_services(bytes_body=True)
+
+ def _test_enable_service(self, bytes_body=False):
+ serialized_body = json.dumps({"service": self.FAKE_SERVICE})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.put',
+ return_value=mocked_resp))
+ resp = self.client.enable_service("nova-conductor", "controller")
+ self.assertEqual(self.FAKE_SERVICE, resp)
+
+ def test_enable_service_with_str_body(self):
+ self._test_enable_service()
+
+ def test_enable_service_with_bytes_body(self):
+ self._test_enable_service(bytes_body=True)
+
+ def _test_disable_service(self, bytes_body=False):
+ fake_service = copy.deepcopy(self.FAKE_SERVICE)
+ fake_service["status"] = "disable"
+
+ serialized_body = json.dumps({"service": self.FAKE_SERVICE})
+ if bytes_body:
+ serialized_body = serialized_body.encode('utf-8')
+
+ mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.service_client.ServiceClient.put',
+ return_value=mocked_resp))
+ resp = self.client.disable_service("nova-conductor", "controller")
+ self.assertEqual(self.FAKE_SERVICE, resp)
+
+ def test_disable_service_with_str_body(self):
+ self._test_enable_service()
+
+ def test_disable_service_with_bytes_body(self):
+ self._test_enable_service(bytes_body=True)