>From 770cd4df22988fc1eb2d71e14b38f99991e70670 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Thu, 15 Oct 2015 11:04:06 +0200 Subject: [PATCH 2/2] SSSDConfigTest: Test real config without config_file_version 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 add real ssds.conf without config_file_version --- src/config/SSSDConfigTest.py | 56 ++++++++++++++++++++++ .../testconfigs/sssd-implicit-config-version.conf | 30 ++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 src/config/testconfigs/sssd-implicit-config-version.conf diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py index 620585eae5e233724a71e51de6f0ca67c40f7c3e..c0dcce3bc2a63afef825c4c4b626a9c3be78b7cc 100755 --- a/src/config/SSSDConfigTest.py +++ b/src/config/SSSDConfigTest.py @@ -1248,6 +1248,62 @@ class SSSDConfigTestSSSDConfig(unittest.TestCase): self.assertRaises(SSSDConfig.AlreadyInitializedError, sssdconfig.import_config, srcdir + "/testconfigs/sssd-valid.conf") + def testImportConfigWithout_config_file_version(self): + # Positive Test + sssdconfig = SSSDConfig.SSSDConfig(srcdir + "/etc/sssd.api.conf", + srcdir + "/etc/sssd.api.d") + sssdconfig.import_config( + srcdir + "/testconfigs/sssd-implicit-config-version.conf" + ) + + # Verify that all sections were imported + control_list = [ + 'sssd', + 'nss', + 'pam', + 'domain/ad.example.com', + ] + + for section in control_list: + self.assertTrue(sssdconfig.has_section(section), + "Section [%s] missing" % + section) + for section in sssdconfig.sections(): + self.assertTrue(section['name'] in control_list) + + # Verify that all options were imported for a section + control_list = [ + 'services', + 'domains', + ] + + for option in control_list: + self.assertTrue(sssdconfig.has_option('sssd', option), + "Option [%s] missing from [sssd]" % + option) + for option in sssdconfig.options('sssd'): + if option['type'] in ('empty', 'comment'): + continue + self.assertTrue(option['name'] in control_list, + "Option [%s] unexpectedly found" % + option) + + domain_control_list = [ + 'cache_credentials', + 'id_provider', + 'auth_provider', + 'access_provider', + 'default_shell', + 'fallback_homedir', + 'cache_credentials', + 'use_fully_qualified_names', + ] + + domain = sssdconfig.get_domain("ad.example.com") + + for option in domain.get_all_options(): + self.assertTrue(option in domain_control_list) + def testNewConfig(self): # Positive Test sssdconfig = SSSDConfig.SSSDConfig(srcdir + "/etc/sssd.api.conf", diff --git a/src/config/testconfigs/sssd-implicit-config-version.conf b/src/config/testconfigs/sssd-implicit-config-version.conf new file mode 100644 index 0000000000000000000000000000000000000000..b023ea8a4f652a810d6ff593c923f7f3bbd7d0e0 --- /dev/null +++ b/src/config/testconfigs/sssd-implicit-config-version.conf @@ -0,0 +1,30 @@ +[sssd] +domains = ad.example.com +services = nss, pam + +[nss] + +[pam] + +[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