Clean up the auto generated domain

During the federation test, when creating an identity provider, a
new domain will be created as well. This auto generated domain
should be cleaned up when test exit.

Depends-on: https://review.openstack.org/#/c/628132/
Change-Id: I6dcd0a0154c8658585a98ae138825881fe51d664
This commit is contained in:
wangxiyuan 2018-06-29 14:20:02 +08:00 committed by wangxiyuan
parent 958d34ee2d
commit ddc5109545
2 changed files with 14 additions and 1 deletions

View File

@ -43,6 +43,13 @@ class IndentityProvidersTest(base.BaseIdentityTest):
def _create_idp(self, idp_id, idp_ref):
idp = self.idps_client.create_identity_provider(
idp_id, **idp_ref)['identity_provider']
if not idp_ref.get('domain_id'):
self.addCleanup(
self.keystone_manager.domains_client.delete_domain,
idp['domain_id'])
self.addCleanup(
self.keystone_manager.domains_client.update_domain,
idp['domain_id'], enabled=False)
self.addCleanup(
self.idps_client.delete_identity_provider, idp_id)
return idp

View File

@ -50,8 +50,14 @@ class TestSaml2EcpFederatedAuthentication(base.BaseIdentityTest):
def _setup_idp(self):
remote_ids = CONF.fed_scenario.idp_remote_ids
self.idps_client.create_identity_provider(
idp = self.idps_client.create_identity_provider(
self.idp_id, remote_ids=remote_ids, enabled=True)
self.addCleanup(
self.keystone_manager.domains_client.delete_domain,
idp['identity_provider']['domain_id'])
self.addCleanup(
self.keystone_manager.domains_client.update_domain,
idp['identity_provider']['domain_id'], enabled=False)
self.addCleanup(
self.idps_client.delete_identity_provider, self.idp_id)