From 402b8755e7e0e055faf157733756a390f4f73b3d Mon Sep 17 00:00:00 2001 From: Ken'ichi Ohmichi Date: Mon, 9 Nov 2015 10:47:16 +0000 Subject: [PATCH] Apply a naming rule of GET to v2 keystone clients [GET /resources] methods should be "list_s" or "show_", so this patch applies the rule to v2 keystone clients. This patch changes some v3 parts also because some tests are shared between v2 and v3 and the method names should be the same. Partially implements blueprint consistent-service-method-names Change-Id: Iea7dcb8839d0dfc300295f3e534d54224f9ec31c --- tempest/api/identity/admin/v2/test_roles.py | 2 +- tempest/api/identity/admin/v2/test_services.py | 4 ++-- tempest/api/identity/admin/v2/test_tenants.py | 12 ++++++------ tempest/api/identity/admin/v2/test_tokens.py | 2 +- tempest/api/identity/admin/v2/test_users.py | 4 ++-- .../api/identity/admin/v2/test_users_negative.py | 4 ++-- .../identity/admin/v3/test_default_project_id.py | 2 +- tempest/api/identity/admin/v3/test_list_users.py | 6 +++--- tempest/api/identity/admin/v3/test_projects.py | 2 +- tempest/api/identity/admin/v3/test_roles.py | 2 +- tempest/api/identity/admin/v3/test_services.py | 4 ++-- tempest/api/identity/admin/v3/test_tokens.py | 4 ++-- tempest/api/identity/admin/v3/test_users.py | 10 +++++----- tempest/api/identity/base.py | 4 ++-- tempest/api/identity/v2/test_api_discovery.py | 6 +++--- tempest/api/identity/v3/test_api_discovery.py | 6 +++--- tempest/cmd/cleanup.py | 2 +- tempest/cmd/cleanup_service.py | 2 +- tempest/cmd/javelin.py | 2 +- .../services/identity/v2/json/identity_client.py | 16 ++++++++-------- .../services/identity/v3/json/identity_client.py | 12 ++++++------ .../services/identity/v3/json/service_client.py | 4 ++-- tempest/stress/cleanup.py | 2 +- 23 files changed, 57 insertions(+), 57 deletions(-) diff --git a/tempest/api/identity/admin/v2/test_roles.py b/tempest/api/identity/admin/v2/test_roles.py index 78beeadcfe..657d72eedf 100644 --- a/tempest/api/identity/admin/v2/test_roles.py +++ b/tempest/api/identity/admin/v2/test_roles.py @@ -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']) diff --git a/tempest/api/identity/admin/v2/test_services.py b/tempest/api/identity/admin/v2/test_services.py index eebeedb1d2..04e15d28d0 100644 --- a/tempest/api/identity/admin/v2/test_services.py +++ b/tempest/api/identity/admin/v2/test_services.py @@ -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) diff --git a/tempest/api/identity/admin/v2/test_tenants.py b/tempest/api/identity/admin/v2/test_tenants.py index 2ec5c4f525..4632b1eb54 100644 --- a/tempest/api/identity/admin/v2/test_tenants.py +++ b/tempest/api/identity/admin/v2/test_tenants.py @@ -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) diff --git a/tempest/api/identity/admin/v2/test_tokens.py b/tempest/api/identity/admin/v2/test_tokens.py index 981a9ead6a..e80899086f 100644 --- a/tempest/api/identity/admin/v2/test_tokens.py +++ b/tempest/api/identity/admin/v2/test_tokens.py @@ -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']) diff --git a/tempest/api/identity/admin/v2/test_users.py b/tempest/api/identity/admin/v2/test_users.py index 6ee5218161..81468283fb 100644 --- a/tempest/api/identity/admin/v2/test_users.py +++ b/tempest/api/identity/admin/v2/test_users.py @@ -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) diff --git a/tempest/api/identity/admin/v2/test_users_negative.py b/tempest/api/identity/admin/v2/test_users_negative.py index 85f7411aa4..6d9d84b130 100644 --- a/tempest/api/identity/admin/v2/test_users_negative.py +++ b/tempest/api/identity/admin/v2/test_users_negative.py @@ -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']) diff --git a/tempest/api/identity/admin/v3/test_default_project_id.py b/tempest/api/identity/admin/v3/test_default_project_id.py index 4c697588c6..53861cabab 100644 --- a/tempest/api/identity/admin/v3/test_default_project_id.py +++ b/tempest/api/identity/admin/v3/test_default_project_id.py @@ -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) diff --git a/tempest/api/identity/admin/v3/test_list_users.py b/tempest/api/identity/admin/v3/test_list_users.py index 320b47987b..b7f37d4945 100644 --- a/tempest/api/identity/admin/v3/test_list_users.py +++ b/tempest/api/identity/admin/v3/test_list_users.py @@ -25,7 +25,7 @@ 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']) diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py index f014307852..d39fd5f06a 100644 --- a/tempest/api/identity/admin/v3/test_projects.py +++ b/tempest/api/identity/admin/v3/test_projects.py @@ -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']) diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py index ffc991a0d5..8595dde6a2 100644 --- a/tempest/api/identity/admin/v3/test_roles.py +++ b/tempest/api/identity/admin/v3/test_roles.py @@ -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']) diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py index d920f64a6b..dfb03df034 100644 --- a/tempest/api/identity/admin/v3/test_services.py +++ b/tempest/api/identity/admin/v3/test_services.py @@ -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) diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py index b5f86da114..7d33d4a139 100644 --- a/tempest/api/identity/admin/v3/test_tokens.py +++ b/tempest/api/identity/admin/v3/test_tokens.py @@ -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') diff --git a/tempest/api/identity/admin/v3/test_users.py b/tempest/api/identity/admin/v3/test_users.py index 8fac0b3679..b56c9e6bc1 100644 --- a/tempest/api/identity/admin/v3/test_users.py +++ b/tempest/api/identity/admin/v3/test_users.py @@ -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']) diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py index 95826b0755..02ede3a282 100644 --- a/tempest/api/identity/base.py +++ b/tempest/api/identity/base.py @@ -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] diff --git a/tempest/api/identity/v2/test_api_discovery.py b/tempest/api/identity/v2/test_api_discovery.py index 57c78ef766..ca807a4205 100644 --- a/tempest/api/identity/v2/test_api_discovery.py +++ b/tempest/api/identity/v2/test_api_discovery.py @@ -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'] diff --git a/tempest/api/identity/v3/test_api_discovery.py b/tempest/api/identity/v3/test_api_discovery.py index e0207a9037..74e9ec1de6 100644 --- a/tempest/api/identity/v3/test_api_discovery.py +++ b/tempest/api/identity/v3/test_api_discovery.py @@ -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'] diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py index 4fa4302a2a..8b84beae80 100644 --- a/tempest/cmd/cleanup.py +++ b/tempest/cmd/cleanup.py @@ -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: diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py index 1b5820b21f..d5834de180 100644 --- a/tempest/cmd/cleanup_service.py +++ b/tempest/cmd/cleanup_service.py @@ -813,7 +813,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'] diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py index f57e75731b..97d431a1bd 100755 --- a/tempest/cmd/javelin.py +++ b/tempest/cmd/javelin.py @@ -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']) diff --git a/tempest/services/identity/v2/json/identity_client.py b/tempest/services/identity/v2/json/identity_client.py index 2d713598ba..8f76c74d02 100644 --- a/tempest/services/identity/v2/json/identity_client.py +++ b/tempest/services/identity/v2/json/identity_client.py @@ -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) diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py index 3f27624fe7..f7913d084e 100644 --- a/tempest/services/identity/v3/json/identity_client.py +++ b/tempest/services/identity/v3/json/identity_client.py @@ -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) diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py index 2acc3a8930..7af6209f7a 100644 --- a/tempest/services/identity/v3/json/service_client.py +++ b/tempest/services/identity/v3/json/service_client.py @@ -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) diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py index 1350d95843..bac19849de 100644 --- a/tempest/stress/cleanup.py +++ b/tempest/stress/cleanup.py @@ -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"):