don't restart ldap in tests

This commit is contained in:
Kay0u 2020-05-12 19:29:13 +02:00
parent 7fed0e5051
commit f2370c0444
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D

View file

@ -66,11 +66,14 @@ class TestLDAP:
assert ldap_interface.con
def test_authenticate_server_down(self, ldap_server):
def test_authenticate_server_down(self, ldap_server, mocker):
self.ldap_conf["parameters"]["uri"] = ldap_server.uri
self.ldap_conf["parameters"]["user_rdn"] = "cn=admin,dc=yunohost,dc=org"
ldap_server.stop()
ldap_interface = m_ldap.Authenticator(**self.ldap_conf)
# Now if slapd is down, moulinette tries to restart it
mocker.patch("os.system")
with pytest.raises(MoulinetteError) as exception:
ldap_interface.authenticate(password="yunohost")