Use credentials domain instead of creating new one

test_list_projects tests create a new domain and try to test the
list projects operation based on new domain-id. Keystone is
implementing the domain roles functionality for projects resource
- https://review.openstack.org/#/c/624218/

Which means listing the projects with authorized domain only.

This commit modify the tests to use the same domain as requester and
create project with that domain only not new one.

Also add the debug log.

Change-Id: I401815b4a0d3f7ad90801d5580897be870d33013
This commit is contained in:
Ghanshyam Mann 2019-03-12 18:09:26 +00:00 committed by ghanshyam
parent 48ee0fec72
commit ea5efd5c35
1 changed files with 8 additions and 3 deletions

View File

@ -13,11 +13,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log as logging
from tempest.api.identity import base
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
LOG = logging.getLogger(__name__)
CONF = config.CONF
@ -26,6 +29,9 @@ class BaseListProjectsTestJSON(base.BaseIdentityV3AdminTest):
def _list_projects_with_params(self, included, excluded, params, key):
# Validate that projects in ``included`` belongs to the projects
# returned that match ``params`` but not projects in ``excluded``
all_projects = self.projects_client.list_projects()['projects']
LOG.debug("Complete list of projects available in keystone: %s",
all_projects)
body = self.projects_client.list_projects(params)['projects']
for p in included:
self.assertIn(p[key], map(lambda x: x[key], body))
@ -39,13 +45,12 @@ class ListProjectsTestJSON(BaseListProjectsTestJSON):
def resource_setup(cls):
super(ListProjectsTestJSON, cls).resource_setup()
cls.project_ids = list()
# Create a domain
cls.domain = cls.create_domain()
cls.domain_id = cls.os_admin.credentials.domain_id
# Create project with domain
cls.p1_name = data_utils.rand_name('project')
cls.p1 = cls.projects_client.create_project(
cls.p1_name, enabled=False,
domain_id=cls.domain['id'])['project']
domain_id=cls.domain_id)['project']
cls.addClassResourceCleanup(cls.projects_client.delete_project,
cls.p1['id'])
cls.project_ids.append(cls.p1['id'])