summaryrefslogtreecommitdiffstats
path: root/src/tests/intg/ldap_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/intg/ldap_test.py')
-rw-r--r--src/tests/intg/ldap_test.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tests/intg/ldap_test.py b/src/tests/intg/ldap_test.py
index 032856a21..ea114dcb0 100644
--- a/src/tests/intg/ldap_test.py
+++ b/src/tests/intg/ldap_test.py
@@ -34,6 +34,7 @@ from util import *
LDAP_BASE_DN="dc=example,dc=com"
+
@pytest.fixture(scope="module")
def ds_inst(request):
"""LDAP server instance fixture"""
@@ -48,6 +49,7 @@ def ds_inst(request):
request.addfinalizer(lambda: ds_inst.teardown())
return ds_inst
+
@pytest.fixture(scope="module")
def ldap_conn(request, ds_inst):
"""LDAP server connection fixture"""
@@ -56,6 +58,7 @@ def ldap_conn(request, ds_inst):
request.addfinalizer(lambda: ldap_conn.unbind_s())
return ldap_conn
+
def create_ldap_fixture(request, ldap_conn, ent_list):
"""Add LDAP entries and add teardown for removing them"""
for entry in ent_list:
@@ -65,6 +68,7 @@ def create_ldap_fixture(request, ldap_conn, ent_list):
ldap_conn.delete_s(entry[0])
request.addfinalizer(teardown)
+
def create_conf_fixture(request, contents):
"""Generate sssd.conf and add teardown for removing it"""
conf = open(config.CONF_PATH, "w")
@@ -73,6 +77,7 @@ def create_conf_fixture(request, contents):
os.chmod(config.CONF_PATH, stat.S_IRUSR | stat.S_IWUSR)
request.addfinalizer(lambda: os.unlink(config.CONF_PATH))
+
def create_sssd_fixture(request):
"""Start sssd and add teardown for stopping it and removing state"""
if subprocess.call(["sssd", "-D", "-f"]) != 0:
@@ -97,6 +102,7 @@ def create_sssd_fixture(request):
os.unlink(config.MCACHE_PATH + "/" + path)
request.addfinalizer(teardown)
+
@pytest.fixture
def sanity_rfc2307(request, ldap_conn):
ent_list = ldap_ent.List(LDAP_BASE_DN)
@@ -265,6 +271,7 @@ def test_sanity_rfc2307(ldap_conn, sanity_rfc2307):
with pytest.raises(KeyError):
grp.getgrgid(1)
+
def test_sanity_rfc2307_bis(ldap_conn, sanity_rfc2307_bis):
passwd_pattern = ent.contains_only(
dict(name='user1', passwd='*', uid=1001, gid=2001, gecos='1001', dir='/home/user1', shell='/bin/bash'),