Merge "olso log sync"
diff --git a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
index d69c43c..1031b24 100644
--- a/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
+++ b/tempest/api/compute/admin/test_simple_tenant_usage_negative.py
@@ -51,7 +51,6 @@
# Get usage for tenant with invalid date
params = {'start': self.end,
'end': self.start}
- resp, tenants = self.identity_client.list_tenants()
self.assertRaises(exceptions.BadRequest,
self.adm_client.get_tenant_usage,
self.client.tenant_id, params)
diff --git a/tempest/api/identity/admin/test_roles.py b/tempest/api/identity/admin/test_roles.py
index a29f27e..7a6d07f 100644
--- a/tempest/api/identity/admin/test_roles.py
+++ b/tempest/api/identity/admin/test_roles.py
@@ -29,7 +29,7 @@
super(RolesTestJSON, cls).setUpClass()
for _ in moves.xrange(5):
role_name = data_utils.rand_name(name='role-')
- resp, role = cls.client.create_role(role_name)
+ _, role = cls.client.create_role(role_name)
cls.data.roles.append(role)
def _get_role_params(self):
@@ -50,7 +50,7 @@
@test.attr(type='gate')
def test_list_roles(self):
# Return a list of all roles
- resp, body = self.client.list_roles()
+ _, body = self.client.list_roles()
found = [role for role in body if role in self.data.roles]
self.assertTrue(any(found))
self.assertEqual(len(found), len(self.data.roles))
@@ -59,18 +59,16 @@
def test_role_create_delete(self):
# Role should be created, verified, and deleted
role_name = data_utils.rand_name(name='role-test-')
- resp, body = self.client.create_role(role_name)
- self.assertEqual(200, resp.status)
+ _, body = self.client.create_role(role_name)
self.assertEqual(role_name, body['name'])
- resp, body = self.client.list_roles()
+ _, body = self.client.list_roles()
found = [role for role in body if role['name'] == role_name]
self.assertTrue(any(found))
- resp, body = self.client.delete_role(found[0]['id'])
- self.assertEqual(204, resp.status)
+ _, body = self.client.delete_role(found[0]['id'])
- resp, body = self.client.list_roles()
+ _, body = self.client.list_roles()
found = [role for role in body if role['name'] == role_name]
self.assertFalse(any(found))
@@ -80,9 +78,7 @@
self.data.setup_test_role()
role_id = self.data.role['id']
role_name = self.data.role['name']
- resp, body = self.client.get_role(role_id)
- self.assertIn('status', resp)
- self.assertTrue('200', resp['status'])
+ _, body = self.client.get_role(role_id)
self.assertEqual(role_id, body['id'])
self.assertEqual(role_name, body['name'])
@@ -91,25 +87,24 @@
# Assign a role to a user on a tenant
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
- resp, roles = self.client.list_user_roles(tenant['id'], user['id'])
+ _, roles = self.client.list_user_roles(tenant['id'], user['id'])
self.assert_role_in_role_list(role, roles)
@test.attr(type='gate')
def test_remove_user_role(self):
# Remove a role assigned to a user on a tenant
(user, tenant, role) = self._get_role_params()
- resp, user_role = self.client.assign_user_role(tenant['id'],
- user['id'], role['id'])
- resp, body = self.client.remove_user_role(tenant['id'], user['id'],
- user_role['id'])
- self.assertEqual(204, resp.status)
+ _, user_role = self.client.assign_user_role(tenant['id'],
+ user['id'], role['id'])
+ self.client.remove_user_role(tenant['id'], user['id'],
+ user_role['id'])
@test.attr(type='gate')
def test_list_user_roles(self):
# List roles assigned to a user on tenant
(user, tenant, role) = self._get_role_params()
self.client.assign_user_role(tenant['id'], user['id'], role['id'])
- resp, roles = self.client.list_user_roles(tenant['id'], user['id'])
+ _, roles = self.client.list_user_roles(tenant['id'], user['id'])
self.assert_role_in_role_list(role, roles)
diff --git a/tempest/api/identity/admin/test_roles_negative.py b/tempest/api/identity/admin/test_roles_negative.py
index 6f8f9b5..37a981e 100644
--- a/tempest/api/identity/admin/test_roles_negative.py
+++ b/tempest/api/identity/admin/test_roles_negative.py
@@ -72,9 +72,8 @@
def test_role_create_duplicate(self):
# Role names should be unique
role_name = data_utils.rand_name(name='role-dup-')
- resp, body = self.client.create_role(role_name)
+ _, body = self.client.create_role(role_name)
role1_id = body.get('id')
- self.assertEqual(200, resp.status)
self.addCleanup(self.client.delete_role, role1_id)
self.assertRaises(exceptions.Conflict, self.client.create_role,
role_name)
@@ -83,8 +82,7 @@
def test_delete_role_by_unauthorized_user(self):
# Non-administrator user should not be able to delete role
role_name = data_utils.rand_name(name='role-')
- resp, body = self.client.create_role(role_name)
- self.assertEqual(200, resp.status)
+ _, body = self.client.create_role(role_name)
self.data.roles.append(body)
role_id = body.get('id')
self.assertRaises(exceptions.Unauthorized,
@@ -94,8 +92,7 @@
def test_delete_role_request_without_token(self):
# Request to delete role without a valid token should fail
role_name = data_utils.rand_name(name='role-')
- resp, body = self.client.create_role(role_name)
- self.assertEqual(200, resp.status)
+ _, body = self.client.create_role(role_name)
self.data.roles.append(body)
role_id = body.get('id')
token = self.client.auth_provider.get_token()
diff --git a/tempest/api/identity/admin/test_services.py b/tempest/api/identity/admin/test_services.py
index 5926488..a9782a9 100644
--- a/tempest/api/identity/admin/test_services.py
+++ b/tempest/api/identity/admin/test_services.py
@@ -26,8 +26,7 @@
def _del_service(self, service_id):
# Deleting the service created in this method
- resp, _ = self.client.delete_service(service_id)
- self.assertEqual(204, resp.status)
+ self.client.delete_service(service_id)
# Checking whether service is deleted successfully
self.assertRaises(exceptions.NotFound, self.client.get_service,
service_id)
@@ -39,11 +38,10 @@
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
description = data_utils.rand_name('description-')
- resp, service_data = self.client.create_service(
+ _, service_data = self.client.create_service(
name, type, description=description)
self.assertFalse(service_data['id'] is None)
self.addCleanup(self._del_service, service_data['id'])
- self.assertEqual(200, resp.status)
# Verifying response body of create service
self.assertIn('id', service_data)
self.assertIn('name', service_data)
@@ -53,8 +51,7 @@
self.assertIn('description', service_data)
self.assertEqual(description, service_data['description'])
# Get service
- resp, fetched_service = self.client.get_service(service_data['id'])
- self.assertEqual(200, resp.status)
+ _, fetched_service = self.client.get_service(service_data['id'])
# verifying the existence of service created
self.assertIn('id', fetched_service)
self.assertEqual(fetched_service['id'], service_data['id'])
@@ -71,9 +68,8 @@
# Create a service only with name and type
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
- resp, service = self.client.create_service(name, type)
+ _, service = self.client.create_service(name, type)
self.assertIn('id', service)
- self.assertTrue('200', resp['status'])
self.addCleanup(self._del_service, service['id'])
self.assertIn('name', service)
self.assertEqual(name, service['name'])
@@ -88,7 +84,7 @@
name = data_utils.rand_name('service-')
type = data_utils.rand_name('type--')
description = data_utils.rand_name('description-')
- resp, service = self.client.create_service(
+ _, service = self.client.create_service(
name, type, description=description)
services.append(service)
service_ids = map(lambda x: x['id'], services)
@@ -99,8 +95,7 @@
self.addCleanup(delete_services)
# List and Verify Services
- resp, body = self.client.list_services()
- self.assertEqual(200, resp.status)
+ _, body = self.client.list_services()
found = [serv for serv in body if serv['id'] in service_ids]
self.assertEqual(len(found), len(services), 'Services not found')
diff --git a/tempest/api/identity/admin/test_tenant_negative.py b/tempest/api/identity/admin/test_tenant_negative.py
index 622ad81..dcfacee 100644
--- a/tempest/api/identity/admin/test_tenant_negative.py
+++ b/tempest/api/identity/admin/test_tenant_negative.py
@@ -42,8 +42,7 @@
def test_tenant_delete_by_unauthorized_user(self):
# Non-administrator user should not be able to delete a tenant
tenant_name = data_utils.rand_name(name='tenant-')
- resp, tenant = self.client.create_tenant(tenant_name)
- self.assertEqual(200, resp.status)
+ _, tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.delete_tenant, tenant['id'])
@@ -52,8 +51,7 @@
def test_tenant_delete_request_without_token(self):
# Request to delete a tenant without a valid token should fail
tenant_name = data_utils.rand_name(name='tenant-')
- resp, tenant = self.client.create_tenant(tenant_name)
- self.assertEqual(200, resp.status)
+ _, tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
@@ -71,8 +69,7 @@
def test_tenant_create_duplicate(self):
# Tenant names should be unique
tenant_name = data_utils.rand_name(name='tenant-')
- resp, body = self.client.create_tenant(tenant_name)
- self.assertEqual(200, resp.status)
+ _, body = self.client.create_tenant(tenant_name)
tenant = body
self.data.tenants.append(tenant)
tenant1_id = body.get('id')
@@ -122,8 +119,7 @@
def test_tenant_update_by_unauthorized_user(self):
# Non-administrator user should not be able to update a tenant
tenant_name = data_utils.rand_name(name='tenant-')
- resp, tenant = self.client.create_tenant(tenant_name)
- self.assertEqual(200, resp.status)
+ _, tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
self.assertRaises(exceptions.Unauthorized,
self.non_admin_client.update_tenant, tenant['id'])
@@ -132,8 +128,7 @@
def test_tenant_update_request_without_token(self):
# Request to update a tenant without a valid token should fail
tenant_name = data_utils.rand_name(name='tenant-')
- resp, tenant = self.client.create_tenant(tenant_name)
- self.assertEqual(200, resp.status)
+ _, tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
diff --git a/tempest/api/identity/admin/test_tenants.py b/tempest/api/identity/admin/test_tenants.py
index 93734d2..8d3b402 100644
--- a/tempest/api/identity/admin/test_tenants.py
+++ b/tempest/api/identity/admin/test_tenants.py
@@ -29,22 +29,19 @@
tenants = []
for _ in moves.xrange(3):
tenant_name = data_utils.rand_name(name='tenant-new')
- resp, tenant = self.client.create_tenant(tenant_name)
- self.assertEqual(200, resp.status)
+ _, tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
tenants.append(tenant)
tenant_ids = map(lambda x: x['id'], tenants)
- resp, body = self.client.list_tenants()
- self.assertEqual(200, resp.status)
+ _, body = self.client.list_tenants()
found = [t for t in body if t['id'] in tenant_ids]
self.assertEqual(len(found), len(tenants), 'Tenants not created')
for tenant in tenants:
- resp, body = self.client.delete_tenant(tenant['id'])
- self.assertEqual(204, resp.status)
+ self.client.delete_tenant(tenant['id'])
self.data.tenants.remove(tenant)
- resp, body = self.client.list_tenants()
+ _, body = self.client.list_tenants()
found = [tenant for tenant in body if tenant['id'] in tenant_ids]
self.assertFalse(any(found), 'Tenants failed to delete')
@@ -53,16 +50,15 @@
# Create tenant with a description
tenant_name = data_utils.rand_name(name='tenant-')
tenant_desc = data_utils.rand_name(name='desc-')
- resp, body = self.client.create_tenant(tenant_name,
- description=tenant_desc)
+ _, body = self.client.create_tenant(tenant_name,
+ description=tenant_desc)
tenant = body
self.data.tenants.append(tenant)
tenant_id = body['id']
desc1 = body['description']
- self.assertEqual(200, resp.status)
self.assertEqual(desc1, tenant_desc, 'Description should have '
'been sent in response for create')
- resp, body = self.client.get_tenant(tenant_id)
+ _, body = self.client.get_tenant(tenant_id)
desc2 = body['description']
self.assertEqual(desc2, tenant_desc, 'Description does not appear'
'to be set')
@@ -73,14 +69,13 @@
def test_tenant_create_enabled(self):
# Create a tenant that is enabled
tenant_name = data_utils.rand_name(name='tenant-')
- resp, body = self.client.create_tenant(tenant_name, enabled=True)
+ _, body = self.client.create_tenant(tenant_name, enabled=True)
tenant = body
self.data.tenants.append(tenant)
tenant_id = body['id']
en1 = body['enabled']
- self.assertEqual(200, resp.status)
self.assertTrue(en1, 'Enable should be True in response')
- resp, body = self.client.get_tenant(tenant_id)
+ _, body = self.client.get_tenant(tenant_id)
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
self.client.delete_tenant(tenant_id)
@@ -90,15 +85,14 @@
def test_tenant_create_not_enabled(self):
# Create a tenant that is not enabled
tenant_name = data_utils.rand_name(name='tenant-')
- resp, body = self.client.create_tenant(tenant_name, enabled=False)
+ _, body = self.client.create_tenant(tenant_name, enabled=False)
tenant = body
self.data.tenants.append(tenant)
tenant_id = body['id']
en1 = body['enabled']
- self.assertEqual(200, resp.status)
self.assertEqual('false', str(en1).lower(),
'Enable should be False in response')
- resp, body = self.client.get_tenant(tenant_id)
+ _, body = self.client.get_tenant(tenant_id)
en2 = body['enabled']
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
@@ -109,8 +103,7 @@
def test_tenant_update_name(self):
# Update name attribute of a tenant
t_name1 = data_utils.rand_name(name='tenant-')
- resp, body = self.client.create_tenant(t_name1)
- self.assertEqual(200, resp.status)
+ _, body = self.client.create_tenant(t_name1)
tenant = body
self.data.tenants.append(tenant)
@@ -118,12 +111,11 @@
resp1_name = body['name']
t_name2 = data_utils.rand_name(name='tenant2-')
- resp, body = self.client.update_tenant(t_id, name=t_name2)
+ _, body = self.client.update_tenant(t_id, name=t_name2)
resp2_name = body['name']
- self.assertEqual(200, resp.status)
self.assertNotEqual(resp1_name, resp2_name)
- resp, body = self.client.get_tenant(t_id)
+ _, body = self.client.get_tenant(t_id)
resp3_name = body['name']
self.assertNotEqual(resp1_name, resp3_name)
@@ -138,8 +130,7 @@
# Update description attribute of a tenant
t_name = data_utils.rand_name(name='tenant-')
t_desc = data_utils.rand_name(name='desc-')
- resp, body = self.client.create_tenant(t_name, description=t_desc)
- self.assertEqual(200, resp.status)
+ _, body = self.client.create_tenant(t_name, description=t_desc)
tenant = body
self.data.tenants.append(tenant)
@@ -147,12 +138,11 @@
resp1_desc = body['description']
t_desc2 = data_utils.rand_name(name='desc2-')
- resp, body = self.client.update_tenant(t_id, description=t_desc2)
+ _, body = self.client.update_tenant(t_id, description=t_desc2)
resp2_desc = body['description']
- self.assertEqual(200, resp.status)
self.assertNotEqual(resp1_desc, resp2_desc)
- resp, body = self.client.get_tenant(t_id)
+ _, body = self.client.get_tenant(t_id)
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
@@ -167,8 +157,7 @@
# Update the enabled attribute of a tenant
t_name = data_utils.rand_name(name='tenant-')
t_en = False
- resp, body = self.client.create_tenant(t_name, enabled=t_en)
- self.assertEqual(200, resp.status)
+ _, body = self.client.create_tenant(t_name, enabled=t_en)
tenant = body
self.data.tenants.append(tenant)
@@ -176,12 +165,11 @@
resp1_en = body['enabled']
t_en2 = True
- resp, body = self.client.update_tenant(t_id, enabled=t_en2)
+ _, body = self.client.update_tenant(t_id, enabled=t_en2)
resp2_en = body['enabled']
- self.assertEqual(200, resp.status)
self.assertNotEqual(resp1_en, resp2_en)
- resp, body = self.client.get_tenant(t_id)
+ _, body = self.client.get_tenant(t_id)
resp3_en = body['enabled']
self.assertNotEqual(resp1_en, resp3_en)
diff --git a/tempest/api/identity/admin/test_tokens.py b/tempest/api/identity/admin/test_tokens.py
index 08e12f0..e1db008 100644
--- a/tempest/api/identity/admin/test_tokens.py
+++ b/tempest/api/identity/admin/test_tokens.py
@@ -28,13 +28,11 @@
user_password = data_utils.rand_name(name='pass-')
# first:create a tenant
tenant_name = data_utils.rand_name(name='tenant-')
- resp, tenant = self.client.create_tenant(tenant_name)
- self.assertEqual(200, resp.status)
+ _, tenant = self.client.create_tenant(tenant_name)
self.data.tenants.append(tenant)
# second:create a user
- resp, user = self.client.create_user(user_name, user_password,
- tenant['id'], '')
- self.assertEqual(200, resp.status)
+ _, user = self.client.create_user(user_name, user_password,
+ tenant['id'], '')
self.data.users.append(user)
# then get a token for the user
rsp, body = self.token_client.auth(user_name,
@@ -45,16 +43,14 @@
tenant['name'])
# Perform GET Token
token_id = body['token']['id']
- resp, token_details = self.client.get_token(token_id)
- self.assertEqual(resp['status'], '200')
+ _, token_details = self.client.get_token(token_id)
self.assertEqual(token_id, token_details['token']['id'])
self.assertEqual(user['id'], token_details['user']['id'])
self.assertEqual(user_name, token_details['user']['name'])
self.assertEqual(tenant['name'],
token_details['token']['tenant']['name'])
# then delete the token
- resp, body = self.client.delete_token(token_id)
- self.assertEqual(resp['status'], '204')
+ self.client.delete_token(token_id)
@test.attr(type='gate')
def test_rescope_token(self):
@@ -67,56 +63,51 @@
user_password = data_utils.rand_name(name='pass-')
tenant_id = None # No default tenant so will get unscoped token.
email = ''
- resp, user = self.client.create_user(user_name, user_password,
- tenant_id, email)
- self.assertEqual(200, resp.status)
+ _, user = self.client.create_user(user_name, user_password,
+ tenant_id, email)
self.data.users.append(user)
# Create a couple tenants.
tenant1_name = data_utils.rand_name(name='tenant-')
- resp, tenant1 = self.client.create_tenant(tenant1_name)
- self.assertEqual(200, resp.status)
+ _, tenant1 = self.client.create_tenant(tenant1_name)
self.data.tenants.append(tenant1)
tenant2_name = data_utils.rand_name(name='tenant-')
- resp, tenant2 = self.client.create_tenant(tenant2_name)
- self.assertEqual(200, resp.status)
+ _, tenant2 = self.client.create_tenant(tenant2_name)
self.data.tenants.append(tenant2)
# Create a role
role_name = data_utils.rand_name(name='role-')
- resp, role = self.client.create_role(role_name)
- self.assertEqual(200, resp.status)
+ _, role = self.client.create_role(role_name)
self.data.roles.append(role)
# Grant the user the role on the tenants.
- resp, _ = self.client.assign_user_role(tenant1['id'], user['id'],
- role['id'])
- self.assertEqual(200, resp.status)
+ self.client.assign_user_role(tenant1['id'], user['id'],
+ role['id'])
- resp, _ = self.client.assign_user_role(tenant2['id'], user['id'],
- role['id'])
- self.assertEqual(200, resp.status)
+ self.client.assign_user_role(tenant2['id'], user['id'],
+ role['id'])
# Get an unscoped token.
- rsp, body = self.token_client.auth(user_name, user_password)
+ resp, body = self.token_client.auth(user_name, user_password)
self.assertEqual(200, resp.status)
token_id = body['token']['id']
# Use the unscoped token to get a token scoped to tenant1
- rsp, body = self.token_client.auth_token(token_id, tenant=tenant1_name)
+ resp, body = self.token_client.auth_token(token_id,
+ tenant=tenant1_name)
self.assertEqual(200, resp.status)
scoped_token_id = body['token']['id']
# Revoke the scoped token
- resp, body = self.client.delete_token(scoped_token_id)
- self.assertEqual(204, resp.status)
+ self.client.delete_token(scoped_token_id)
# Use the unscoped token to get a token scoped to tenant2
- rsp, body = self.token_client.auth_token(token_id, tenant=tenant2_name)
- self.assertEqual(204, resp.status)
+ resp, body = self.token_client.auth_token(token_id,
+ tenant=tenant2_name)
+ self.assertEqual(200, resp.status)
class TokensTestXML(TokensTestJSON):
diff --git a/tempest/api/identity/admin/test_users.py b/tempest/api/identity/admin/test_users.py
index e2c1066..5838da3 100644
--- a/tempest/api/identity/admin/test_users.py
+++ b/tempest/api/identity/admin/test_users.py
@@ -34,11 +34,10 @@
def test_create_user(self):
# Create a user
self.data.setup_test_tenant()
- resp, user = self.client.create_user(self.alt_user, self.alt_password,
- self.data.tenant['id'],
- self.alt_email)
+ _, user = self.client.create_user(self.alt_user, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email)
self.data.users.append(user)
- self.assertEqual('200', resp['status'])
self.assertEqual(self.alt_user, user['name'])
@test.attr(type='smoke')
@@ -46,11 +45,10 @@
# Create a user with enabled : False
self.data.setup_test_tenant()
name = data_utils.rand_name('test_user_')
- resp, user = self.client.create_user(name, self.alt_password,
- self.data.tenant['id'],
- self.alt_email, enabled=False)
+ _, user = self.client.create_user(name, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email, enabled=False)
self.data.users.append(user)
- self.assertEqual('200', resp['status'])
self.assertEqual(name, user['name'])
self.assertEqual('false', str(user['enabled']).lower())
self.assertEqual(self.alt_email, user['email'])
@@ -60,24 +58,22 @@
# Test case to check if updating of user attributes is successful.
test_user = data_utils.rand_name('test_user_')
self.data.setup_test_tenant()
- resp, user = self.client.create_user(test_user, self.alt_password,
- self.data.tenant['id'],
- self.alt_email)
+ _, user = self.client.create_user(test_user, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email)
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user['id'])
# Updating user details with new values
u_name2 = data_utils.rand_name('user2-')
u_email2 = u_name2 + '@testmail.tm'
- resp, update_user = self.client.update_user(user['id'], name=u_name2,
- email=u_email2,
- enabled=False)
- # Assert response body of update user.
- self.assertEqual(200, resp.status)
+ _, update_user = self.client.update_user(user['id'], name=u_name2,
+ email=u_email2,
+ enabled=False)
self.assertEqual(u_name2, update_user['name'])
self.assertEqual(u_email2, update_user['email'])
self.assertEqual('false', str(update_user['enabled']).lower())
# GET by id after updating
- resp, updated_user = self.client.get_user(user['id'])
+ _, updated_user = self.client.get_user(user['id'])
# Assert response body of GET after updating
self.assertEqual(u_name2, updated_user['name'])
self.assertEqual(u_email2, updated_user['email'])
@@ -88,12 +84,10 @@
# Delete a user
test_user = data_utils.rand_name('test_user_')
self.data.setup_test_tenant()
- resp, user = self.client.create_user(test_user, self.alt_password,
- self.data.tenant['id'],
- self.alt_email)
- self.assertEqual('200', resp['status'])
- resp, body = self.client.delete_user(user['id'])
- self.assertEqual('204', resp['status'])
+ _, user = self.client.create_user(test_user, self.alt_password,
+ self.data.tenant['id'],
+ self.alt_email)
+ self.client.delete_user(user['id'])
@test.attr(type='smoke')
def test_user_authentication(self):
@@ -129,7 +123,7 @@
def test_get_users(self):
# Get a list of users and find the test user
self.data.setup_test_user()
- resp, users = self.client.get_users()
+ _, users = self.client.get_users()
self.assertThat([u['name'] for u in users],
matchers.Contains(self.data.test_user),
"Could not find %s" % self.data.test_user)
@@ -141,23 +135,20 @@
user_ids = list()
fetched_user_ids = list()
alt_tenant_user1 = data_utils.rand_name('tenant_user1_')
- resp, user1 = self.client.create_user(alt_tenant_user1, 'password1',
- self.data.tenant['id'],
- 'user1@123')
- self.assertEqual('200', resp['status'])
+ _, user1 = self.client.create_user(alt_tenant_user1, 'password1',
+ self.data.tenant['id'],
+ 'user1@123')
user_ids.append(user1['id'])
self.data.users.append(user1)
alt_tenant_user2 = data_utils.rand_name('tenant_user2_')
- resp, user2 = self.client.create_user(alt_tenant_user2, 'password2',
- self.data.tenant['id'],
- 'user2@123')
- self.assertEqual('200', resp['status'])
+ _, user2 = self.client.create_user(alt_tenant_user2, 'password2',
+ self.data.tenant['id'],
+ 'user2@123')
user_ids.append(user2['id'])
self.data.users.append(user2)
# List of users for the respective tenant ID
- resp, body = self.client.list_users_for_tenant(self.data.tenant['id'])
- self.assertIn(resp['status'], ('200', '203'))
+ _, body = self.client.list_users_for_tenant(self.data.tenant['id'])
for i in body:
fetched_user_ids.append(i['id'])
# verifying the user Id in the list
@@ -179,24 +170,20 @@
user_ids = list()
fetched_user_ids = list()
user_ids.append(user['id'])
- resp, role = self.client.assign_user_role(tenant['id'], user['id'],
- role['id'])
- self.assertEqual('200', resp['status'])
+ _, role = self.client.assign_user_role(tenant['id'], user['id'],
+ role['id'])
alt_user2 = data_utils.rand_name('second_user_')
- resp, second_user = self.client.create_user(alt_user2, 'password1',
- self.data.tenant['id'],
- 'user2@123')
- self.assertEqual('200', resp['status'])
+ _, second_user = self.client.create_user(alt_user2, 'password1',
+ self.data.tenant['id'],
+ 'user2@123')
user_ids.append(second_user['id'])
self.data.users.append(second_user)
- resp, role = self.client.assign_user_role(tenant['id'],
- second_user['id'],
- role['id'])
- self.assertEqual('200', resp['status'])
+ _, role = self.client.assign_user_role(tenant['id'],
+ second_user['id'],
+ role['id'])
# List of users with roles for the respective tenant ID
- resp, body = self.client.list_users_for_tenant(self.data.tenant['id'])
- self.assertEqual('200', resp['status'])
+ _, body = self.client.list_users_for_tenant(self.data.tenant['id'])
for i in body:
fetched_user_ids.append(i['id'])
# verifying the user Id in the list
@@ -212,10 +199,8 @@
self.data.setup_test_user()
# Updating the user with new password
new_pass = data_utils.rand_name('pass-')
- resp, update_user = self.client.update_user_password(
+ _, update_user = self.client.update_user_password(
self.data.user['id'], new_pass)
- # Assert response body of update user.
- self.assertEqual(200, resp.status)
self.assertEqual(update_user['id'], self.data.user['id'])
# Validate the updated password
diff --git a/tempest/api/identity/admin/v3/test_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py
index 6bb0ebe..d40e0f3 100644
--- a/tempest/api/identity/admin/v3/test_credentials.py
+++ b/tempest/api/identity/admin/v3/test_credentials.py
@@ -33,28 +33,20 @@
u_email = '%s@testmail.tm' % u_name
u_password = data_utils.rand_name('pass-')
for i in range(2):
- resp, cls.project = cls.client.create_project(
+ _, cls.project = cls.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
- assert resp['status'] == '201', (
- "Expected 201, but got: %s" % resp['status'])
cls.projects.append(cls.project['id'])
- resp, cls.user_body = cls.client.create_user(
+ _, cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, project_id=cls.projects[0])
- assert resp['status'] == '201', (
- "Expected 201, but got: %s" % resp['status'])
@classmethod
def tearDownClass(cls):
- resp, _ = cls.client.delete_user(cls.user_body['id'])
- assert resp['status'] == '204', (
- "Expected 204, but got: %s" % resp['status'])
+ cls.client.delete_user(cls.user_body['id'])
for p in cls.projects:
- resp, _ = cls.client.delete_project(p)
- assert resp['status'] == '204', (
- "Expected 204, but got: %s" % resp['status'])
+ cls.client.delete_project(p)
super(CredentialsTestJSON, cls).tearDownClass()
def _delete_credential(self, cred_id):
diff --git a/tempest/api/identity/admin/v3/test_domains.py b/tempest/api/identity/admin/v3/test_domains.py
index a1e6cde..5b73df1 100644
--- a/tempest/api/identity/admin/v3/test_domains.py
+++ b/tempest/api/identity/admin/v3/test_domains.py
@@ -25,9 +25,8 @@
def _delete_domain(self, domain_id):
# It is necessary to disable the domain before deleting,
# or else it would result in unauthorized error
- _, body = self.client.update_domain(domain_id, enabled=False)
- resp, _ = self.client.delete_domain(domain_id)
- self.assertEqual(204, resp.status)
+ self.client.update_domain(domain_id, enabled=False)
+ self.client.delete_domain(domain_id)
@test.attr(type='smoke')
def test_list_domains(self):
@@ -42,8 +41,7 @@
self.addCleanup(self._delete_domain, domain['id'])
domain_ids.append(domain['id'])
# List and Verify Domains
- resp, body = self.client.list_domains()
- self.assertEqual(resp['status'], '200')
+ _, body = self.client.list_domains()
for d in body:
fetched_ids.append(d['id'])
missing_doms = [d for d in domain_ids if d not in fetched_ids]
@@ -53,9 +51,8 @@
def test_create_update_delete_domain(self):
d_name = data_utils.rand_name('domain-')
d_desc = data_utils.rand_name('domain-desc-')
- resp_1, domain = self.client.create_domain(
+ _, domain = self.client.create_domain(
d_name, description=d_desc)
- self.assertEqual(resp_1['status'], '201')
self.addCleanup(self._delete_domain, domain['id'])
self.assertIn('id', domain)
self.assertIn('description', domain)
@@ -72,9 +69,8 @@
new_desc = data_utils.rand_name('new-desc-')
new_name = data_utils.rand_name('new-name-')
- resp_2, updated_domain = self.client.update_domain(
+ _, updated_domain = self.client.update_domain(
domain['id'], name=new_name, description=new_desc)
- self.assertEqual(resp_2['status'], '200')
self.assertIn('id', updated_domain)
self.assertIn('description', updated_domain)
self.assertIn('name', updated_domain)
@@ -85,8 +81,7 @@
self.assertEqual(new_desc, updated_domain['description'])
self.assertEqual('true', str(updated_domain['enabled']).lower())
- resp_3, fetched_domain = self.client.get_domain(domain['id'])
- self.assertEqual(resp_3['status'], '200')
+ _, fetched_domain = self.client.get_domain(domain['id'])
self.assertEqual(new_name, fetched_domain['name'])
self.assertEqual(new_desc, fetched_domain['description'])
self.assertEqual('true', str(fetched_domain['enabled']).lower())
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index 881f69e..1548f89 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -31,7 +31,7 @@
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
- resp, cls.service_data =\
+ _, cls.service_data =\
cls.service_client.create_service(s_name, s_type,
description=s_description)
cls.service_id = cls.service_data['id']
@@ -108,7 +108,7 @@
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
- resp, service2 =\
+ _, service2 =\
self.service_client.create_service(s_name, s_type,
description=s_description)
self.service_ids.append(service2['id'])
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index 5b46f89..1d63cce 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -33,7 +33,7 @@
s_name = data_utils.rand_name('service-')
s_type = data_utils.rand_name('type--')
s_description = data_utils.rand_name('description-')
- resp, cls.service_data = (
+ _, cls.service_data = (
cls.service_client.create_service(s_name, s_type,
description=s_description))
cls.service_id = cls.service_data['id']
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index 056f713..4d2cc46 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -29,24 +29,21 @@
def test_group_create_update_get(self):
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
- resp, group = self.client.create_group(name,
- description=description)
+ _, group = self.client.create_group(name,
+ description=description)
self.addCleanup(self.client.delete_group, group['id'])
- self.assertEqual(resp['status'], '201')
self.assertEqual(group['name'], name)
self.assertEqual(group['description'], description)
new_name = data_utils.rand_name('UpdateGroup')
new_desc = data_utils.rand_name('UpdateDescription')
- resp, updated_group = self.client.update_group(group['id'],
- name=new_name,
- description=new_desc)
- self.assertEqual(resp['status'], '200')
+ _, updated_group = self.client.update_group(group['id'],
+ name=new_name,
+ description=new_desc)
self.assertEqual(updated_group['name'], new_name)
self.assertEqual(updated_group['description'], new_desc)
- resp, new_group = self.client.get_group(group['id'])
- self.assertEqual(resp['status'], '200')
+ _, new_group = self.client.get_group(group['id'])
self.assertEqual(group['id'], new_group['id'])
self.assertEqual(new_name, new_group['name'])
self.assertEqual(new_desc, new_group['description'])
@@ -54,33 +51,31 @@
@test.attr(type='smoke')
def test_group_users_add_list_delete(self):
name = data_utils.rand_name('Group')
- resp, group = self.client.create_group(name)
+ _, group = self.client.create_group(name)
self.addCleanup(self.client.delete_group, group['id'])
# add user into group
users = []
for i in range(3):
name = data_utils.rand_name('User')
- resp, user = self.client.create_user(name)
+ _, user = self.client.create_user(name)
users.append(user)
self.addCleanup(self.client.delete_user, user['id'])
self.client.add_group_user(group['id'], user['id'])
# list users in group
- resp, group_users = self.client.list_group_users(group['id'])
- self.assertEqual(resp['status'], '200')
+ _, group_users = self.client.list_group_users(group['id'])
self.assertEqual(sorted(users), sorted(group_users))
# delete user in group
for user in users:
- resp, body = self.client.delete_group_user(group['id'],
- user['id'])
- self.assertEqual(resp['status'], '204')
- resp, group_users = self.client.list_group_users(group['id'])
+ self.client.delete_group_user(group['id'],
+ user['id'])
+ _, group_users = self.client.list_group_users(group['id'])
self.assertEqual(len(group_users), 0)
@test.attr(type='smoke')
def test_list_user_groups(self):
# create a user
- resp, user = self.client.create_user(
+ _, user = self.client.create_user(
data_utils.rand_name('User-'),
password=data_utils.rand_name('Pass-'))
self.addCleanup(self.client.delete_user, user['id'])
@@ -88,13 +83,12 @@
groups = []
for i in range(2):
name = data_utils.rand_name('Group-')
- resp, group = self.client.create_group(name)
+ _, group = self.client.create_group(name)
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
- resp, user_groups = self.client.list_user_groups(user['id'])
- self.assertEqual('200', resp['status'])
+ _, user_groups = self.client.list_user_groups(user['id'])
self.assertEqual(sorted(groups), sorted(user_groups))
self.assertEqual(2, len(user_groups))
diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py
index 79717b1..77acd57 100644
--- a/tempest/api/identity/admin/v3/test_projects.py
+++ b/tempest/api/identity/admin/v3/test_projects.py
@@ -25,8 +25,7 @@
_interface = 'json'
def _delete_project(self, project_id):
- resp, _ = self.client.delete_project(project_id)
- self.assertEqual(resp['status'], '204')
+ self.client.delete_project(project_id)
self.assertRaises(
exceptions.NotFound, self.client.get_project, project_id)
@@ -34,14 +33,13 @@
def test_project_list_delete(self):
# Create several projects and delete them
for _ in moves.xrange(3):
- resp, project = self.client.create_project(
+ _, project = self.client.create_project(
data_utils.rand_name('project-new'))
self.addCleanup(self._delete_project, project['id'])
- resp, list_projects = self.client.list_projects()
- self.assertEqual(resp['status'], '200')
+ _, list_projects = self.client.list_projects()
- resp, get_project = self.client.get_project(project['id'])
+ _, get_project = self.client.get_project(project['id'])
self.assertIn(get_project, list_projects)
@test.attr(type='gate')
@@ -49,16 +47,14 @@
# Create project with a description
project_name = data_utils.rand_name('project-')
project_desc = data_utils.rand_name('desc-')
- resp, project = self.client.create_project(
+ _, project = self.client.create_project(
project_name, description=project_desc)
self.data.projects.append(project)
- st1 = resp['status']
project_id = project['id']
desc1 = project['description']
- self.assertEqual(st1, '201')
self.assertEqual(desc1, project_desc, 'Description should have '
'been sent in response for create')
- resp, body = self.client.get_project(project_id)
+ _, body = self.client.get_project(project_id)
desc2 = body['description']
self.assertEqual(desc2, project_desc, 'Description does not appear'
'to be set')
@@ -67,15 +63,13 @@
def test_project_create_enabled(self):
# Create a project that is enabled
project_name = data_utils.rand_name('project-')
- resp, project = self.client.create_project(
+ _, project = self.client.create_project(
project_name, enabled=True)
self.data.projects.append(project)
project_id = project['id']
- st1 = resp['status']
en1 = project['enabled']
- self.assertEqual(st1, '201')
self.assertTrue(en1, 'Enable should be True in response')
- resp, body = self.client.get_project(project_id)
+ _, body = self.client.get_project(project_id)
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
@@ -83,15 +77,13 @@
def test_project_create_not_enabled(self):
# Create a project that is not enabled
project_name = data_utils.rand_name('project-')
- resp, project = self.client.create_project(
+ _, project = self.client.create_project(
project_name, enabled=False)
self.data.projects.append(project)
- st1 = resp['status']
en1 = project['enabled']
- self.assertEqual(st1, '201')
self.assertEqual('false', str(en1).lower(),
'Enable should be False in response')
- resp, body = self.client.get_project(project['id'])
+ _, body = self.client.get_project(project['id'])
en2 = body['enabled']
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
@@ -100,19 +92,17 @@
def test_project_update_name(self):
# Update name attribute of a project
p_name1 = data_utils.rand_name('project-')
- resp, project = self.client.create_project(p_name1)
+ _, project = self.client.create_project(p_name1)
self.data.projects.append(project)
resp1_name = project['name']
p_name2 = data_utils.rand_name('project2-')
- resp, body = self.client.update_project(project['id'], name=p_name2)
- st2 = resp['status']
+ _, body = self.client.update_project(project['id'], name=p_name2)
resp2_name = body['name']
- self.assertEqual(st2, '200')
self.assertNotEqual(resp1_name, resp2_name)
- resp, body = self.client.get_project(project['id'])
+ _, body = self.client.get_project(project['id'])
resp3_name = body['name']
self.assertNotEqual(resp1_name, resp3_name)
@@ -124,20 +114,18 @@
# Update description attribute of a project
p_name = data_utils.rand_name('project-')
p_desc = data_utils.rand_name('desc-')
- resp, project = self.client.create_project(
+ _, project = self.client.create_project(
p_name, description=p_desc)
self.data.projects.append(project)
resp1_desc = project['description']
p_desc2 = data_utils.rand_name('desc2-')
- resp, body = self.client.update_project(
+ _, body = self.client.update_project(
project['id'], description=p_desc2)
- st2 = resp['status']
resp2_desc = body['description']
- self.assertEqual(st2, '200')
self.assertNotEqual(resp1_desc, resp2_desc)
- resp, body = self.client.get_project(project['id'])
+ _, body = self.client.get_project(project['id'])
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
@@ -149,20 +137,18 @@
# Update the enabled attribute of a project
p_name = data_utils.rand_name('project-')
p_en = False
- resp, project = self.client.create_project(p_name, enabled=p_en)
+ _, project = self.client.create_project(p_name, enabled=p_en)
self.data.projects.append(project)
resp1_en = project['enabled']
p_en2 = True
- resp, body = self.client.update_project(
+ _, body = self.client.update_project(
project['id'], enabled=p_en2)
- st2 = resp['status']
resp2_en = body['enabled']
- self.assertEqual(st2, '200')
self.assertNotEqual(resp1_en, resp2_en)
- resp, body = self.client.get_project(project['id'])
+ _, body = self.client.get_project(project['id'])
resp3_en = body['enabled']
self.assertNotEqual(resp1_en, resp3_en)
@@ -174,7 +160,7 @@
# Associate a user to a project
# Create a Project
p_name = data_utils.rand_name('project-')
- resp, project = self.client.create_project(p_name)
+ _, project = self.client.create_project(p_name)
self.data.projects.append(project)
# Create a User
@@ -182,15 +168,14 @@
u_desc = u_name + 'description'
u_email = u_name + '@testmail.tm'
u_password = data_utils.rand_name('pass-')
- resp, user = self.client.create_user(
+ _, user = self.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, project_id=project['id'])
- self.assertEqual(resp['status'], '201')
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user['id'])
# Get User To validate the user details
- resp, new_user_get = self.client.get_user(user['id'])
+ _, new_user_get = self.client.get_user(user['id'])
# 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 6b60d04..9e8f613 100644
--- a/tempest/api/identity/admin/v3/test_projects_negative.py
+++ b/tempest/api/identity/admin/v3/test_projects_negative.py
@@ -32,7 +32,7 @@
def test_project_create_duplicate(self):
# Project names should be unique
project_name = data_utils.rand_name('project-dup-')
- resp, project = self.client.create_project(project_name)
+ _, project = self.client.create_project(project_name)
self.data.projects.append(project)
self.assertRaises(
@@ -63,7 +63,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-')
- resp, project = self.client.create_project(project_name)
+ _, project = self.client.create_project(project_name)
self.data.projects.append(project)
self.assertRaises(
exceptions.Unauthorized, 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 03974e4..c8b034f 100644
--- a/tempest/api/identity/admin/v3/test_regions.py
+++ b/tempest/api/identity/admin/v3/test_regions.py
@@ -1,4 +1,4 @@
-# Copyright 2014 OpenStack Foundation
+# Copyright 2014 Hewlett-Packard Development Company, L.P
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index b680b64..2e732fe 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -34,126 +34,108 @@
u_desc = '%s description' % u_name
u_email = '%s@testmail.tm' % u_name
cls.u_password = data_utils.rand_name('pass-')
- resp = [None] * 5
- resp[0], cls.domain = cls.client.create_domain(
+ _, cls.domain = cls.client.create_domain(
data_utils.rand_name('domain-'),
description=data_utils.rand_name('domain-desc-'))
- resp[1], cls.project = cls.client.create_project(
+ _, cls.project = cls.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'),
domain_id=cls.domain['id'])
- resp[2], cls.group_body = cls.client.create_group(
+ _, cls.group_body = cls.client.create_group(
data_utils.rand_name('Group-'), project_id=cls.project['id'],
domain_id=cls.domain['id'])
- resp[3], cls.user_body = cls.client.create_user(
+ _, 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'])
- resp[4], cls.role = cls.client.create_role(
+ _, cls.role = cls.client.create_role(
data_utils.rand_name('Role-'))
- for r in resp:
- assert r['status'] == '201', (
- "Expected 201, but got: %s" % r['status'])
@classmethod
def tearDownClass(cls):
- resp = [None] * 5
- resp[0], _ = cls.client.delete_role(cls.role['id'])
- resp[1], _ = cls.client.delete_group(cls.group_body['id'])
- resp[2], _ = cls.client.delete_user(cls.user_body['id'])
- resp[3], _ = cls.client.delete_project(cls.project['id'])
+ cls.client.delete_role(cls.role['id'])
+ cls.client.delete_group(cls.group_body['id'])
+ cls.client.delete_user(cls.user_body['id'])
+ cls.client.delete_project(cls.project['id'])
# NOTE(harika-vakadi): It is necessary to disable the domain
# before deleting,or else it would result in unauthorized error
cls.client.update_domain(cls.domain['id'], enabled=False)
- resp[4], _ = cls.client.delete_domain(cls.domain['id'])
- for r in resp:
- assert r['status'] == '204', (
- "Expected 204, but got: %s" % r['status'])
+ cls.client.delete_domain(cls.domain['id'])
super(RolesV3TestJSON, cls).tearDownClass()
- def _list_assertions(self, resp, body, fetched_role_ids, role_id):
- self.assertEqual(resp['status'], '200')
+ def _list_assertions(self, body, fetched_role_ids, role_id):
self.assertEqual(len(body), 1)
self.assertIn(role_id, fetched_role_ids)
@test.attr(type='smoke')
def test_role_create_update_get_list(self):
r_name = data_utils.rand_name('Role-')
- resp, role = self.client.create_role(r_name)
+ _, role = self.client.create_role(r_name)
self.addCleanup(self.client.delete_role, role['id'])
- self.assertEqual(resp['status'], '201')
self.assertIn('name', role)
self.assertEqual(role['name'], r_name)
new_name = data_utils.rand_name('NewRole-')
- resp, updated_role = self.client.update_role(new_name, role['id'])
- self.assertEqual(resp['status'], '200')
+ _, updated_role = self.client.update_role(new_name, role['id'])
self.assertIn('name', updated_role)
self.assertIn('id', updated_role)
self.assertIn('links', updated_role)
self.assertNotEqual(r_name, updated_role['name'])
- resp, new_role = self.client.get_role(role['id'])
- self.assertEqual(resp['status'], '200')
+ _, new_role = self.client.get_role(role['id'])
self.assertEqual(new_name, new_role['name'])
self.assertEqual(updated_role['id'], new_role['id'])
- resp, roles = self.client.list_roles()
- self.assertEqual(resp['status'], '200')
+ _, roles = self.client.list_roles()
self.assertIn(role['id'], [r['id'] for r in roles])
@test.attr(type='smoke')
def test_grant_list_revoke_role_to_user_on_project(self):
- resp, _ = self.client.assign_user_role_on_project(
+ self.client.assign_user_role_on_project(
self.project['id'], self.user_body['id'], self.role['id'])
- self.assertEqual(resp['status'], '204')
- resp, roles = self.client.list_user_roles_on_project(
+ _, roles = self.client.list_user_roles_on_project(
self.project['id'], self.user_body['id'])
for i in roles:
self.fetched_role_ids.append(i['id'])
- self._list_assertions(resp, roles, self.fetched_role_ids,
+ self._list_assertions(roles, self.fetched_role_ids,
self.role['id'])
- resp, _ = self.client.revoke_role_from_user_on_project(
+ self.client.revoke_role_from_user_on_project(
self.project['id'], self.user_body['id'], self.role['id'])
- self.assertEqual(resp['status'], '204')
@test.attr(type='smoke')
def test_grant_list_revoke_role_to_user_on_domain(self):
- resp, _ = self.client.assign_user_role_on_domain(
+ self.client.assign_user_role_on_domain(
self.domain['id'], self.user_body['id'], self.role['id'])
- self.assertEqual(resp['status'], '204')
- resp, roles = self.client.list_user_roles_on_domain(
+ _, roles = self.client.list_user_roles_on_domain(
self.domain['id'], self.user_body['id'])
for i in roles:
self.fetched_role_ids.append(i['id'])
- self._list_assertions(resp, roles, self.fetched_role_ids,
+ self._list_assertions(roles, self.fetched_role_ids,
self.role['id'])
- resp, _ = self.client.revoke_role_from_user_on_domain(
+ self.client.revoke_role_from_user_on_domain(
self.domain['id'], self.user_body['id'], self.role['id'])
- self.assertEqual(resp['status'], '204')
@test.attr(type='smoke')
def test_grant_list_revoke_role_to_group_on_project(self):
# Grant role to group on project
- resp, _ = self.client.assign_group_role_on_project(
+ self.client.assign_group_role_on_project(
self.project['id'], self.group_body['id'], self.role['id'])
- self.assertEqual(resp['status'], '204')
# List group roles on project
- resp, roles = self.client.list_group_roles_on_project(
+ _, roles = self.client.list_group_roles_on_project(
self.project['id'], self.group_body['id'])
for i in roles:
self.fetched_role_ids.append(i['id'])
- self._list_assertions(resp, roles, self.fetched_role_ids,
+ self._list_assertions(roles, self.fetched_role_ids,
self.role['id'])
# Add user to group, and insure user has role on project
self.client.add_group_user(self.group_body['id'], self.user_body['id'])
@@ -167,34 +149,30 @@
self.assertEqual(len(roles), 1)
self.assertEqual(roles[0]['id'], self.role['id'])
# Revoke role to group on project
- resp, _ = self.client.revoke_role_from_group_on_project(
+ self.client.revoke_role_from_group_on_project(
self.project['id'], self.group_body['id'], self.role['id'])
- self.assertEqual(resp['status'], '204')
@test.attr(type='smoke')
def test_grant_list_revoke_role_to_group_on_domain(self):
- resp, _ = self.client.assign_group_role_on_domain(
+ self.client.assign_group_role_on_domain(
self.domain['id'], self.group_body['id'], self.role['id'])
- self.assertEqual(resp['status'], '204')
- resp, roles = self.client.list_group_roles_on_domain(
+ _, roles = self.client.list_group_roles_on_domain(
self.domain['id'], self.group_body['id'])
for i in roles:
self.fetched_role_ids.append(i['id'])
- self._list_assertions(resp, roles, self.fetched_role_ids,
+ self._list_assertions(roles, self.fetched_role_ids,
self.role['id'])
- resp, _ = self.client.revoke_role_from_group_on_domain(
+ self.client.revoke_role_from_group_on_domain(
self.domain['id'], self.group_body['id'], self.role['id'])
- self.assertEqual(resp['status'], '204')
@test.attr(type='gate')
def test_list_roles(self):
# Return a list of all roles
- resp, body = self.client.list_roles()
- self.assertEqual(200, resp.status)
+ _, body = self.client.list_roles()
found = [role for role in body if role in self.data.v3_roles]
self.assertEqual(len(found), len(self.data.v3_roles))
diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py
index 36e5327..f6078da 100644
--- a/tempest/api/identity/admin/v3/test_services.py
+++ b/tempest/api/identity/admin/v3/test_services.py
@@ -28,9 +28,8 @@
name = data_utils.rand_name('service-')
serv_type = data_utils.rand_name('type--')
desc = data_utils.rand_name('description-')
- resp, body = self.service_client.create_service(name, serv_type,
- description=desc)
- self.assertEqual('201', resp['status'])
+ _, body = self.service_client.create_service(name, serv_type,
+ description=desc)
# Deleting the service created in this method
self.addCleanup(self.service_client.delete_service, body['id'])
@@ -38,14 +37,13 @@
resp1_desc = body['description']
s_desc2 = data_utils.rand_name('desc2-')
- resp, body = self.service_client.update_service(
+ _, body = self.service_client.update_service(
s_id, description=s_desc2)
resp2_desc = body['description']
- self.assertEqual('200', resp['status'])
self.assertNotEqual(resp1_desc, resp2_desc)
# Get service
- resp, body = self.service_client.get_service(s_id)
+ _, body = self.service_client.get_service(s_id)
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index fe3eb03..e61b738 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -30,23 +30,21 @@
u_desc = '%s-description' % u_name
u_email = '%s@testmail.tm' % u_name
u_password = data_utils.rand_name('pass-')
- resp, user = self.client.create_user(
+ _, user = self.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email)
- self.assertEqual(201, resp.status)
self.addCleanup(self.client.delete_user, user['id'])
# Perform Authentication
resp, body = self.token.auth(user['id'], u_password)
self.assertEqual(201, resp.status)
subject_token = resp['x-subject-token']
# Perform GET Token
- resp, token_details = self.client.get_token(subject_token)
- self.assertEqual(200, resp.status)
+ _, token_details = self.client.get_token(subject_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)
# Perform Delete Token
- resp, _ = self.client.delete_token(subject_token)
+ self.client.delete_token(subject_token)
self.assertRaises(exceptions.NotFound, self.client.get_token,
subject_token)
@@ -63,35 +61,29 @@
# Create a user.
user_name = data_utils.rand_name(name='user-')
user_password = data_utils.rand_name(name='pass-')
- resp, user = self.client.create_user(user_name, password=user_password)
- self.assertEqual(201, resp.status)
+ _, user = self.client.create_user(user_name, password=user_password)
self.addCleanup(self.client.delete_user, user['id'])
# Create a couple projects
project1_name = data_utils.rand_name(name='project-')
- resp, project1 = self.client.create_project(project1_name)
- self.assertEqual(201, resp.status)
+ _, project1 = self.client.create_project(project1_name)
self.addCleanup(self.client.delete_project, project1['id'])
project2_name = data_utils.rand_name(name='project-')
- resp, project2 = self.client.create_project(project2_name)
- self.assertEqual(201, resp.status)
+ _, project2 = self.client.create_project(project2_name)
self.addCleanup(self.client.delete_project, project2['id'])
# Create a role
role_name = data_utils.rand_name(name='role-')
- resp, role = self.client.create_role(role_name)
- self.assertEqual(201, resp.status)
+ _, role = self.client.create_role(role_name)
self.addCleanup(self.client.delete_role, role['id'])
# Grant the user the role on both projects.
- resp, _ = self.client.assign_user_role(project1['id'], user['id'],
- role['id'])
- self.assertEqual(204, resp.status)
+ self.client.assign_user_role(project1['id'], user['id'],
+ role['id'])
- resp, _ = self.client.assign_user_role(project2['id'], user['id'],
- role['id'])
- self.assertEqual(204, resp.status)
+ self.client.assign_user_role(project2['id'], user['id'],
+ role['id'])
# Get an unscoped token.
resp, token_auth = self.token.auth(user=user['id'],
@@ -145,8 +137,7 @@
self.assertEqual(role['name'], token_auth['token']['roles'][0]['name'])
# Revoke the unscoped token.
- resp, _ = self.client.delete_token(token1_id)
- self.assertEqual(204, resp.status)
+ self.client.delete_token(token1_id)
# Now get another scoped token using the unscoped token.
resp, token_auth = self.token.auth(token=token_id,
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index 8e3a7d1..fed5171 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -54,25 +54,22 @@
u_desc = self.trustor_username + 'description'
u_email = self.trustor_username + '@testmail.xx'
self.trustor_password = data_utils.rand_name('pass-')
- resp, user = self.client.create_user(
+ _, user = self.client.create_user(
self.trustor_username,
description=u_desc,
password=self.trustor_password,
email=u_email,
project_id=self.trustor_project_id)
- self.assertEqual(resp['status'], '201')
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-')
- resp, role = self.client.create_role(self.delegated_role)
- self.assertEqual(resp['status'], '201')
+ _, role = self.client.create_role(self.delegated_role)
self.delegated_role_id = role['id']
- resp, role = self.client.create_role(self.not_delegated_role)
- self.assertEqual(resp['status'], '201')
+ _, role = self.client.create_role(self.not_delegated_role)
self.not_delegated_role_id = role['id']
# Assign roles to trustor
@@ -108,14 +105,13 @@
def create_trust(self, impersonate=True, expires=None):
- resp, trust_create = self.trustor_client.create_trust(
+ _, trust_create = self.trustor_client.create_trust(
trustor_user_id=self.trustor_user_id,
trustee_user_id=self.trustee_user_id,
project_id=self.trustor_project_id,
role_names=[self.delegated_role],
impersonation=impersonate,
expires_at=expires)
- self.assertEqual('201', resp['status'])
self.trust_id = trust_create['id']
return trust_create
@@ -141,8 +137,7 @@
self.assertEqual(1, len(trust['roles']))
def get_trust(self):
- resp, trust_get = self.trustor_client.get_trust(self.trust_id)
- self.assertEqual('200', resp['status'])
+ _, trust_get = self.trustor_client.get_trust(self.trust_id)
return trust_get
def validate_role(self, role):
@@ -155,22 +150,26 @@
self.assertNotIn('v3/roles/%s' % self.not_delegated_role_id,
role['links']['self'])
+ @test.skip_because(bug='1334368')
def check_trust_roles(self):
# Check we find the delegated role
- resp, roles_get = self.trustor_client.get_trust_roles(
+ _, roles_get = self.trustor_client.get_trust_roles(
self.trust_id)
- self.assertEqual('200', resp['status'])
self.assertEqual(1, len(roles_get))
self.validate_role(roles_get[0])
- resp, role_get = self.trustor_client.get_trust_role(
+ _, role_get = self.trustor_client.get_trust_role(
self.trust_id, self.delegated_role_id)
- self.assertEqual('200', resp['status'])
self.validate_role(role_get)
- resp, role_get = self.trustor_client.check_trust_role(
+ _, role_get = self.trustor_client.check_trust_role(
self.trust_id, self.delegated_role_id)
- self.assertEqual('204', resp['status'])
+ # This tempest two-step change conflicted with the change
+ # moving response checking to the client. This test should be
+ # re-enabled by removing the following assert and changing
+ # the response code in tempest/services/identity/v3/json/
+ # identity_client.py in the check_trust_role_method.
+ # self.assertEqual('200', resp['status'])
# And that we don't find not_delegated_role
self.assertRaises(exceptions.NotFound,
@@ -184,8 +183,7 @@
self.not_delegated_role_id)
def delete_trust(self):
- resp, trust_delete = self.trustor_client.delete_trust(self.trust_id)
- self.assertEqual('204', resp['status'])
+ self.trustor_client.delete_trust(self.trust_id)
self.assertRaises(exceptions.NotFound,
self.trustor_client.get_trust,
self.trust_id)
@@ -253,17 +251,15 @@
@test.attr(type='smoke')
def test_get_trusts_query(self):
self.create_trust()
- resp, trusts_get = self.trustor_client.get_trusts(
+ _, trusts_get = self.trustor_client.get_trusts(
trustor_user_id=self.trustor_user_id)
- self.assertEqual('200', resp['status'])
self.assertEqual(1, len(trusts_get))
self.validate_trust(trusts_get[0], summary=True)
@test.attr(type='smoke')
def test_get_trusts_all(self):
self.create_trust()
- resp, trusts_get = self.client.get_trusts()
- self.assertEqual('200', resp['status'])
+ _, trusts_get = self.client.get_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 7316c7f..558575e 100644
--- a/tempest/api/identity/admin/v3/test_users.py
+++ b/tempest/api/identity/admin/v3/test_users.py
@@ -29,13 +29,13 @@
u_desc = u_name + 'description'
u_email = u_name + '@testmail.tm'
u_password = data_utils.rand_name('pass-')
- resp, user = self.client.create_user(
+ _, user = self.client.create_user(
u_name, description=u_desc, password=u_password,
email=u_email, enabled=False)
# Delete the User at the end of this method
self.addCleanup(self.client.delete_user, user['id'])
# Creating second project for updation
- resp, project = self.client.create_project(
+ _, project = self.client.create_project(
data_utils.rand_name('project-'),
description=data_utils.rand_name('project-desc-'))
# Delete the Project at the end of this method
@@ -44,12 +44,10 @@
u_name2 = data_utils.rand_name('user2-')
u_email2 = u_name2 + '@testmail.tm'
u_description2 = u_name2 + ' description'
- resp, update_user = self.client.update_user(
+ _, update_user = self.client.update_user(
user['id'], name=u_name2, description=u_description2,
project_id=project['id'],
email=u_email2, enabled=False)
- # Assert response body of update user.
- self.assertEqual(200, resp.status)
self.assertEqual(u_name2, update_user['name'])
self.assertEqual(u_description2, update_user['description'])
self.assertEqual(project['id'],
@@ -57,7 +55,7 @@
self.assertEqual(u_email2, update_user['email'])
self.assertEqual('false', str(update_user['enabled']).lower())
# GET by id after updation
- resp, new_user_get = self.client.get_user(user['id'])
+ _, new_user_get = self.client.get_user(user['id'])
# Assert response body of GET after updation
self.assertEqual(u_name2, new_user_get['name'])
self.assertEqual(u_description2, new_user_get['description'])
@@ -107,8 +105,7 @@
user['id'],
role['id'])
assigned_project_ids.append(project['id'])
- resp, body = self.client.list_user_projects(user['id'])
- self.assertEqual(200, resp.status)
+ _, body = self.client.list_user_projects(user['id'])
for i in body:
fetched_project_ids.append(i['id'])
# verifying the project ids in list
@@ -124,7 +121,7 @@
def test_get_user(self):
# Get a user detail
self.data.setup_test_v3_user()
- resp, user = self.client.get_user(self.data.v3_user['id'])
+ _, user = self.client.get_user(self.data.v3_user['id'])
self.assertEqual(self.data.v3_user['id'], user['id'])
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 697057f..0991576 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -136,17 +136,17 @@
self.test_user = data_utils.rand_name('test_user_')
self.test_password = data_utils.rand_name('pass_')
self.test_email = self.test_user + '@testmail.tm'
- resp, self.user = self.client.create_user(self.test_user,
- self.test_password,
- self.tenant['id'],
- self.test_email)
+ _, self.user = self.client.create_user(self.test_user,
+ self.test_password,
+ self.tenant['id'],
+ self.test_email)
self.users.append(self.user)
def setup_test_tenant(self):
"""Set up a test tenant."""
self.test_tenant = data_utils.rand_name('test_tenant_')
self.test_description = data_utils.rand_name('desc_')
- resp, self.tenant = self.client.create_tenant(
+ _, self.tenant = self.client.create_tenant(
name=self.test_tenant,
description=self.test_description)
self.tenants.append(self.tenant)
@@ -154,7 +154,7 @@
def setup_test_role(self):
"""Set up a test role."""
self.test_role = data_utils.rand_name('role')
- resp, self.role = self.client.create_role(self.test_role)
+ _, self.role = self.client.create_role(self.test_role)
self.roles.append(self.role)
def setup_test_v3_user(self):
@@ -163,7 +163,7 @@
self.test_user = data_utils.rand_name('test_user_')
self.test_password = data_utils.rand_name('pass_')
self.test_email = self.test_user + '@testmail.tm'
- resp, self.v3_user = self.client.create_user(
+ _, self.v3_user = self.client.create_user(
self.test_user,
password=self.test_password,
project_id=self.project['id'],
@@ -174,7 +174,7 @@
"""Set up a test project."""
self.test_project = data_utils.rand_name('test_project_')
self.test_description = data_utils.rand_name('desc_')
- resp, self.project = self.client.create_project(
+ _, self.project = self.client.create_project(
name=self.test_project,
description=self.test_description)
self.projects.append(self.project)
@@ -182,7 +182,7 @@
def setup_test_v3_role(self):
"""Set up a test v3 role."""
self.test_role = data_utils.rand_name('role')
- resp, self.v3_role = self.client.create_role(self.test_role)
+ _, self.v3_role = self.client.create_role(self.test_role)
self.v3_roles.append(self.v3_role)
def teardown_all(self):
diff --git a/tempest/api/identity/test_extension.py b/tempest/api/identity/test_extension.py
index 67f20f4..a06ee53 100644
--- a/tempest/api/identity/test_extension.py
+++ b/tempest/api/identity/test_extension.py
@@ -23,8 +23,7 @@
@test.attr(type='gate')
def test_list_extensions(self):
# List all the extensions
- resp, body = self.non_admin_client.list_extensions()
- self.assertEqual(200, resp.status)
+ _, body = self.non_admin_client.list_extensions()
self.assertNotEmpty(body)
keys = ['name', 'updated', 'alias', 'links',
'namespace', 'description']
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index 2a9b407..c5be1f3 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -142,10 +142,6 @@
_api_version = 1
-class BaseVolumeV2Test(BaseVolumeTest):
- _api_version = 2
-
-
class BaseVolumeV1AdminTest(BaseVolumeV1Test):
"""Base test case class for all Volume Admin API tests."""
@classmethod
diff --git a/tempest/api/volume/test_volumes_list.py b/tempest/api/volume/test_volumes_list.py
index e2f7a38..b8a2faa 100644
--- a/tempest/api/volume/test_volumes_list.py
+++ b/tempest/api/volume/test_volumes_list.py
@@ -23,10 +23,8 @@
LOG = logging.getLogger(__name__)
-VOLUME_FIELDS = ('id', 'display_name')
-
-class VolumesListTest(base.BaseVolumeV1Test):
+class VolumesV2ListTestJSON(base.BaseVolumeTest):
"""
This test creates a number of 1G volumes. To run successfully,
@@ -36,7 +34,7 @@
VOLUME_BACKING_FILE_SIZE is at least 4G in your localrc
"""
- _interface = 'json'
+ VOLUME_FIELDS = ('id', 'name')
def assertVolumesIn(self, fetched_list, expected_list, fields=None):
if fields:
@@ -48,7 +46,7 @@
return
def str_vol(vol):
- return "%s:%s" % (vol['id'], vol['display_name'])
+ return "%s:%s" % (vol['id'], vol[self.name])
raw_msg = "Could not find volumes %s in expected list %s; fetched %s"
self.fail(raw_msg % ([str_vol(v) for v in missing_vols],
@@ -58,8 +56,9 @@
@classmethod
@test.safe_setup
def setUpClass(cls):
- super(VolumesListTest, cls).setUpClass()
+ super(VolumesV2ListTestJSON, cls).setUpClass()
cls.client = cls.volumes_client
+ cls.name = cls.VOLUME_FIELDS[1]
# Create 3 test volumes
cls.volume_list = []
@@ -77,7 +76,7 @@
for volid in cls.volume_id_list:
resp, _ = cls.client.delete_volume(volid)
cls.client.wait_for_resource_deletion(volid)
- super(VolumesListTest, cls).tearDownClass()
+ super(VolumesV2ListTestJSON, cls).tearDownClass()
def _list_by_param_value_and_assert(self, params, with_detail=False):
"""
@@ -92,16 +91,22 @@
self.assertEqual(200, resp.status)
# Validating params of fetched volumes
- for volume in fetched_vol_list:
- for key in params:
- msg = "Failed to list volumes %s by %s" % \
- ('details' if with_detail else '', key)
- if key == 'metadata':
- self.assertThat(volume[key].items(),
- matchers.ContainsAll(params[key].items()),
- msg)
- else:
- self.assertEqual(params[key], volume[key], msg)
+ # In v2, only list detail view includes items in params.
+ # In v1, list view and list detail view are same. So the
+ # following check should be run when 'with_detail' is True
+ # or v1 tests.
+ if with_detail or self._api_version == 1:
+ for volume in fetched_vol_list:
+ for key in params:
+ msg = "Failed to list volumes %s by %s" % \
+ ('details' if with_detail else '', key)
+ if key == 'metadata':
+ self.assertThat(
+ volume[key].items(),
+ matchers.ContainsAll(params[key].items()),
+ msg)
+ else:
+ self.assertEqual(params[key], volume[key], msg)
@test.attr(type='smoke')
def test_volume_list(self):
@@ -110,7 +115,7 @@
resp, fetched_list = self.client.list_volumes()
self.assertEqual(200, resp.status)
self.assertVolumesIn(fetched_list, self.volume_list,
- fields=VOLUME_FIELDS)
+ fields=self.VOLUME_FIELDS)
@test.attr(type='gate')
def test_volume_list_with_details(self):
@@ -123,32 +128,31 @@
@test.attr(type='gate')
def test_volume_list_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
- params = {'display_name': volume['display_name']}
+ params = {self.name: volume[self.name]}
resp, fetched_vol = self.client.list_volumes(params)
self.assertEqual(200, resp.status)
self.assertEqual(1, len(fetched_vol), str(fetched_vol))
- self.assertEqual(fetched_vol[0]['display_name'],
- volume['display_name'])
+ self.assertEqual(fetched_vol[0][self.name],
+ volume[self.name])
@test.attr(type='gate')
def test_volume_list_details_by_name(self):
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
- params = {'display_name': volume['display_name']}
+ params = {self.name: volume[self.name]}
resp, fetched_vol = self.client.list_volumes_with_detail(params)
self.assertEqual(200, resp.status)
self.assertEqual(1, len(fetched_vol), str(fetched_vol))
- self.assertEqual(fetched_vol[0]['display_name'],
- volume['display_name'])
+ self.assertEqual(fetched_vol[0][self.name],
+ volume[self.name])
@test.attr(type='gate')
def test_volumes_list_by_status(self):
params = {'status': 'available'}
resp, fetched_list = self.client.list_volumes(params)
self.assertEqual(200, resp.status)
- for volume in fetched_list:
- self.assertEqual('available', volume['status'])
+ self._list_by_param_value_and_assert(params)
self.assertVolumesIn(fetched_list, self.volume_list,
- fields=VOLUME_FIELDS)
+ fields=self.VOLUME_FIELDS)
@test.attr(type='gate')
def test_volumes_list_details_by_status(self):
@@ -166,10 +170,9 @@
params = {'availability_zone': zone}
resp, fetched_list = self.client.list_volumes(params)
self.assertEqual(200, resp.status)
- for volume in fetched_list:
- self.assertEqual(zone, volume['availability_zone'])
+ self._list_by_param_value_and_assert(params)
self.assertVolumesIn(fetched_list, self.volume_list,
- fields=VOLUME_FIELDS)
+ fields=self.VOLUME_FIELDS)
@test.attr(type='gate')
def test_volumes_list_details_by_availability_zone(self):
@@ -198,7 +201,7 @@
def test_volume_list_param_display_name_and_status(self):
# Test to list volume when display name and status param is given
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
- params = {'display_name': volume['display_name'],
+ params = {self.name: volume[self.name],
'status': 'available'}
self._list_by_param_value_and_assert(params)
@@ -206,10 +209,19 @@
def test_volume_list_with_detail_param_display_name_and_status(self):
# Test to list volume when name and status param is given
volume = self.volume_list[data_utils.rand_int_id(0, 2)]
- params = {'display_name': volume['display_name'],
+ params = {self.name: volume[self.name],
'status': 'available'}
self._list_by_param_value_and_assert(params, with_detail=True)
-class VolumeListTestXML(VolumesListTest):
+class VolumesV2ListTestXML(VolumesV2ListTestJSON):
+ _interface = 'xml'
+
+
+class VolumesV1ListTestJSON(VolumesV2ListTestJSON):
+ _api_version = 1
+ VOLUME_FIELDS = ('id', 'display_name')
+
+
+class VolumesV1ListTestXML(VolumesV1ListTestJSON):
_interface = 'xml'
diff --git a/tempest/api/volume/v2/test_volumes_list.py b/tempest/api/volume/v2/test_volumes_list.py
index e90c957..7ca8599 100644
--- a/tempest/api/volume/v2/test_volumes_list.py
+++ b/tempest/api/volume/v2/test_volumes_list.py
@@ -13,22 +13,16 @@
# 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 operator
from tempest.api.volume import base
-from tempest.common.utils import data_utils
-from tempest.openstack.common import log as logging
from tempest import test
-from testtools import matchers
-
-LOG = logging.getLogger(__name__)
-
-VOLUME_FIELDS = ('id', 'name')
-class VolumesV2ListTestJSON(base.BaseVolumeV2Test):
+class VolumesV2ListTestJSON(base.BaseVolumeTest):
"""
+ volumes v2 specific tests.
+
This test creates a number of 1G volumes. To run successfully,
ensure that the backing file for the volume group that Nova uses
has space for at least 3 1G volumes!
@@ -36,25 +30,6 @@
VOLUME_BACKING_FILE_SIZE is at least 4G in your localrc
"""
- _interface = 'json'
-
- def assertVolumesIn(self, fetched_list, expected_list, fields=None):
- if fields:
- expected_list = map(operator.itemgetter(*fields), expected_list)
- fetched_list = map(operator.itemgetter(*fields), fetched_list)
-
- missing_vols = [v for v in expected_list if v not in fetched_list]
- if len(missing_vols) == 0:
- return
-
- def str_vol(vol):
- return "%s:%s" % (vol['id'], vol['name'])
-
- raw_msg = "Could not find volumes %s in expected list %s; fetched %s"
- self.fail(raw_msg % ([str_vol(v) for v in missing_vols],
- [str_vol(v) for v in expected_list],
- [str_vol(v) for v in fetched_list]))
-
@classmethod
@test.safe_setup
def setUpClass(cls):
@@ -79,124 +54,6 @@
cls.client.wait_for_resource_deletion(volid)
super(VolumesV2ListTestJSON, cls).tearDownClass()
- def _list_by_param_value_and_assert(self, params, expected_list=None,
- with_detail=False):
- """
- Perform list or list_details action with given params
- and validates result.
- """
- if with_detail:
- resp, fetched_vol_list = \
- self.client.list_volumes_with_detail(params=params)
- else:
- resp, fetched_vol_list = self.client.list_volumes(params=params)
-
- self.assertEqual(200, resp.status)
- if expected_list is None:
- expected_list = self.volume_list
- self.assertVolumesIn(fetched_vol_list, expected_list,
- fields=VOLUME_FIELDS)
- # Validating params of fetched volumes
- if with_detail:
- for volume in fetched_vol_list:
- for key in params:
- msg = "Failed to list volumes %s by %s" % \
- ('details' if with_detail else '', key)
- if key == 'metadata':
- self.assertThat(volume[key].items(),
- matchers.ContainsAll(
- params[key].items()), msg)
- else:
- self.assertEqual(params[key], volume[key], msg)
-
- @test.attr(type='smoke')
- def test_volume_list(self):
- # Get a list of Volumes
- # Fetch all volumes
- resp, fetched_list = self.client.list_volumes()
- self.assertEqual(200, resp.status)
- self.assertVolumesIn(fetched_list, self.volume_list,
- fields=VOLUME_FIELDS)
-
- @test.attr(type='gate')
- def test_volume_list_with_details(self):
- # Get a list of Volumes with details
- # Fetch all Volumes
- resp, fetched_list = self.client.list_volumes_with_detail()
- self.assertEqual(200, resp.status)
- self.assertVolumesIn(fetched_list, self.volume_list)
-
- @test.attr(type='gate')
- def test_volume_list_by_name(self):
- volume = self.volume_list[data_utils.rand_int_id(0, 2)]
- params = {'name': volume['name']}
- resp, fetched_vol = self.client.list_volumes(params)
- self.assertEqual(200, resp.status)
- self.assertEqual(1, len(fetched_vol), str(fetched_vol))
- self.assertEqual(fetched_vol[0]['name'], volume['name'])
-
- @test.attr(type='gate')
- def test_volume_list_details_by_name(self):
- volume = self.volume_list[data_utils.rand_int_id(0, 2)]
- params = {'name': volume['name']}
- resp, fetched_vol = self.client.list_volumes_with_detail(params)
- self.assertEqual(200, resp.status)
- self.assertEqual(1, len(fetched_vol), str(fetched_vol))
- self.assertEqual(fetched_vol[0]['name'], volume['name'])
-
- @test.attr(type='gate')
- def test_volumes_list_by_status(self):
- params = {'status': 'available'}
- self._list_by_param_value_and_assert(params)
-
- @test.attr(type='gate')
- def test_volumes_list_details_by_status(self):
- params = {'status': 'available'}
- self._list_by_param_value_and_assert(params, with_detail=True)
-
- @test.attr(type='gate')
- def test_volumes_list_by_availability_zone(self):
- volume = self.volume_list[data_utils.rand_int_id(0, 2)]
- zone = volume['availability_zone']
- params = {'availability_zone': zone}
- self._list_by_param_value_and_assert(params)
-
- @test.attr(type='gate')
- def test_volumes_list_details_by_availability_zone(self):
- volume = self.volume_list[data_utils.rand_int_id(0, 2)]
- zone = volume['availability_zone']
- params = {'availability_zone': zone}
- self._list_by_param_value_and_assert(params, with_detail=True)
-
- @test.attr(type='gate')
- def test_volume_list_with_param_metadata(self):
- # Test to list volumes when metadata param is given
- params = {'metadata': self.metadata}
- self._list_by_param_value_and_assert(params)
-
- @test.attr(type='gate')
- def test_volume_list_with_details_param_metadata(self):
- # Test to list volumes details when metadata param is given
- params = {'metadata': self.metadata}
- self._list_by_param_value_and_assert(params, with_detail=True)
-
- @test.attr(type='gate')
- def test_volume_list_param_display_name_and_status(self):
- # Test to list volume when display name and status param is given
- volume = self.volume_list[data_utils.rand_int_id(0, 2)]
- params = {'name': volume['name'],
- 'status': 'available'}
- self._list_by_param_value_and_assert(params, expected_list=[volume])
-
- @test.attr(type='gate')
- def test_volume_list_with_details_param_display_name_and_status(self):
- # Test to list volume when name and status param is given
- volume = self.volume_list[data_utils.rand_int_id(0, 2)]
- params = {'name': volume['name'],
- 'status': 'available'}
- self._list_by_param_value_and_assert(params, expected_list=[volume],
- with_detail=True)
-
@test.attr(type='gate')
def test_volume_list_details_with_multiple_params(self):
# List volumes detail using combined condition
diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py
index 8166de5..208f42f 100644
--- a/tempest/common/isolated_creds.py
+++ b/tempest/common/isolated_creds.py
@@ -57,7 +57,7 @@
def _create_tenant(self, name, description):
if self.tempest_client:
- resp, tenant = self.identity_admin_client.create_tenant(
+ _, tenant = self.identity_admin_client.create_tenant(
name=name, description=description)
else:
tenant = self.identity_admin_client.tenants.create(
@@ -67,7 +67,7 @@
def _get_tenant_by_name(self, name):
if self.tempest_client:
- resp, tenant = self.identity_admin_client.get_tenant_by_name(name)
+ _, tenant = self.identity_admin_client.get_tenant_by_name(name)
else:
tenants = self.identity_admin_client.tenants.list()
for ten in tenants:
@@ -80,10 +80,10 @@
def _create_user(self, username, password, tenant, email):
if self.tempest_client:
- resp, user = self.identity_admin_client.create_user(username,
- password,
- tenant['id'],
- email)
+ _, user = self.identity_admin_client.create_user(username,
+ password,
+ tenant['id'],
+ email)
else:
user = self.identity_admin_client.users.create(username, password,
email,
@@ -92,7 +92,7 @@
def _get_user(self, tenant, username):
if self.tempest_client:
- resp, user = self.identity_admin_client.get_user_by_username(
+ _, user = self.identity_admin_client.get_user_by_username(
tenant['id'],
username)
else:
@@ -101,7 +101,7 @@
def _list_roles(self):
if self.tempest_client:
- resp, roles = self.identity_admin_client.list_roles()
+ _, roles = self.identity_admin_client.list_roles()
else:
roles = self.identity_admin_client.roles.list()
return roles
diff --git a/tempest/services/identity/json/identity_client.py b/tempest/services/identity/json/identity_client.py
index b0cab8e..ac65f81 100644
--- a/tempest/services/identity/json/identity_client.py
+++ b/tempest/services/identity/json/identity_client.py
@@ -37,8 +37,12 @@
"""
if hasattr(self, '_has_admin_extensions'):
return self._has_admin_extensions
- resp, body = self.list_roles()
- self._has_admin_extensions = ('status' in resp and resp.status != 503)
+ # Try something that requires admin
+ try:
+ self.list_roles()
+ self._has_admin_extensions = True
+ except Exception:
+ self._has_admin_extensions = False
return self._has_admin_extensions
def create_role(self, name):
@@ -48,11 +52,13 @@
}
post_body = json.dumps({'role': post_body})
resp, body = self.post('OS-KSADM/roles', post_body)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def get_role(self, role_id):
"""Get a role by its id."""
resp, body = self.get('OS-KSADM/roles/%s' % role_id)
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['role']
@@ -70,51 +76,63 @@
}
post_body = json.dumps({'tenant': post_body})
resp, body = self.post('tenants', post_body)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def delete_role(self, role_id):
"""Delete a role."""
- return self.delete('OS-KSADM/roles/%s' % str(role_id))
+ resp, body = self.delete('OS-KSADM/roles/%s' % str(role_id))
+ self.expected_success(204, resp.status)
+ return resp, body
def list_user_roles(self, tenant_id, user_id):
"""Returns a list of roles assigned to a user for a tenant."""
url = '/tenants/%s/users/%s/roles' % (tenant_id, user_id)
resp, body = self.get(url)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def assign_user_role(self, tenant_id, user_id, role_id):
"""Add roles to a user on a tenant."""
resp, body = self.put('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
(tenant_id, user_id, role_id), "")
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def remove_user_role(self, tenant_id, user_id, role_id):
"""Removes a role assignment for a user on a tenant."""
- return self.delete('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
- (tenant_id, user_id, role_id))
+ resp, body = self.delete('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
+ (tenant_id, user_id, role_id))
+ self.expected_success(204, resp.status)
+ return resp, body
def delete_tenant(self, tenant_id):
"""Delete a tenant."""
- return self.delete('tenants/%s' % str(tenant_id))
+ resp, body = self.delete('tenants/%s' % str(tenant_id))
+ self.expected_success(204, resp.status)
+ return resp, body
def get_tenant(self, tenant_id):
"""Get tenant details."""
resp, body = self.get('tenants/%s' % str(tenant_id))
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def list_roles(self):
"""Returns roles."""
resp, body = self.get('OS-KSADM/roles')
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def list_tenants(self):
"""Returns tenants."""
resp, body = self.get('tenants')
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['tenants']
def get_tenant_by_name(self, tenant_name):
- resp, tenants = self.list_tenants()
+ _, tenants = self.list_tenants()
for tenant in tenants:
if tenant['name'] == tenant_name:
return tenant
@@ -122,7 +140,7 @@
def update_tenant(self, tenant_id, **kwargs):
"""Updates a tenant."""
- resp, body = self.get_tenant(tenant_id)
+ _, body = self.get_tenant(tenant_id)
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
@@ -134,6 +152,7 @@
}
post_body = json.dumps({'tenant': post_body})
resp, body = self.post('tenants/%s' % tenant_id, post_body)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def create_user(self, name, password, tenant_id, email, **kwargs):
@@ -149,26 +168,32 @@
post_body['enabled'] = kwargs.get('enabled')
post_body = json.dumps({'user': post_body})
resp, body = self.post('users', post_body)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def update_user(self, user_id, **kwargs):
"""Updates a user."""
put_body = json.dumps({'user': kwargs})
resp, body = self.put('users/%s' % user_id, put_body)
+ self.expected_success(200, resp.status)
return resp, self._parse_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)
return resp, self._parse_resp(body)
def delete_user(self, user_id):
"""Delete a user."""
- return self.delete("users/%s" % user_id)
+ resp, body = self.delete("users/%s" % user_id)
+ self.expected_success(204, resp.status)
+ return resp, body
def get_users(self):
"""Get the list of users."""
resp, body = self.get("users")
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def enable_disable_user(self, user_id, enabled):
@@ -178,24 +203,29 @@
}
put_body = json.dumps({'user': put_body})
resp, body = self.put('users/%s/enabled' % user_id, put_body)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def get_token(self, token_id):
"""Get token details."""
resp, body = self.get("tokens/%s" % token_id)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def delete_token(self, token_id):
"""Delete a token."""
- return self.delete("tokens/%s" % token_id)
+ resp, body = self.delete("tokens/%s" % token_id)
+ self.expected_success(204, resp.status)
+ return resp, body
def list_users_for_tenant(self, tenant_id):
"""List users for a Tenant."""
resp, body = self.get('/tenants/%s/users' % tenant_id)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def get_user_by_username(self, tenant_id, username):
- resp, users = self.list_users_for_tenant(tenant_id)
+ _, users = self.list_users_for_tenant(tenant_id)
for user in users:
if user['name'] == username:
return user
@@ -210,23 +240,28 @@
}
post_body = json.dumps({'OS-KSADM:service': post_body})
resp, body = self.post('/OS-KSADM/services', post_body)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def get_service(self, service_id):
"""Get Service."""
url = '/OS-KSADM/services/%s' % service_id
resp, body = self.get(url)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def list_services(self):
"""List Service - Returns Services."""
resp, body = self.get('/OS-KSADM/services')
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def delete_service(self, service_id):
"""Delete Service."""
url = '/OS-KSADM/services/%s' % service_id
- return self.delete(url)
+ resp, body = self.delete(url)
+ self.expected_success(204, resp.status)
+ return resp, body
def update_user_password(self, user_id, new_pass):
"""Update User Password."""
@@ -236,11 +271,13 @@
}
put_body = json.dumps({'user': put_body})
resp, body = self.put('users/%s/OS-KSADM/password' % user_id, put_body)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def list_extensions(self):
"""List all the extensions."""
resp, body = self.get('/extensions')
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['extensions']['values']
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 6829333..8c72dfa 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -49,12 +49,13 @@
}
post_body = json.dumps({'user': post_body})
resp, body = self.post('users', post_body)
+ self.expected_success(201, resp.status)
body = json.loads(body)
return resp, body['user']
def update_user(self, user_id, name, **kwargs):
"""Updates a user."""
- resp, body = self.get_user(user_id)
+ _, body = self.get_user(user_id)
email = kwargs.get('email', body['email'])
en = kwargs.get('enabled', body['enabled'])
project_id = kwargs.get('project_id', body['project_id'])
@@ -71,30 +72,35 @@
}
post_body = json.dumps({'user': post_body})
resp, body = self.patch('users/%s' % user_id, post_body)
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['user']
def list_user_projects(self, user_id):
"""Lists the projects on which a user has roles assigned."""
resp, body = self.get('users/%s/projects' % user_id)
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['projects']
def get_users(self):
"""Get the list of users."""
resp, body = self.get("users")
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['users']
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 resp, body['user']
def delete_user(self, user_id):
"""Deletes a User."""
resp, body = self.delete("users/%s" % user_id)
+ self.expected_success(204, resp.status)
return resp, body
def create_project(self, name, **kwargs):
@@ -110,16 +116,18 @@
}
post_body = json.dumps({'project': post_body})
resp, body = self.post('projects', post_body)
+ self.expected_success(201, resp.status)
body = json.loads(body)
return resp, body['project']
def list_projects(self):
resp, body = self.get("projects")
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['projects']
def update_project(self, project_id, **kwargs):
- resp, body = self.get_project(project_id)
+ _, body = self.get_project(project_id)
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
@@ -133,18 +141,21 @@
}
post_body = json.dumps({'project': post_body})
resp, body = self.patch('projects/%s' % project_id, post_body)
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['project']
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 resp, body['project']
def delete_project(self, project_id):
"""Delete a project."""
resp, body = self.delete('projects/%s' % str(project_id))
+ self.expected_success(204, resp.status)
return resp, body
def create_role(self, name):
@@ -154,18 +165,21 @@
}
post_body = json.dumps({'role': post_body})
resp, body = self.post('roles', post_body)
+ self.expected_success(201, resp.status)
body = json.loads(body)
return resp, body['role']
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 resp, body['role']
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 resp, body['roles']
@@ -176,18 +190,21 @@
}
post_body = json.dumps({'role': post_body})
resp, body = self.patch('roles/%s' % str(role_id), post_body)
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['role']
def delete_role(self, role_id):
"""Delete a role."""
resp, body = self.delete('roles/%s' % str(role_id))
+ self.expected_success(204, resp.status)
return resp, body
def assign_user_role(self, project_id, user_id, role_id):
"""Add roles to a user on a project."""
resp, body = self.put('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id), None)
+ self.expected_success(204, resp.status)
return resp, body
def create_domain(self, name, **kwargs):
@@ -201,23 +218,26 @@
}
post_body = json.dumps({'domain': post_body})
resp, body = self.post('domains', post_body)
+ self.expected_success(201, resp.status)
body = json.loads(body)
return resp, body['domain']
def delete_domain(self, domain_id):
"""Delete a domain."""
resp, body = self.delete('domains/%s' % str(domain_id))
+ self.expected_success(204, resp.status)
return resp, body
def list_domains(self):
"""List Domains."""
resp, body = self.get('domains')
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['domains']
def update_domain(self, domain_id, **kwargs):
"""Updates a domain."""
- resp, body = self.get_domain(domain_id)
+ _, body = self.get_domain(domain_id)
description = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
name = kwargs.get('name', body['name'])
@@ -228,12 +248,14 @@
}
post_body = json.dumps({'domain': post_body})
resp, body = self.patch('domains/%s' % domain_id, post_body)
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['domain']
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 resp, body['domain']
@@ -241,6 +263,7 @@
"""Get token details."""
headers = {'X-Subject-Token': resp_token}
resp, body = self.get("auth/tokens", headers=headers)
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['token']
@@ -248,6 +271,7 @@
"""Deletes token."""
headers = {'X-Subject-Token': resp_token}
resp, body = self.delete("auth/tokens", headers=headers)
+ self.expected_success(204, resp.status)
return resp, body
def create_group(self, name, **kwargs):
@@ -263,18 +287,20 @@
}
post_body = json.dumps({'group': post_body})
resp, body = self.post('groups', post_body)
+ self.expected_success(201, resp.status)
body = json.loads(body)
return resp, body['group']
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 resp, body['group']
def update_group(self, group_id, **kwargs):
"""Updates a group."""
- resp, body = self.get_group(group_id)
+ _, body = self.get_group(group_id)
name = kwargs.get('name', body['name'])
description = kwargs.get('description', body['description'])
post_body = {
@@ -283,53 +309,62 @@
}
post_body = json.dumps({'group': post_body})
resp, body = self.patch('groups/%s' % group_id, post_body)
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['group']
def delete_group(self, group_id):
"""Delete a group."""
resp, body = self.delete('groups/%s' % str(group_id))
+ self.expected_success(204, resp.status)
return resp, body
def add_group_user(self, group_id, user_id):
"""Add user into group."""
resp, body = self.put('groups/%s/users/%s' % (group_id, user_id),
None)
+ self.expected_success(204, resp.status)
return resp, body
def list_group_users(self, group_id):
"""List users in group."""
resp, body = self.get('groups/%s/users' % group_id)
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['users']
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 resp, body['groups']
def delete_group_user(self, group_id, user_id):
"""Delete user in group."""
resp, body = self.delete('groups/%s/users/%s' % (group_id, user_id))
+ self.expected_success(204, resp.status)
return resp, body
def assign_user_role_on_project(self, project_id, user_id, role_id):
"""Add roles to a user on a project."""
resp, body = self.put('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id), None)
+ self.expected_success(204, resp.status)
return resp, body
def assign_user_role_on_domain(self, domain_id, user_id, role_id):
"""Add roles to a user on a domain."""
resp, body = self.put('domains/%s/users/%s/roles/%s' %
(domain_id, user_id, role_id), None)
+ self.expected_success(204, resp.status)
return resp, body
def list_user_roles_on_project(self, project_id, user_id):
"""list roles of a user on a project."""
resp, body = self.get('projects/%s/users/%s/roles' %
(project_id, user_id))
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['roles']
@@ -337,6 +372,7 @@
"""list roles of a user on a domain."""
resp, body = self.get('domains/%s/users/%s/roles' %
(domain_id, user_id))
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['roles']
@@ -344,30 +380,35 @@
"""Delete role of a user on a project."""
resp, body = self.delete('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id))
+ self.expected_success(204, resp.status)
return resp, body
def revoke_role_from_user_on_domain(self, domain_id, user_id, role_id):
"""Delete role of a user on a domain."""
resp, body = self.delete('domains/%s/users/%s/roles/%s' %
(domain_id, user_id, role_id))
+ self.expected_success(204, resp.status)
return resp, body
def assign_group_role_on_project(self, project_id, group_id, role_id):
"""Add roles to a user on a project."""
resp, body = self.put('projects/%s/groups/%s/roles/%s' %
(project_id, group_id, role_id), None)
+ self.expected_success(204, resp.status)
return resp, body
def assign_group_role_on_domain(self, domain_id, group_id, role_id):
"""Add roles to a user on a domain."""
resp, body = self.put('domains/%s/groups/%s/roles/%s' %
(domain_id, group_id, role_id), None)
+ self.expected_success(204, resp.status)
return resp, body
def list_group_roles_on_project(self, project_id, group_id):
"""list roles of a user on a project."""
resp, body = self.get('projects/%s/groups/%s/roles' %
(project_id, group_id))
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['roles']
@@ -375,6 +416,7 @@
"""list roles of a user on a domain."""
resp, body = self.get('domains/%s/groups/%s/roles' %
(domain_id, group_id))
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['roles']
@@ -382,12 +424,14 @@
"""Delete role of a user on a project."""
resp, body = self.delete('projects/%s/groups/%s/roles/%s' %
(project_id, group_id, role_id))
+ self.expected_success(204, resp.status)
return resp, body
def revoke_role_from_group_on_domain(self, domain_id, group_id, role_id):
"""Delete role of a user on a domain."""
resp, body = self.delete('domains/%s/groups/%s/roles/%s' %
(domain_id, group_id, role_id))
+ self.expected_success(204, resp.status)
return resp, body
def create_trust(self, trustor_user_id, trustee_user_id, project_id,
@@ -404,12 +448,14 @@
}
post_body = json.dumps({'trust': post_body})
resp, body = self.post('OS-TRUST/trusts', post_body)
+ self.expected_success(201, resp.status)
body = json.loads(body)
return resp, body['trust']
def delete_trust(self, trust_id):
"""Deletes a trust."""
resp, body = self.delete("OS-TRUST/trusts/%s" % trust_id)
+ self.expected_success(204, resp.status)
return resp, body
def get_trusts(self, trustor_user_id=None, trustee_user_id=None):
@@ -422,18 +468,21 @@
% trustee_user_id)
else:
resp, body = self.get("OS-TRUST/trusts")
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['trusts']
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 resp, body['trust']
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 resp, body['roles']
@@ -441,6 +490,7 @@
"""GET role delegated by a trust."""
resp, body = self.get("OS-TRUST/trusts/%s/roles/%s"
% (trust_id, role_id))
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['role']
@@ -448,6 +498,10 @@
"""HEAD Check if role is delegated by a trust."""
resp, body = self.head("OS-TRUST/trusts/%s/roles/%s"
% (trust_id, role_id))
+ # This code needs to change to 200 when the keystone changes
+ # for bug 1334368 merge and check_trust_roles test is
+ # unskipped
+ self.expected_success(204, resp.status)
return resp, body
diff --git a/tempest/services/identity/v3/json/region_client.py b/tempest/services/identity/v3/json/region_client.py
index f95d00f..c078765 100644
--- a/tempest/services/identity/v3/json/region_client.py
+++ b/tempest/services/identity/v3/json/region_client.py
@@ -1,4 +1,4 @@
-# Copyright 2014 OpenStack Foundation
+# Copyright 2014 Hewlett-Packard Development Company, L.P
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py
index b66fb4a..82e8aad 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/service_client.py
@@ -42,6 +42,7 @@
}
patch_body = json.dumps({'service': patch_body})
resp, body = self.patch('services/%s' % service_id, patch_body)
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['service']
@@ -49,6 +50,7 @@
"""Get Service."""
url = 'services/%s' % service_id
resp, body = self.get(url)
+ self.expected_success(200, resp.status)
body = json.loads(body)
return resp, body['service']
@@ -62,10 +64,12 @@
}
body = json.dumps({'service': body_dict})
resp, body = self.post("services", body)
+ self.expected_success(201, resp.status)
body = json.loads(body)
return resp, body["service"]
def delete_service(self, serv_id):
url = "services/" + serv_id
resp, body = self.delete(url)
+ self.expected_success(204, resp.status)
return resp, body
diff --git a/tempest/services/identity/v3/xml/identity_client.py b/tempest/services/identity/v3/xml/identity_client.py
index 35295d7..242b032 100644
--- a/tempest/services/identity/v3/xml/identity_client.py
+++ b/tempest/services/identity/v3/xml/identity_client.py
@@ -104,12 +104,13 @@
project_id=project_id,
domain_id=domain_id)
resp, body = self.post('users', str(common.Document(post_body)))
+ self.expected_success(201, resp.status)
body = self._parse_body(etree.fromstring(body))
return resp, body
def update_user(self, user_id, name, **kwargs):
"""Updates a user."""
- resp, body = self.get_user(user_id)
+ _, body = self.get_user(user_id)
email = kwargs.get('email', body['email'])
en = kwargs.get('enabled', body['enabled'])
project_id = kwargs.get('project_id', body['project_id'])
@@ -125,30 +126,35 @@
enabled=str(en).lower())
resp, body = self.patch('users/%s' % user_id,
str(common.Document(update_user)))
+ self.expected_success(200, resp.status)
body = self._parse_body(etree.fromstring(body))
return resp, body
def list_user_projects(self, user_id):
"""Lists the projects on which a user has roles assigned."""
resp, body = self.get('users/%s/projects' % user_id)
+ self.expected_success(200, resp.status)
body = self._parse_projects(etree.fromstring(body))
return resp, body
def get_users(self):
"""Get the list of users."""
resp, body = self.get("users")
+ self.expected_success(200, resp.status)
body = self._parse_array(etree.fromstring(body))
return 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 = self._parse_body(etree.fromstring(body))
return resp, body
def delete_user(self, user_id):
"""Deletes a User."""
resp, body = self.delete("users/%s" % user_id)
+ self.expected_success(204, resp.status)
return resp, body
def create_project(self, name, **kwargs):
@@ -164,12 +170,14 @@
name=name)
resp, body = self.post('projects',
str(common.Document(post_body)))
+ self.expected_success(201, resp.status)
body = self._parse_body(etree.fromstring(body))
return resp, body
def list_projects(self):
"""Get the list of projects."""
resp, body = self.get("projects")
+ self.expected_success(200, resp.status)
body = self._parse_projects(etree.fromstring(body))
return resp, body
@@ -188,18 +196,21 @@
domain_id=domain_id)
resp, body = self.patch('projects/%s' % project_id,
str(common.Document(post_body)))
+ self.expected_success(200, resp.status)
body = self._parse_body(etree.fromstring(body))
return 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 = self._parse_body(etree.fromstring(body))
return resp, body
def delete_project(self, project_id):
"""Delete a project."""
resp, body = self.delete('projects/%s' % str(project_id))
+ self.expected_success(204, resp.status)
return resp, body
def create_role(self, name):
@@ -208,18 +219,21 @@
xmlns=XMLNS,
name=name)
resp, body = self.post('roles', str(common.Document(post_body)))
+ self.expected_success(201, resp.status)
body = self._parse_body(etree.fromstring(body))
return 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 = self._parse_body(etree.fromstring(body))
return resp, body
def list_roles(self):
"""Get the list of Roles."""
resp, body = self.get("roles")
+ self.expected_success(200, resp.status)
body = self._parse_roles(etree.fromstring(body))
return resp, body
@@ -230,18 +244,21 @@
name=name)
resp, body = self.patch('roles/%s' % str(role_id),
str(common.Document(post_body)))
+ self.expected_success(200, resp.status)
body = self._parse_body(etree.fromstring(body))
return resp, body
def delete_role(self, role_id):
"""Delete a role."""
resp, body = self.delete('roles/%s' % str(role_id))
+ self.expected_success(204, resp.status)
return resp, body
def assign_user_role(self, project_id, user_id, role_id):
"""Add roles to a user on a tenant."""
resp, body = self.put('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id), '')
+ self.expected_success(204, resp.status)
return resp, body
def create_domain(self, name, **kwargs):
@@ -254,23 +271,26 @@
description=description,
enabled=str(en).lower())
resp, body = self.post('domains', str(common.Document(post_body)))
+ self.expected_success(201, resp.status)
body = self._parse_body(etree.fromstring(body))
return resp, body
def list_domains(self):
"""Get the list of domains."""
resp, body = self.get("domains")
+ self.expected_success(200, resp.status)
body = self._parse_domains(etree.fromstring(body))
return resp, body
def delete_domain(self, domain_id):
"""Delete a domain."""
resp, body = self.delete('domains/%s' % domain_id)
+ self.expected_success(204, resp.status)
return resp, body
def update_domain(self, domain_id, **kwargs):
"""Updates a domain."""
- resp, body = self.get_domain(domain_id)
+ _, body = self.get_domain(domain_id)
description = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
name = kwargs.get('name', body['name'])
@@ -281,12 +301,14 @@
enabled=str(en).lower())
resp, body = self.patch('domains/%s' % domain_id,
str(common.Document(post_body)))
+ self.expected_success(200, resp.status)
body = self._parse_body(etree.fromstring(body))
return 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 = self._parse_body(etree.fromstring(body))
return resp, body
@@ -296,6 +318,7 @@
'Accept': 'application/xml',
'X-Subject-Token': resp_token}
resp, body = self.get("auth/tokens", headers=headers)
+ self.expected_success(200, resp.status)
body = self._parse_body(etree.fromstring(body))
return resp, body
@@ -303,6 +326,7 @@
"""Delete a Given Token."""
headers = {'X-Subject-Token': resp_token}
resp, body = self.delete("auth/tokens", headers=headers)
+ self.expected_success(204, resp.status)
return resp, body
def create_group(self, name, **kwargs):
@@ -317,18 +341,20 @@
domain_id=domain_id,
project_id=project_id)
resp, body = self.post('groups', str(common.Document(post_body)))
+ self.expected_success(201, resp.status)
body = self._parse_body(etree.fromstring(body))
return 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 = self._parse_body(etree.fromstring(body))
return resp, body
def update_group(self, group_id, **kwargs):
"""Updates a group."""
- resp, body = self.get_group(group_id)
+ _, body = self.get_group(group_id)
name = kwargs.get('name', body['name'])
description = kwargs.get('description', body['description'])
post_body = common.Element("group",
@@ -337,52 +363,61 @@
description=description)
resp, body = self.patch('groups/%s' % group_id,
str(common.Document(post_body)))
+ self.expected_success(200, resp.status)
body = self._parse_body(etree.fromstring(body))
return resp, body
def delete_group(self, group_id):
"""Delete a group."""
resp, body = self.delete('groups/%s' % group_id)
+ self.expected_success(204, resp.status)
return resp, body
def add_group_user(self, group_id, user_id):
"""Add user into group."""
resp, body = self.put('groups/%s/users/%s' % (group_id, user_id), '')
+ self.expected_success(204, resp.status)
return resp, body
def list_group_users(self, group_id):
"""List users in group."""
resp, body = self.get('groups/%s/users' % group_id)
+ self.expected_success(200, resp.status)
body = self._parse_group_users(etree.fromstring(body))
return resp, body
def list_user_groups(self, user_id):
"""Lists the groups which a user belongs to."""
resp, body = self.get('users/%s/groups' % user_id)
+ self.expected_success(200, resp.status)
body = self._parse_groups(etree.fromstring(body))
return resp, body
def delete_group_user(self, group_id, user_id):
"""Delete user in group."""
resp, body = self.delete('groups/%s/users/%s' % (group_id, user_id))
+ self.expected_success(204, resp.status)
return resp, body
def assign_user_role_on_project(self, project_id, user_id, role_id):
"""Add roles to a user on a project."""
resp, body = self.put('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id), '')
+ self.expected_success(204, resp.status)
return resp, body
def assign_user_role_on_domain(self, domain_id, user_id, role_id):
"""Add roles to a user on a domain."""
resp, body = self.put('domains/%s/users/%s/roles/%s' %
(domain_id, user_id, role_id), '')
+ self.expected_success(204, resp.status)
return resp, body
def list_user_roles_on_project(self, project_id, user_id):
"""list roles of a user on a project."""
resp, body = self.get('projects/%s/users/%s/roles' %
(project_id, user_id))
+ self.expected_success(200, resp.status)
body = self._parse_roles(etree.fromstring(body))
return resp, body
@@ -390,6 +425,7 @@
"""list roles of a user on a domain."""
resp, body = self.get('domains/%s/users/%s/roles' %
(domain_id, user_id))
+ self.expected_success(200, resp.status)
body = self._parse_roles(etree.fromstring(body))
return resp, body
@@ -397,30 +433,35 @@
"""Delete role of a user on a project."""
resp, body = self.delete('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id))
+ self.expected_success(204, resp.status)
return resp, body
def revoke_role_from_user_on_domain(self, domain_id, user_id, role_id):
"""Delete role of a user on a domain."""
resp, body = self.delete('domains/%s/users/%s/roles/%s' %
(domain_id, user_id, role_id))
+ self.expected_success(204, resp.status)
return resp, body
def assign_group_role_on_project(self, project_id, group_id, role_id):
"""Add roles to a user on a project."""
resp, body = self.put('projects/%s/groups/%s/roles/%s' %
(project_id, group_id, role_id), '')
+ self.expected_success(204, resp.status)
return resp, body
def assign_group_role_on_domain(self, domain_id, group_id, role_id):
"""Add roles to a user on a domain."""
resp, body = self.put('domains/%s/groups/%s/roles/%s' %
(domain_id, group_id, role_id), '')
+ self.expected_success(204, resp.status)
return resp, body
def list_group_roles_on_project(self, project_id, group_id):
"""list roles of a user on a project."""
resp, body = self.get('projects/%s/groups/%s/roles' %
(project_id, group_id))
+ self.expected_success(200, resp.status)
body = self._parse_roles(etree.fromstring(body))
return resp, body
@@ -428,6 +469,7 @@
"""list roles of a user on a domain."""
resp, body = self.get('domains/%s/groups/%s/roles' %
(domain_id, group_id))
+ self.expected_success(200, resp.status)
body = self._parse_roles(etree.fromstring(body))
return resp, body
@@ -435,12 +477,14 @@
"""Delete role of a user on a project."""
resp, body = self.delete('projects/%s/groups/%s/roles/%s' %
(project_id, group_id, role_id))
+ self.expected_success(204, resp.status)
return resp, body
def revoke_role_from_group_on_domain(self, domain_id, group_id, role_id):
"""Delete role of a user on a domain."""
resp, body = self.delete('domains/%s/groups/%s/roles/%s' %
(domain_id, group_id, role_id))
+ self.expected_success(204, resp.status)
return resp, body
diff --git a/tempest/services/identity/v3/xml/region_client.py b/tempest/services/identity/v3/xml/region_client.py
index 9f9161d..f854138 100644
--- a/tempest/services/identity/v3/xml/region_client.py
+++ b/tempest/services/identity/v3/xml/region_client.py
@@ -1,4 +1,4 @@
-# Copyright 2014 OpenStack Foundation
+# Copyright 2014 Hewlett-Packard Development Company, L.P
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
diff --git a/tempest/services/identity/v3/xml/service_client.py b/tempest/services/identity/v3/xml/service_client.py
index 37ed892..3beeb89 100644
--- a/tempest/services/identity/v3/xml/service_client.py
+++ b/tempest/services/identity/v3/xml/service_client.py
@@ -51,6 +51,7 @@
type=type)
resp, body = self.patch('services/%s' % service_id,
str(common.Document(update_service)))
+ self.expected_success(200, resp.status)
body = self._parse_body(etree.fromstring(body))
return resp, body
@@ -58,6 +59,7 @@
"""Get Service."""
url = 'services/%s' % service_id
resp, body = self.get(url)
+ self.expected_success(200, resp.status)
body = self._parse_body(etree.fromstring(body))
return resp, body
@@ -68,10 +70,12 @@
description=description,
type=serv_type)
resp, body = self.post("services", str(common.Document(post_body)))
+ self.expected_success(201, resp.status)
body = self._parse_body(etree.fromstring(body))
return resp, body
def delete_service(self, serv_id):
url = "services/" + serv_id
resp, body = self.delete(url)
+ self.expected_success(204, resp.status)
return resp, body
diff --git a/tempest/services/identity/xml/identity_client.py b/tempest/services/identity/xml/identity_client.py
index 886ce7b..4ada46c 100644
--- a/tempest/services/identity/xml/identity_client.py
+++ b/tempest/services/identity/xml/identity_client.py
@@ -29,11 +29,13 @@
create_role = xml.Element("role", xmlns=XMLNS, name=name)
resp, body = self.post('OS-KSADM/roles',
str(xml.Document(create_role)))
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def get_role(self, role_id):
"""Get a role by its id."""
resp, body = self.get('OS-KSADM/roles/%s' % role_id)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def create_tenant(self, name, **kwargs):
@@ -50,16 +52,18 @@
description=kwargs.get('description', ''),
enabled=str(en).lower())
resp, body = self.post('tenants', str(xml.Document(create_tenant)))
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def list_tenants(self):
"""Returns tenants."""
resp, body = self.get('tenants')
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def update_tenant(self, tenant_id, **kwargs):
"""Updates a tenant."""
- resp, body = self.get_tenant(tenant_id)
+ _, body = self.get_tenant(tenant_id)
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
@@ -72,6 +76,7 @@
resp, body = self.post('tenants/%s' % tenant_id,
str(xml.Document(update_tenant)))
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def create_user(self, name, password, tenant_id, email, **kwargs):
@@ -87,6 +92,7 @@
create_user.add_attr('enabled', str(kwargs['enabled']).lower())
resp, body = self.post('users', str(xml.Document(create_user)))
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def update_user(self, user_id, **kwargs):
@@ -97,6 +103,7 @@
resp, body = self.put('users/%s' % user_id,
str(xml.Document(update_user)))
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def enable_disable_user(self, user_id, enabled):
@@ -104,6 +111,7 @@
enable_user = xml.Element("user", enabled=str(enabled).lower())
resp, body = self.put('users/%s/enabled' % user_id,
str(xml.Document(enable_user)))
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def create_service(self, name, service_type, **kwargs):
@@ -116,6 +124,7 @@
description=kwargs.get('description'))
resp, body = self.post('OS-KSADM/services',
str(xml.Document(create_service)))
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def update_user_password(self, user_id, new_pass):
@@ -125,11 +134,13 @@
password=new_pass)
resp, body = self.put('users/%s/OS-KSADM/password' % user_id,
str(xml.Document(put_body)))
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def list_extensions(self):
"""List all the extensions."""
resp, body = self.get('/extensions')
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
diff --git a/tox.ini b/tox.ini
index 7f69fad..4f2465a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -84,6 +84,11 @@
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
+[testenv:docs]
+commands = python setup.py build_sphinx {posargs}
+deps = -r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+
[testenv:pep8]
commands =
flake8 {posargs}