From 60956d7452863392e459ea0dfb419d20bc333b29 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Mon, 7 Dec 2009 15:14:51 -0500 Subject: Make SSSDDomain.remove_provider() remove configured options We will remove all options for a provider that are not also required by another configured provider. (For example, we will not remove krb5_realm when deleting the krb5 auth provider if the LDAP provider is in use, since it may still require this argument). --- server/config/SSSDConfigTest.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'server/config/SSSDConfigTest.py') diff --git a/server/config/SSSDConfigTest.py b/server/config/SSSDConfigTest.py index fa111819f..3d8b596ac 100644 --- a/server/config/SSSDConfigTest.py +++ b/server/config/SSSDConfigTest.py @@ -664,6 +664,30 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase): 'Option [%s] unexpectedly found' % option) + # Remove the local ID provider and add an LDAP one + # LDAP ID providers can also use the krb5_realm + domain.remove_provider('id') + + domain.add_provider('ldap', 'id') + + # Set the krb5_realm option and the ldap_uri option + domain.set_option('krb5_realm', 'EXAMPLE.COM') + domain.set_option('ldap_uri', 'ldap://ldap.example.com') + + self.assertEquals(domain.get_option('krb5_realm'), + 'EXAMPLE.COM') + self.assertEquals(domain.get_option('ldap_uri'), + 'ldap://ldap.example.com') + + # Remove the LDAP provider and verify that krb5_realm remains + domain.remove_provider('id') + self.assertEquals(domain.get_option('krb5_realm'), + 'EXAMPLE.COM') + self.assertFalse(domain.options.has_key('ldap_uri')) + + # Put the LOCAL provider back + domain.add_provider('local', 'id') + # Remove the auth domain and verify that the options # revert to the backup_list domain.remove_provider('auth') @@ -684,6 +708,9 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase): 'Option [%s] unexpectedly found' % option) + # Ensure that the krb5_realm option is now gone + self.assertFalse(domain.options.has_key('krb5_realm')) + # Test removing nonexistent provider - Real domain.remove_provider('id') -- cgit