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
1 changed files with 14 additions and 0 deletions

View File

@ -50,6 +50,20 @@ class TestError(object):
ldap = inv._connect()
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):
cfg2 = cfg.copy()
cfg2['uri'] = 'ldaps://ldap.ldapcherry.org:637'