152 lines
5.8 KiB
Diff
152 lines
5.8 KiB
Diff
|
From abbb16532a5336cf5c75228c2adc56601c828f9a Mon Sep 17 00:00:00 2001
|
||
|
From: Lukas Slebodnik <lslebodn@redhat.com>
|
||
|
Date: Thu, 15 Oct 2015 11:04:06 +0200
|
||
|
Subject: [PATCH 6/6] SSSDConfigTest: Test real config without
|
||
|
config_file_version
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
src/config/testconfigs/sssd-valid.conf explicitly contains
|
||
|
config_file_version. Recently we changed the default value to 2
|
||
|
and therefore it needn't be listed in configuration file.
|
||
|
This patch test real sssd.conf without config_file_version.
|
||
|
|
||
|
Reviewed-by: Michal Židek <mzidek@redhat.com>
|
||
|
(cherry picked from commit 7388fc91bd6c22705e60632346ec815f4a4963f1)
|
||
|
(cherry picked from commit b1c6767617c082de2521976175bc2f499ec295e9)
|
||
|
---
|
||
|
src/config/SSSDConfigTest.py | 85 ++++++++++++++++++++++++++++++
|
||
|
src/config/testconfigs/sssd-noversion.conf | 22 ++++++++
|
||
|
2 files changed, 107 insertions(+)
|
||
|
|
||
|
diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py
|
||
|
index 8a4a2b30a8a5b2422075fd614626d14e6f803a18..45562214da5d227b45914abbcb298e043048adf5 100755
|
||
|
--- a/src/config/SSSDConfigTest.py
|
||
|
+++ b/src/config/SSSDConfigTest.py
|
||
|
@@ -1243,6 +1243,91 @@ class SSSDConfigTestSSSDConfig(unittest.TestCase):
|
||
|
self.assertRaises(SSSDConfig.AlreadyInitializedError,
|
||
|
sssdconfig.import_config, srcdir + "/testconfigs/sssd-valid.conf")
|
||
|
|
||
|
+ def testImportConfigNoVersion(self):
|
||
|
+ # Positive Test
|
||
|
+ sssdconfig = SSSDConfig.SSSDConfig(srcdir + "/etc/sssd.api.conf",
|
||
|
+ srcdir + "/etc/sssd.api.d")
|
||
|
+ sssdconfig.import_config(
|
||
|
+ srcdir + "/testconfigs/sssd-noversion.conf"
|
||
|
+ )
|
||
|
+
|
||
|
+ # Validate services
|
||
|
+ services = sssdconfig.list_services()
|
||
|
+ self.assertTrue('sssd' in services)
|
||
|
+ self.assertTrue('nss' in services)
|
||
|
+ self.assertTrue('pam' in services)
|
||
|
+ self.assertTrue('dp' in services)
|
||
|
+
|
||
|
+ #Verify service attributes
|
||
|
+ sssd_service = sssdconfig.get_service('sssd')
|
||
|
+ service_opts = sssd_service.list_options()
|
||
|
+
|
||
|
+ self.assertTrue('services' in service_opts.keys())
|
||
|
+ service_list = sssd_service.get_option('services')
|
||
|
+ self.assertTrue('nss' in service_list)
|
||
|
+ self.assertTrue('pam' in service_list)
|
||
|
+ self.assertTrue('reconnection_retries' in service_opts)
|
||
|
+
|
||
|
+ #Validate domain list
|
||
|
+ domains = sssdconfig.list_domains()
|
||
|
+ self.assertTrue('LOCAL' in domains)
|
||
|
+ self.assertTrue('LDAP' in domains)
|
||
|
+ self.assertTrue('PROXY' in domains)
|
||
|
+ self.assertTrue('IPA' in domains)
|
||
|
+
|
||
|
+ # Verify domain attributes
|
||
|
+ ipa_domain = sssdconfig.get_domain('IPA')
|
||
|
+ domain_opts = ipa_domain.list_options()
|
||
|
+ self.assertTrue('debug_level' in domain_opts.keys())
|
||
|
+ self.assertTrue('id_provider' in domain_opts.keys())
|
||
|
+ self.assertTrue('auth_provider' in domain_opts.keys())
|
||
|
+
|
||
|
+ # Verify domain attributes
|
||
|
+ proxy_domain = sssdconfig.get_domain('PROXY')
|
||
|
+ domain_opts = proxy_domain.list_options()
|
||
|
+ self.assertTrue('debug_level' in domain_opts.keys())
|
||
|
+ self.assertTrue('id_provider' in domain_opts.keys())
|
||
|
+ self.assertTrue('auth_provider' in domain_opts.keys())
|
||
|
+
|
||
|
+ # Verify domain attributes
|
||
|
+ local_domain = sssdconfig.get_domain('LOCAL')
|
||
|
+ domain_opts = local_domain.list_options()
|
||
|
+ self.assertTrue('debug_level' in domain_opts.keys())
|
||
|
+ self.assertTrue('id_provider' in domain_opts.keys())
|
||
|
+ self.assertTrue('auth_provider' in domain_opts.keys())
|
||
|
+
|
||
|
+ # Verify domain attributes
|
||
|
+ ldap_domain = sssdconfig.get_domain('LDAP')
|
||
|
+ domain_opts = ldap_domain.list_options()
|
||
|
+ self.assertTrue('debug_level' in domain_opts.keys())
|
||
|
+ self.assertTrue('id_provider' in domain_opts.keys())
|
||
|
+ self.assertTrue('auth_provider' in domain_opts.keys())
|
||
|
+
|
||
|
+ domain_control_list = [
|
||
|
+ 'cache_credentials',
|
||
|
+ 'id_provider',
|
||
|
+ 'auth_provider',
|
||
|
+ 'access_provider',
|
||
|
+ 'default_shell',
|
||
|
+ 'fallback_homedir',
|
||
|
+ 'cache_credentials',
|
||
|
+ 'use_fully_qualified_names',
|
||
|
+ ]
|
||
|
+
|
||
|
+ ad_domain = sssdconfig.get_domain("ad.example.com")
|
||
|
+
|
||
|
+ for option in ad_domain.get_all_options():
|
||
|
+ self.assertTrue(option in domain_control_list)
|
||
|
+
|
||
|
+ negative_domain_control_list = [
|
||
|
+ 'ad_server',
|
||
|
+ 'ldap_id_mapping',
|
||
|
+ 'ldap_sasl_authid',
|
||
|
+ ]
|
||
|
+
|
||
|
+ for option in ad_domain.get_all_options():
|
||
|
+ self.assertFalse(option in negative_domain_control_list)
|
||
|
+
|
||
|
def testNewConfig(self):
|
||
|
# Positive Test
|
||
|
sssdconfig = SSSDConfig.SSSDConfig(srcdir + "/etc/sssd.api.conf",
|
||
|
diff --git a/src/config/testconfigs/sssd-noversion.conf b/src/config/testconfigs/sssd-noversion.conf
|
||
|
index 71af85cc07e87ab96372fb91ea52ce36faf21a1e..d5f524d268dd43825364a4b464909cf1b9441646 100644
|
||
|
--- a/src/config/testconfigs/sssd-noversion.conf
|
||
|
+++ b/src/config/testconfigs/sssd-noversion.conf
|
||
|
@@ -39,3 +39,25 @@ debug_level = 0
|
||
|
[dp]
|
||
|
debug_level = 0
|
||
|
|
||
|
+[domain/ad.example.com]
|
||
|
+cache_credentials = true
|
||
|
+
|
||
|
+id_provider = ad
|
||
|
+auth_provider = ad
|
||
|
+access_provider = ad
|
||
|
+
|
||
|
+# Uncomment if service discovery is not working
|
||
|
+# ad_server = server.ad.example.com
|
||
|
+
|
||
|
+# Uncomment if you want to use POSIX UIDs and GIDs set on the AD side
|
||
|
+# ldap_id_mapping = False
|
||
|
+
|
||
|
+# Comment out if the users have the shell and home dir set on the AD side
|
||
|
+default_shell = /bin/bash
|
||
|
+fallback_homedir = /home/%d/%u
|
||
|
+
|
||
|
+# Uncomment and adjust if the default principal SHORTNAME$@REALM is not available
|
||
|
+# ldap_sasl_authid = host/client.ad.example.com@AD.EXAMPLE.COM
|
||
|
+
|
||
|
+# Comment out if you prefer to user shortnames.
|
||
|
+use_fully_qualified_names = True
|
||
|
--
|
||
|
2.5.0
|
||
|
|