Commit 01b0e176 authored by Lorenz Steinert's avatar Lorenz Steinert

vorbereitungen für tests

parent 0b8c726c
......@@ -38,11 +38,14 @@ class FsrLdap:
connect_timeout=timeout)
self.base = base
def get_protokollant_ldap(self, config):
def get_protokollant_ldap(self, config, testing=False):
"""search the LDAP for the current user"""
print("Fetching Protokollant from LDAP ...")
try:
conn = ldap.Connection(self.server)
if testing:
conn = ldap.Connection(self.server, ldap.MOCK_SYNC)
else:
conn = ldap:Connection(self.server)
conn.bind()
fil = "(uid="+current_user()+")"
if conn.search('ou=people,' + self.base, fil,
......@@ -62,7 +65,10 @@ class FsrLdap:
"""get fsr from LDAP"""
print("Fetching FSR from LDAP ...")
try:
conn = ldap.Connection(self.server)
if testing:
conn = ldap.Connection(self.server, ldap.MOCK_SYNC)
else:
conn = ldap:Connection(self.server)
conn.bind()
fil = '(cn=intern)'
fsr = []
......@@ -93,7 +99,10 @@ class FsrLdap:
"""get the EFSR from LDAP"""
print("Fetching EFSR from LDAP ...")
try:
conn = ldap.Connection(self.server)
if testing:
conn = ldap.Connection(self.server, ldap.MOCK_SYNC)
else:
conn = ldap:Connection(self.server)
conn.bind()
fil = '(cn=extern)'
fsr_extern = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment