Merge "Apply a naming rule of GET to v2 keystone clients"

This commit is contained in:
Jenkins 2015-11-11 08:42:19 +00:00 committed by Gerrit Code Review
commit c8f2fda785
23 changed files with 57 additions and 57 deletions

View File

@ -76,7 +76,7 @@ class RolesTestJSON(base.BaseIdentityV2AdminTest):
self.data.setup_test_role()
role_id = self.data.role['id']
role_name = self.data.role['name']
body = self.client.get_role(role_id)['role']
body = self.client.show_role(role_id)['role']
self.assertEqual(role_id, body['id'])
self.assertEqual(role_name, body['name'])

View File

@ -27,7 +27,7 @@ class ServicesTestJSON(base.BaseIdentityV2AdminTest):
# Deleting the service created in this method
self.client.delete_service(service_id)
# Checking whether service is deleted successfully
self.assertRaises(lib_exc.NotFound, self.client.get_service,
self.assertRaises(lib_exc.NotFound, self.client.show_service,
service_id)
@test.idempotent_id('84521085-c6e6-491c-9a08-ec9f70f90110')
@ -50,7 +50,7 @@ class ServicesTestJSON(base.BaseIdentityV2AdminTest):
self.assertIn('description', service_data)
self.assertEqual(description, service_data['description'])
# Get service
fetched_service = (self.client.get_service(service_data['id'])
fetched_service = (self.client.show_service(service_data['id'])
['OS-KSADM:service'])
# verifying the existence of service created
self.assertIn('id', fetched_service)

View File

@ -57,7 +57,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
desc1 = body['description']
self.assertEqual(desc1, tenant_desc, 'Description should have '
'been sent in response for create')
body = self.client.get_tenant(tenant_id)['tenant']
body = self.client.show_tenant(tenant_id)['tenant']
desc2 = body['description']
self.assertEqual(desc2, tenant_desc, 'Description does not appear'
'to be set')
@ -74,7 +74,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
tenant_id = body['id']
en1 = body['enabled']
self.assertTrue(en1, 'Enable should be True in response')
body = self.client.get_tenant(tenant_id)['tenant']
body = self.client.show_tenant(tenant_id)['tenant']
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
self.client.delete_tenant(tenant_id)
@ -91,7 +91,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
en1 = body['enabled']
self.assertEqual('false', str(en1).lower(),
'Enable should be False in response')
body = self.client.get_tenant(tenant_id)['tenant']
body = self.client.show_tenant(tenant_id)['tenant']
en2 = body['enabled']
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
@ -114,7 +114,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
resp2_name = body['name']
self.assertNotEqual(resp1_name, resp2_name)
body = self.client.get_tenant(t_id)['tenant']
body = self.client.show_tenant(t_id)['tenant']
resp3_name = body['name']
self.assertNotEqual(resp1_name, resp3_name)
@ -141,7 +141,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
resp2_desc = body['description']
self.assertNotEqual(resp1_desc, resp2_desc)
body = self.client.get_tenant(t_id)['tenant']
body = self.client.show_tenant(t_id)['tenant']
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
@ -168,7 +168,7 @@ class TenantsTestJSON(base.BaseIdentityV2AdminTest):
resp2_en = body['enabled']
self.assertNotEqual(resp1_en, resp2_en)
body = self.client.get_tenant(t_id)['tenant']
body = self.client.show_tenant(t_id)['tenant']
resp3_en = body['enabled']
self.assertNotEqual(resp1_en, resp3_en)

View File

@ -41,7 +41,7 @@ class TokensTestJSON(base.BaseIdentityV2AdminTest):
tenant['name'])
# Perform GET Token
token_id = body['token']['id']
token_details = self.client.get_token(token_id)['access']
token_details = self.client.show_token(token_id)['access']
self.assertEqual(token_id, token_details['token']['id'])
self.assertEqual(user['id'], token_details['user']['id'])
self.assertEqual(user_name, token_details['user']['name'])

View File

@ -73,7 +73,7 @@ class UsersTestJSON(base.BaseIdentityV2AdminTest):
self.assertEqual(u_email2, update_user['email'])
self.assertEqual(False, update_user['enabled'])
# GET by id after updating
updated_user = self.client.get_user(user['id'])['user']
updated_user = self.client.show_user(user['id'])['user']
# Assert response body of GET after updating
self.assertEqual(u_name2, updated_user['name'])
self.assertEqual(u_email2, updated_user['email'])
@ -121,7 +121,7 @@ class UsersTestJSON(base.BaseIdentityV2AdminTest):
def test_get_users(self):
# Get a list of users and find the test user
self.data.setup_test_user()
users = self.client.get_users()['users']
users = self.client.list_users()['users']
self.assertThat([u['name'] for u in users],
matchers.Contains(self.data.test_user),
"Could not find %s" % self.data.test_user)

View File

@ -222,7 +222,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
# Non-administrator user should not be authorized to get user list
self.data.setup_test_user()
self.assertRaises(lib_exc.Forbidden,
self.non_admin_client.get_users)
self.non_admin_client.list_users)
@test.attr(type=['negative'])
@test.idempotent_id('a73591ec-1903-4ffe-be42-282b39fefc9d')
@ -230,7 +230,7 @@ class UsersNegativeTestJSON(base.BaseIdentityV2AdminTest):
# Request to get list of users without a valid token should fail
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
self.assertRaises(lib_exc.Unauthorized, self.client.get_users)
self.assertRaises(lib_exc.Unauthorized, self.client.list_users)
self.client.auth_provider.clear_auth()
@test.attr(type=['negative'])

View File

@ -83,6 +83,6 @@ class TestDefaultProjectId (base.BaseIdentityV3AdminTest):
# verify the user's token and see that it is scoped to the project
token, auth_data = admin_client.auth_provider.get_auth()
result = admin_client.identity_v3_client.get_token(token)['token']
result = admin_client.identity_v3_client.show_token(token)['token']
self.assertEqual(result['project']['domain']['id'], dom_id)
self.assertEqual(result['project']['id'], proj_id)

View File

@ -25,7 +25,7 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
# assert the response based on expected and not_expected
# expected: user expected in the list response
# not_expected: user, which should not be present in list response
body = self.client.get_users(params)['users']
body = self.client.list_users(params)['users']
self.assertIn(expected[key], map(lambda x: x[key], body))
self.assertNotIn(not_expected[key],
map(lambda x: x[key], body))
@ -77,7 +77,7 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
@test.idempotent_id('b30d4651-a2ea-4666-8551-0c0e49692635')
def test_list_users(self):
# List users
body = self.client.get_users()['users']
body = self.client.list_users()['users']
fetched_ids = [u['id'] for u in body]
missing_users = [u['id'] for u in self.data.v3_users
if u['id'] not in fetched_ids]
@ -88,7 +88,7 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
@test.idempotent_id('b4baa3ae-ac00-4b4e-9e27-80deaad7771f')
def test_get_user(self):
# Get a user detail
user = self.client.get_user(self.data.v3_users[0]['id'])['user']
user = self.client.show_user(self.data.v3_users[0]['id'])['user']
self.assertEqual(self.data.v3_users[0]['id'], user['id'])
self.assertEqual(self.data.v3_users[0]['name'], user['name'])
self.assertEqual(self.alt_email, user['email'])

View File

@ -169,7 +169,7 @@ class ProjectsTestJSON(base.BaseIdentityV3AdminTest):
self.addCleanup(self.client.delete_user, user['id'])
# Get User To validate the user details
new_user_get = self.client.get_user(user['id'])['user']
new_user_get = self.client.show_user(user['id'])['user']
# Assert response body of GET
self.assertEqual(u_name, new_user_get['name'])
self.assertEqual(u_desc, new_user_get['description'])

View File

@ -81,7 +81,7 @@ class RolesV3TestJSON(base.BaseIdentityV3AdminTest):
self.assertIn('links', updated_role)
self.assertNotEqual(r_name, updated_role['name'])
new_role = self.client.get_role(role['id'])['role']
new_role = self.client.show_role(role['id'])['role']
self.assertEqual(new_name, new_role['name'])
self.assertEqual(updated_role['id'], new_role['id'])

View File

@ -26,7 +26,7 @@ class ServicesTestJSON(base.BaseIdentityV3AdminTest):
# Used for deleting the services created in this class
self.service_client.delete_service(service_id)
# Checking whether service is deleted successfully
self.assertRaises(lib_exc.NotFound, self.service_client.get_service,
self.assertRaises(lib_exc.NotFound, self.service_client.show_service,
service_id)
@test.attr(type='smoke')
@ -56,7 +56,7 @@ class ServicesTestJSON(base.BaseIdentityV3AdminTest):
self.assertNotEqual(resp1_desc, resp2_desc)
# Get service
fetched_service = self.service_client.get_service(s_id)['service']
fetched_service = self.service_client.show_service(s_id)['service']
resp3_desc = fetched_service['description']
self.assertEqual(resp2_desc, resp3_desc)

View File

@ -39,13 +39,13 @@ class TokensV3TestJSON(base.BaseIdentityV3AdminTest):
password=u_password).response
subject_token = resp['x-subject-token']
# Perform GET Token
token_details = self.client.get_token(subject_token)['token']
token_details = self.client.show_token(subject_token)['token']
self.assertEqual(resp['x-subject-token'], subject_token)
self.assertEqual(token_details['user']['id'], user['id'])
self.assertEqual(token_details['user']['name'], u_name)
# Perform Delete Token
self.client.delete_token(subject_token)
self.assertRaises(lib_exc.NotFound, self.client.get_token,
self.assertRaises(lib_exc.NotFound, self.client.show_token,
subject_token)
@test.idempotent_id('565fa210-1da1-4563-999b-f7b5b67cf112')

View File

@ -54,7 +54,7 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
self.assertEqual(u_email2, update_user['email'])
self.assertEqual(False, update_user['enabled'])
# GET by id after updation
new_user_get = self.client.get_user(user['id'])['user']
new_user_get = self.client.show_user(user['id'])['user']
# Assert response body of GET after updation
self.assertEqual(u_name2, new_user_get['name'])
self.assertEqual(u_description2, new_user_get['description'])
@ -80,7 +80,7 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
password=new_password).response
subject_token = resp['x-subject-token']
# Perform GET Token to verify and confirm password is updated
token_details = self.client.get_token(subject_token)['token']
token_details = self.client.show_token(subject_token)['token']
self.assertEqual(resp['x-subject-token'], subject_token)
self.assertEqual(token_details['user']['id'], user['id'])
self.assertEqual(token_details['user']['name'], u_name)
@ -111,8 +111,8 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
# Delete the Role at the end of this method
self.addCleanup(self.client.delete_role, role_body['id'])
user = self.client.get_user(user_body['id'])['user']
role = self.client.get_role(role_body['id'])['role']
user = self.client.show_user(user_body['id'])['user']
role = self.client.show_role(role_body['id'])['role']
for i in range(2):
# Creating project so as to assign role
project_body = self.client.create_project(
@ -142,5 +142,5 @@ class UsersV3TestJSON(base.BaseIdentityV3AdminTest):
def test_get_user(self):
# Get a user detail
self.data.setup_test_v3_user()
user = self.client.get_user(self.data.v3_user['id'])['user']
user = self.client.show_user(self.data.v3_user['id'])['user']
self.assertEqual(self.data.v3_user['id'], user['id'])

View File

@ -39,7 +39,7 @@ class BaseIdentityTest(tempest.test.BaseTestCase):
@classmethod
def get_user_by_name(cls, name):
users = cls.client.get_users()['users']
users = cls.client.list_users()['users']
user = [u for u in users if u['name'] == name]
if len(user) > 0:
return user[0]
@ -154,7 +154,7 @@ class BaseIdentityV3AdminTest(BaseIdentityV3Test):
@classmethod
def get_user_by_name(cls, name):
users = cls.client.get_users()['users']
users = cls.client.list_users()['users']
user = [u for u in users if u['name'] == name]
if len(user) > 0:
return user[0]

View File

@ -23,7 +23,7 @@ class TestApiDiscovery(base.BaseIdentityV2Test):
@test.attr(type='smoke')
@test.idempotent_id('ea889a68-a15f-4166-bfb1-c12456eae853')
def test_api_version_resources(self):
descr = self.non_admin_client.get_api_description()['version']
descr = self.non_admin_client.show_api_description()['version']
expected_resources = ('id', 'links', 'media-types', 'status',
'updated')
@ -34,7 +34,7 @@ class TestApiDiscovery(base.BaseIdentityV2Test):
@test.attr(type='smoke')
@test.idempotent_id('007a0be0-78fe-4fdb-bbee-e9216cc17bb2')
def test_api_media_types(self):
descr = self.non_admin_client.get_api_description()['version']
descr = self.non_admin_client.show_api_description()['version']
# Get MIME type bases and descriptions
media_types = [(media_type['base'], media_type['type']) for
media_type in descr['media-types']]
@ -49,7 +49,7 @@ class TestApiDiscovery(base.BaseIdentityV2Test):
@test.attr(type='smoke')
@test.idempotent_id('77fd6be0-8801-48e6-b9bf-38cdd2f253ec')
def test_api_version_statuses(self):
descr = self.non_admin_client.get_api_description()['version']
descr = self.non_admin_client.show_api_description()['version']
status = descr['status'].lower()
supported_statuses = ['current', 'stable', 'experimental',
'supported', 'deprecated']

View File

@ -23,7 +23,7 @@ class TestApiDiscovery(base.BaseIdentityV3Test):
@test.attr(type='smoke')
@test.idempotent_id('b9232f5e-d9e5-4d97-b96c-28d3db4de1bd')
def test_api_version_resources(self):
descr = self.non_admin_client.get_api_description()['version']
descr = self.non_admin_client.show_api_description()['version']
expected_resources = ('id', 'links', 'media-types', 'status',
'updated')
@ -34,7 +34,7 @@ class TestApiDiscovery(base.BaseIdentityV3Test):
@test.attr(type='smoke')
@test.idempotent_id('657c1970-4722-4189-8831-7325f3bc4265')
def test_api_media_types(self):
descr = self.non_admin_client.get_api_description()['version']
descr = self.non_admin_client.show_api_description()['version']
# Get MIME type bases and descriptions
media_types = [(media_type['base'], media_type['type']) for
media_type in descr['media-types']]
@ -49,7 +49,7 @@ class TestApiDiscovery(base.BaseIdentityV3Test):
@test.attr(type='smoke')
@test.idempotent_id('8879a470-abfb-47bb-bb8d-5a7fd279ad1e')
def test_api_version_statuses(self):
descr = self.non_admin_client.get_api_description()['version']
descr = self.non_admin_client.show_api_description()['version']
status = descr['status'].lower()
supported_statuses = ['current', 'stable', 'experimental',
'supported', 'deprecated']

View File

@ -247,7 +247,7 @@ class TempestCleanup(command.Command):
def _tenant_exists(self, tenant_id):
id_cl = self.admin_mgr.identity_client
try:
t = id_cl.get_tenant(tenant_id)
t = id_cl.show_tenant(tenant_id)
LOG.debug("Tenant is: %s" % str(t))
return True
except Exception as ex:

View File

@ -814,7 +814,7 @@ class UserService(IdentityService):
def list(self):
client = self.client
users = client.get_users()['users']
users = client.list_users()['users']
if not self.is_save_state:
users = [user for user in users if user['id']

View File

@ -432,7 +432,7 @@ class JavelinCheck(unittest.TestCase):
LOG.info("checking users")
for name, user in six.iteritems(self.users):
client = keystone_admin()
found = client.identity.get_user(user['id'])['user']
found = client.identity.show_user(user['id'])['user']
self.assertEqual(found['name'], user['name'])
self.assertEqual(found['tenantId'], user['tenant_id'])

View File

@ -19,7 +19,7 @@ from tempest.common import service_client
class IdentityClient(service_client.ServiceClient):
api_version = "v2.0"
def get_api_description(self):
def show_api_description(self):
"""Retrieves info about the v2.0 Identity API"""
url = ''
resp, body = self.get(url)
@ -38,7 +38,7 @@ class IdentityClient(service_client.ServiceClient):
body = json.loads(body)
return service_client.ResponseBody(resp, body)
def get_role(self, role_id):
def show_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)
@ -98,7 +98,7 @@ class IdentityClient(service_client.ServiceClient):
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
def get_tenant(self, tenant_id):
def show_tenant(self, tenant_id):
"""Get tenant details."""
resp, body = self.get('tenants/%s' % str(tenant_id))
self.expected_success(200, resp.status)
@ -128,7 +128,7 @@ class IdentityClient(service_client.ServiceClient):
def update_tenant(self, tenant_id, **kwargs):
"""Updates a tenant."""
body = self.get_tenant(tenant_id)['tenant']
body = self.show_tenant(tenant_id)['tenant']
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
@ -169,7 +169,7 @@ class IdentityClient(service_client.ServiceClient):
body = json.loads(body)
return service_client.ResponseBody(resp, body)
def get_user(self, user_id):
def show_user(self, user_id):
"""GET a user."""
resp, body = self.get("users/%s" % user_id)
self.expected_success(200, resp.status)
@ -182,7 +182,7 @@ class IdentityClient(service_client.ServiceClient):
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
def get_users(self):
def list_users(self):
"""Get the list of users."""
resp, body = self.get("users")
self.expected_success(200, resp.status)
@ -200,7 +200,7 @@ class IdentityClient(service_client.ServiceClient):
body = json.loads(body)
return service_client.ResponseBody(resp, body)
def get_token(self, token_id):
def show_token(self, token_id):
"""Get token details."""
resp, body = self.get("tokens/%s" % token_id)
self.expected_success(200, resp.status)
@ -240,7 +240,7 @@ class IdentityClient(service_client.ServiceClient):
body = json.loads(body)
return service_client.ResponseBody(resp, body)
def get_service(self, service_id):
def show_service(self, service_id):
"""Get Service."""
url = '/OS-KSADM/services/%s' % service_id
resp, body = self.get(url)

View File

@ -22,7 +22,7 @@ from tempest.common import service_client
class IdentityV3Client(service_client.ServiceClient):
api_version = "v3"
def get_api_description(self):
def show_api_description(self):
"""Retrieves info about the v3 Identity API"""
url = ''
resp, body = self.get(url)
@ -54,7 +54,7 @@ class IdentityV3Client(service_client.ServiceClient):
def update_user(self, user_id, name, **kwargs):
"""Updates a user."""
body = self.get_user(user_id)['user']
body = self.show_user(user_id)['user']
email = kwargs.get('email', body['email'])
en = kwargs.get('enabled', body['enabled'])
project_id = kwargs.get('project_id', body['project_id'])
@ -99,7 +99,7 @@ class IdentityV3Client(service_client.ServiceClient):
body = json.loads(body)
return service_client.ResponseBody(resp, body)
def get_users(self, params=None):
def list_users(self, params=None):
"""Get the list of users."""
url = 'users'
if params:
@ -109,7 +109,7 @@ class IdentityV3Client(service_client.ServiceClient):
body = json.loads(body)
return service_client.ResponseBody(resp, body)
def get_user(self, user_id):
def show_user(self, user_id):
"""GET a user."""
resp, body = self.get("users/%s" % user_id)
self.expected_success(200, resp.status)
@ -191,7 +191,7 @@ class IdentityV3Client(service_client.ServiceClient):
body = json.loads(body)
return service_client.ResponseBody(resp, body)
def get_role(self, role_id):
def show_role(self, role_id):
"""GET a Role."""
resp, body = self.get('roles/%s' % str(role_id))
self.expected_success(200, resp.status)
@ -284,7 +284,7 @@ class IdentityV3Client(service_client.ServiceClient):
body = json.loads(body)
return service_client.ResponseBody(resp, body)
def get_token(self, resp_token):
def show_token(self, resp_token):
"""Get token details."""
headers = {'X-Subject-Token': resp_token}
resp, body = self.get("auth/tokens", headers=headers)

View File

@ -23,7 +23,7 @@ class ServiceClient(service_client.ServiceClient):
def update_service(self, service_id, **kwargs):
"""Updates a service."""
body = self.get_service(service_id)['service']
body = self.show_service(service_id)['service']
name = kwargs.get('name', body['name'])
type = kwargs.get('type', body['type'])
desc = kwargs.get('description', body['description'])
@ -38,7 +38,7 @@ class ServiceClient(service_client.ServiceClient):
body = json.loads(body)
return service_client.ResponseBody(resp, body)
def get_service(self, service_id):
def show_service(self, service_id):
"""Get Service."""
url = 'services/%s' % service_id
resp, body = self.get(url)

View File

@ -68,7 +68,7 @@ def cleanup():
except Exception:
pass
users = admin_manager.identity_client.get_users()['users']
users = admin_manager.identity_client.list_users()['users']
LOG.info("Cleanup::remove %s users" % len(users))
for user in users:
if user['name'].startswith("stress_user"):