Merge "Reduce domain specific config setup duplication"
This commit is contained in:
commit
a6b0552dd3
|
@ -3012,33 +3012,26 @@ class DomainSpecificLDAPandSQLIdentity(
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
DOMAIN_COUNT = 2
|
||||||
|
DOMAIN_SPECIFIC_COUNT = 2
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
sqldb = self.useFixture(database.Database())
|
self.domain_count = self.DOMAIN_COUNT
|
||||||
|
self.domain_specific_count = self.DOMAIN_SPECIFIC_COUNT
|
||||||
|
|
||||||
|
self.useFixture(database.Database())
|
||||||
super(DomainSpecificLDAPandSQLIdentity, self).setUp()
|
super(DomainSpecificLDAPandSQLIdentity, self).setUp()
|
||||||
self.initial_setup(sqldb)
|
self.assert_backends()
|
||||||
|
|
||||||
def initial_setup(self, sqldb):
|
def load_fixtures(self, fixtures):
|
||||||
# We aren't setting up any initial data ahead of switching to
|
|
||||||
# domain-specific operation, so make the switch straight away.
|
|
||||||
self.config_fixture.config(
|
|
||||||
group='identity', domain_specific_drivers_enabled=True,
|
|
||||||
domain_config_dir=(
|
|
||||||
unit.TESTCONF + '/domain_configs_one_sql_one_ldap'))
|
|
||||||
self.config_fixture.config(group='identity_mapping',
|
|
||||||
backward_compatible_ids=False)
|
|
||||||
|
|
||||||
self.load_backends()
|
|
||||||
sqldb.recreate()
|
|
||||||
|
|
||||||
self.domain_count = 2
|
|
||||||
self.domain_specific_count = 2
|
|
||||||
self.setup_initial_domains()
|
self.setup_initial_domains()
|
||||||
self.users = {}
|
|
||||||
|
|
||||||
self.ldapdb.clear()
|
super(DomainSpecificLDAPandSQLIdentity, self).load_fixtures(fixtures)
|
||||||
self.load_fixtures(default_fixtures)
|
|
||||||
|
self.users = {}
|
||||||
self.create_users_across_domains()
|
self.create_users_across_domains()
|
||||||
|
|
||||||
|
def assert_backends(self):
|
||||||
_assert_backends(
|
_assert_backends(
|
||||||
self,
|
self,
|
||||||
assignment='sql',
|
assignment='sql',
|
||||||
|
@ -3056,6 +3049,16 @@ class DomainSpecificLDAPandSQLIdentity(
|
||||||
self.config_fixture.config(group='resource', driver='sql')
|
self.config_fixture.config(group='resource', driver='sql')
|
||||||
self.config_fixture.config(group='assignment', driver='sql')
|
self.config_fixture.config(group='assignment', driver='sql')
|
||||||
|
|
||||||
|
# We aren't setting up any initial data ahead of switching to
|
||||||
|
# domain-specific operation, so make the switch straight away.
|
||||||
|
self.config_fixture.config(
|
||||||
|
group='identity', domain_specific_drivers_enabled=True,
|
||||||
|
domain_config_dir=(
|
||||||
|
unit.TESTCONF + '/domain_configs_one_sql_one_ldap'))
|
||||||
|
|
||||||
|
self.config_fixture.config(group='identity_mapping',
|
||||||
|
backward_compatible_ids=False)
|
||||||
|
|
||||||
def get_config(self, domain_id):
|
def get_config(self, domain_id):
|
||||||
# Get the config for this domain, will return CONF
|
# Get the config for this domain, will return CONF
|
||||||
# if no specific config defined for this domain
|
# if no specific config defined for this domain
|
||||||
|
@ -3204,30 +3207,10 @@ class DomainSpecificSQLIdentity(DomainSpecificLDAPandSQLIdentity):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def initial_setup(self, sqldb):
|
DOMAIN_COUNT = 2
|
||||||
# We aren't setting up any initial data ahead of switching to
|
DOMAIN_SPECIFIC_COUNT = 1
|
||||||
# domain-specific operation, so make the switch straight away.
|
|
||||||
self.config_fixture.config(
|
|
||||||
group='identity', domain_specific_drivers_enabled=True,
|
|
||||||
domain_config_dir=(
|
|
||||||
unit.TESTCONF + '/domain_configs_default_ldap_one_sql'))
|
|
||||||
# Part of the testing counts how many new mappings get created as
|
|
||||||
# we create users, so ensure we are NOT using mapping for the default
|
|
||||||
# LDAP domain so this doesn't confuse the calculation.
|
|
||||||
self.config_fixture.config(group='identity_mapping',
|
|
||||||
backward_compatible_ids=True)
|
|
||||||
|
|
||||||
self.load_backends()
|
|
||||||
sqldb.recreate()
|
|
||||||
|
|
||||||
self.domain_count = 2
|
|
||||||
self.domain_specific_count = 1
|
|
||||||
self.setup_initial_domains()
|
|
||||||
self.users = {}
|
|
||||||
|
|
||||||
self.load_fixtures(default_fixtures)
|
|
||||||
self.create_users_across_domains()
|
|
||||||
|
|
||||||
|
def assert_backends(self):
|
||||||
_assert_backends(self,
|
_assert_backends(self,
|
||||||
assignment='sql',
|
assignment='sql',
|
||||||
identity='ldap',
|
identity='ldap',
|
||||||
|
@ -3236,8 +3219,19 @@ class DomainSpecificSQLIdentity(DomainSpecificLDAPandSQLIdentity):
|
||||||
def config_overrides(self):
|
def config_overrides(self):
|
||||||
super(DomainSpecificSQLIdentity, self).config_overrides()
|
super(DomainSpecificSQLIdentity, self).config_overrides()
|
||||||
self.config_fixture.config(group='identity', driver='ldap')
|
self.config_fixture.config(group='identity', driver='ldap')
|
||||||
self.config_fixture.config(group='resource', driver='sql')
|
|
||||||
self.config_fixture.config(group='assignment', driver='sql')
|
# We aren't setting up any initial data ahead of switching to
|
||||||
|
# domain-specific operation, so make the switch straight away.
|
||||||
|
self.config_fixture.config(
|
||||||
|
group='identity', domain_specific_drivers_enabled=True,
|
||||||
|
domain_config_dir=(
|
||||||
|
unit.TESTCONF + '/domain_configs_default_ldap_one_sql'))
|
||||||
|
|
||||||
|
# Part of the testing counts how many new mappings get created as
|
||||||
|
# we create users, so ensure we are NOT using mapping for the default
|
||||||
|
# LDAP domain so this doesn't confuse the calculation.
|
||||||
|
self.config_fixture.config(group='identity_mapping',
|
||||||
|
backward_compatible_ids=True)
|
||||||
|
|
||||||
def get_config(self, domain_id):
|
def get_config(self, domain_id):
|
||||||
if domain_id == CONF.identity.default_domain_id:
|
if domain_id == CONF.identity.default_domain_id:
|
||||||
|
|
Loading…
Reference in New Issue