1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-26 03:04:30 +01:00

adding unit test for ldap server unavailable

This commit is contained in:
kakwa 2015-05-22 19:38:41 +02:00
parent 3fe59e4349
commit 6460c33b28

View File

@ -50,6 +50,20 @@ class TestError(object):
ldap = inv._connect() ldap = inv._connect()
ldap.simple_bind_s(inv.binddn, inv.bindpassword) ldap.simple_bind_s(inv.binddn, inv.bindpassword)
def testLdapUnavaible(self):
cfg2 = cfg.copy()
cfg2['uri'] = 'ldaps://notaldap:637'
cfg2['checkcert'] = 'on'
cfg2['ca'] = './cfg/ca.crt'
inv = Backend(cfg2, cherrypy.log, 'ldap', attr)
ldapc = inv._connect()
try:
ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
except SERVER_DOWN as e:
return
else:
raise AssertionError("expected an exception")
def testConnectSSLWrongCA(self): def testConnectSSLWrongCA(self):
cfg2 = cfg.copy() cfg2 = cfg.copy()
cfg2['uri'] = 'ldaps://ldap.ldapcherry.org:637' cfg2['uri'] = 'ldaps://ldap.ldapcherry.org:637'