mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-25 18:54:29 +01:00
adding unit test for starttls
This commit is contained in:
parent
05a897f355
commit
a3c75f97f5
@ -92,6 +92,21 @@ class TestError(object):
|
|||||||
except ldap.SERVER_DOWN as e:
|
except ldap.SERVER_DOWN as e:
|
||||||
assert e[0]['info'] == 'TLS: hostname does not match CN in peer certificate'
|
assert e[0]['info'] == 'TLS: hostname does not match CN in peer certificate'
|
||||||
|
|
||||||
|
def testConnectStartTLS(self):
|
||||||
|
cfg2 = cfg.copy()
|
||||||
|
cfg2['uri'] = 'ldap://ldap.ldapcherry.org:390'
|
||||||
|
cfg2['checkcert'] = 'off'
|
||||||
|
cfg2['starttls'] = 'on'
|
||||||
|
cfg2['ca'] = './test/cfg/ca.crt'
|
||||||
|
inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
|
||||||
|
ldapc = inv._connect()
|
||||||
|
try:
|
||||||
|
ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
|
||||||
|
except ldap.SERVER_DOWN as e:
|
||||||
|
assert e[0]['info'] == 'TLS: hostname does not match CN in peer certificate'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def testAuthSuccess(self):
|
def testAuthSuccess(self):
|
||||||
inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
|
inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user