Merge "Make some test_list_projects tests work w/ pre-prov"
This commit is contained in:
commit
3fe6cca928
|
@ -14,9 +14,12 @@
|
|||
# under the License.
|
||||
|
||||
from tempest.api.identity import base
|
||||
from tempest import config
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class BaseListProjectsTestJSON(base.BaseIdentityV3AdminTest):
|
||||
|
||||
|
@ -60,34 +63,12 @@ class ListProjectsTestJSON(BaseListProjectsTestJSON):
|
|||
cls.p3['id'])
|
||||
cls.project_ids.append(cls.p3['id'])
|
||||
|
||||
@decorators.idempotent_id('1d830662-22ad-427c-8c3e-4ec854b0af44')
|
||||
def test_list_projects(self):
|
||||
# List projects
|
||||
list_projects = self.projects_client.list_projects()['projects']
|
||||
|
||||
for p in self.project_ids:
|
||||
show_project = self.projects_client.show_project(p)['project']
|
||||
self.assertIn(show_project, list_projects)
|
||||
|
||||
@decorators.idempotent_id('fab13f3c-f6a6-4b9f-829b-d32fd44fdf10')
|
||||
def test_list_projects_with_domains(self):
|
||||
# List projects with domain
|
||||
self._list_projects_with_params(
|
||||
[self.p1], [self.p2, self.p3], {'domain_id': self.domain['id']},
|
||||
'domain_id')
|
||||
|
||||
@decorators.idempotent_id('0fe7a334-675a-4509-b00e-1c4b95d5dae8')
|
||||
def test_list_projects_with_enabled(self):
|
||||
# List the projects with enabled
|
||||
self._list_projects_with_params(
|
||||
[self.p1], [self.p2, self.p3], {'enabled': False}, 'enabled')
|
||||
|
||||
@decorators.idempotent_id('fa178524-4e6d-4925-907c-7ab9f42c7e26')
|
||||
def test_list_projects_with_name(self):
|
||||
# List projects with name
|
||||
self._list_projects_with_params(
|
||||
[self.p1], [self.p2, self.p3], {'name': self.p1_name}, 'name')
|
||||
|
||||
@decorators.idempotent_id('6edc66f5-2941-4a17-9526-4073311c1fac')
|
||||
def test_list_projects_with_parent(self):
|
||||
# List projects with parent
|
||||
|
@ -97,3 +78,51 @@ class ListProjectsTestJSON(BaseListProjectsTestJSON):
|
|||
self.assertNotEmpty(fetched_projects)
|
||||
for project in fetched_projects:
|
||||
self.assertEqual(self.p3['parent_id'], project['parent_id'])
|
||||
|
||||
|
||||
class ListProjectsStaticTestJSON(BaseListProjectsTestJSON):
|
||||
# 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):
|
||||
super(ListProjectsStaticTestJSON, cls).resource_setup()
|
||||
cls.domain_id = CONF.identity.default_domain_id
|
||||
cls.project_ids = list()
|
||||
cls.p1_name = cls.os_primary.credentials.project_name
|
||||
cls.p1 = cls.projects_client.show_project(
|
||||
cls.os_primary.credentials.project_id)['project']
|
||||
cls.project_ids.append(cls.p1['id'])
|
||||
p2_name = data_utils.rand_name('project')
|
||||
cls.p2 = cls.projects_client.create_project(
|
||||
p2_name, domain_id=cls.domain_id)['project']
|
||||
cls.addClassResourceCleanup(cls.projects_client.delete_project,
|
||||
cls.p2['id'])
|
||||
cls.project_ids.append(cls.p2['id'])
|
||||
|
||||
@decorators.idempotent_id('1d830662-22ad-427c-8c3e-4ec854b0af44')
|
||||
def test_list_projects(self):
|
||||
# List projects
|
||||
list_projects = self.projects_client.list_projects()['projects']
|
||||
|
||||
for p in self.project_ids:
|
||||
show_project = self.projects_client.show_project(p)['project']
|
||||
self.assertIn(show_project, list_projects)
|
||||
|
||||
@decorators.idempotent_id('fa178524-4e6d-4925-907c-7ab9f42c7e26')
|
||||
def test_list_projects_with_name(self):
|
||||
# List projects with name
|
||||
self._list_projects_with_params(
|
||||
[self.p1], [self.p2], {'name': self.p1_name}, 'name')
|
||||
|
||||
@decorators.idempotent_id('fab13f3c-f6a6-4b9f-829b-d32fd44fdf10')
|
||||
def test_list_projects_with_domains(self):
|
||||
# List projects with domain
|
||||
key = 'domain_id'
|
||||
params = {key: self.domain_id}
|
||||
# Verify both projects are in the self.domain_id which is the default
|
||||
# domain
|
||||
self._list_projects_with_params(
|
||||
[self.p1, self.p2], [], params, key)
|
||||
|
|
Loading…
Reference in New Issue