Create a new project for trusts tests
The trusts tests were originally being done in the project that the admin
client is scoped to. Change this to creating a new project as this will fail if
the admin client is scoped to a domain instead of a project.
Also specify domain information when creating users and projects. If not
specified the default domain for create_user and create_project is 'default',
however if not specified at authentication time the default user domain is
CONF.identity.admin_domain_name - which may not be default.
Change-Id: I4ab3383f48894d00c1b59abdb97ab483e6ca5270
diff --git a/tempest/api/identity/admin/v3/test_trusts.py b/tempest/api/identity/admin/v3/test_trusts.py
index 9d3d0bc..37d745c 100644
--- a/tempest/api/identity/admin/v3/test_trusts.py
+++ b/tempest/api/identity/admin/v3/test_trusts.py
@@ -45,10 +45,11 @@
super(BaseTrustsV3Test, self).tearDown()
def create_trustor_and_roles(self):
- # Get trustor project ID, use the admin project
- self.trustor_project_name = self.client.tenant_name
- self.trustor_project_id = self.get_tenant_by_name(
- self.trustor_project_name)['id']
+ # create a project that trusts will be granted on
+ self.trustor_project_name = data_utils.rand_name(name='project-')
+ project = self.client.create_project(self.trustor_project_name,
+ domain_id='default')
+ self.trustor_project_id = project['id']
self.assertIsNotNone(self.trustor_project_id)
# Create a trustor User
@@ -61,7 +62,8 @@
description=u_desc,
password=self.trustor_password,
email=u_email,
- project_id=self.trustor_project_id)
+ project_id=self.trustor_project_id,
+ domain_id='default')
self.trustor_user_id = user['id']
# And two roles, one we'll delegate and one we won't
@@ -89,15 +91,20 @@
# Initialize a new client with the trustor credentials
creds = cred_provider.get_credentials(
+ identity_version='v3',
username=self.trustor_username,
password=self.trustor_password,
- tenant_name=self.trustor_project_name)
+ user_domain_id='default',
+ tenant_name=self.trustor_project_name,
+ project_domain_id='default')
os = clients.Manager(credentials=creds)
self.trustor_client = os.identity_v3_client
def cleanup_user_and_roles(self):
if self.trustor_user_id:
self.client.delete_user(self.trustor_user_id)
+ if self.trustor_project_id:
+ self.client.delete_project(self.trustor_project_id)
if self.delegated_role_id:
self.client.delete_role(self.delegated_role_id)
if self.not_delegated_role_id: