mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
adding unit test for ldap server unavailable
This commit is contained in:
parent
3fe59e4349
commit
6460c33b28
@ -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'
|
||||||
|
Loading…
Reference in New Issue
Block a user