mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-11 08:23:49 +00:00
users: Avoid test error if ldapsearch is not available
ldapsearch is provided by ldap-utils, which is not a build dependency. Test: Build package using `gbp buildpackage`. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
parent
7cf166e558
commit
d69a36c25f
@ -24,10 +24,13 @@ _cleanup_groups = None
|
||||
|
||||
def _is_ldap_set_up():
|
||||
"""Return whether LDAP is set up."""
|
||||
return subprocess.call([
|
||||
'ldapsearch', '-Y', 'EXTERNAL', '-H', 'ldapi:///', '-b',
|
||||
'ou=groups,dc=thisbox'
|
||||
]) == 0
|
||||
try:
|
||||
return subprocess.call([
|
||||
'ldapsearch', '-Y', 'EXTERNAL', '-H', 'ldapi:///', '-b',
|
||||
'ou=groups,dc=thisbox'
|
||||
]) == 0
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
|
||||
|
||||
pytestmark = [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user