summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2017-02-21 21:04:29 +0100
committerLukas Slebodnik <lslebodn@redhat.com>2017-02-27 19:15:36 +0100
commit13294bedc56faf1011f5ba7b1ed9a53b08e71c00 (patch)
tree9793e292360121edca88612a1c7a911a0889a39a /src/tests
parent76b6d7fb9f31f7836158d248161aec3558098659 (diff)
downloadsssd-13294bedc56faf1011f5ba7b1ed9a53b08e71c00.tar.gz
sssd-13294bedc56faf1011f5ba7b1ed9a53b08e71c00.tar.xz
sssd-13294bedc56faf1011f5ba7b1ed9a53b08e71c00.zip
TESTS: Test the files domain autoconfiguration
Adds tests that exercise the implicit files domain. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/intg/test_files_provider.py78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/tests/intg/test_files_provider.py b/src/tests/intg/test_files_provider.py
index 528b5e5ac..abf836bcc 100644
--- a/src/tests/intg/test_files_provider.py
+++ b/src/tests/intg/test_files_provider.py
@@ -125,6 +125,48 @@ def files_domain_only(request):
return None
+@pytest.fixture
+def no_sssd_domain(request):
+ conf = unindent("""\
+ [sssd]
+ services = nss
+ """).format(**locals())
+ create_conf_fixture(request, conf)
+ create_sssd_fixture(request)
+ return None
+
+
+@pytest.fixture
+def no_files_domain(request):
+ conf = unindent("""\
+ [sssd]
+ domains = local
+ services = nss
+
+ [domain/local]
+ id_provider = local
+ """).format(**locals())
+ create_conf_fixture(request, conf)
+ create_sssd_fixture(request)
+ return None
+
+
+@pytest.fixture
+def disabled_files_domain(request):
+ conf = unindent("""\
+ [sssd]
+ domains = local
+ services = nss
+ enable_files_domain = false
+
+ [domain/local]
+ id_provider = local
+ """).format(**locals())
+ create_conf_fixture(request, conf)
+ create_sssd_fixture(request)
+ return None
+
+
def setup_pw_with_list(request, user_list):
pwd_ops = passwd_ops_setup(request)
for user in user_list:
@@ -754,3 +796,39 @@ def test_realloc_groups(setup_gr_with_canary, files_domain_only):
check for off-by-one errors.
"""
realloc_groups(setup_gr_with_canary, FILES_REALLOC_CHUNK*3)
+
+
+# Files domain autoconfiguration tests
+def test_no_sssd_domain(add_user_with_canary, no_sssd_domain):
+ """
+ Test that if no sssd domain is configured, sssd will add the implicit one
+ """
+ res, user = sssd_getpwnam_sync(USER1["name"])
+ assert res == NssReturnCode.SUCCESS
+ assert user == USER1
+
+
+def test_no_files_domain(add_user_with_canary, no_files_domain):
+ """
+ Test that if no files domain is configured, sssd will add the implicit one
+ before any explicitly configured domains
+ """
+ # Add a user with a different UID than the one in files
+ subprocess.check_call(
+ ["sss_useradd", "-u", "10009", "-M", USER1["name"]])
+
+ # Even though the local domain is the only one configured,
+ # files will be resolved first
+ res, user = sssd_getpwnam_sync(USER1["name"])
+ assert res == NssReturnCode.SUCCESS
+ assert user == USER1
+
+
+def test_disable_files_domain(add_user_with_canary, disabled_files_domain):
+ """
+ Test that if no files domain is configured, sssd will add the implicit one
+ before any explicitly configured domains
+ """
+ # The local user will not be resolvable through nss_sss now
+ res, user = sssd_getpwnam_sync(USER1["name"])
+ assert res != NssReturnCode.SUCCESS