refactor v3 cred tests to work with pre-prov

This commit aims to use existing credentials to execute tests:
  * test_credentials_list_delete
  * test_credentials_create_get_update_delete
so that users with a cloud using the pre-provisioned credential
provider can execute these tests.

Change-Id: Ida753ad4f550eeeec47b6f34b73c936b0eab3d71
Partial-Bug: #1714277
This commit is contained in:
mccasland, trevor (tm2086) 2018-07-11 16:36:04 -05:00 committed by Trevor McCasland
parent 9a95eb84ea
commit c59d113a0f
1 changed files with 6 additions and 10 deletions

View File

@ -20,6 +20,10 @@ from tempest.lib import decorators
class CredentialsTestJSON(base.BaseIdentityV3AdminTest):
# NOTE: force_tenant_isolation is true in the base class by default but
# overridden to false here to allow test execution for clouds using the
# pre-provisioned credentials provider.
force_tenant_isolation = False
@classmethod
def resource_setup(cls):
@ -27,10 +31,6 @@ class CredentialsTestJSON(base.BaseIdentityV3AdminTest):
cls.projects = list()
cls.creds_list = [['project_id', 'user_id', 'id'],
['access', 'secret']]
u_name = data_utils.rand_name('user')
u_desc = '%s description' % u_name
u_email = '%s@testmail.tm' % u_name
u_password = data_utils.rand_password()
for _ in range(2):
project = cls.projects_client.create_project(
data_utils.rand_name('project'),
@ -38,12 +38,8 @@ class CredentialsTestJSON(base.BaseIdentityV3AdminTest):
cls.addClassResourceCleanup(
cls.projects_client.delete_project, project['id'])
cls.projects.append(project['id'])
cls.user_body = cls.users_client.create_user(
name=u_name, description=u_desc, password=u_password,
email=u_email, project_id=cls.projects[0])['user']
cls.addClassResourceCleanup(
cls.users_client.delete_user, cls.user_body['id'])
cls.user_body = cls.users_client.show_user(
cls.os_primary.credentials.user_id)['user']
def _delete_credential(self, cred_id):
self.creds_client.delete_credential(cred_id)