mirror of
https://github.com/kakwa/ldapcherry
synced 2025-07-03 20:07:42 +02:00
multiple changes
* change parameters name for Backend Ldap * fix default value handling in backends get_param * correct exception in backends get_param * fix syntaxe error * add backend name in test_BackendLdap.py
This commit is contained in:
parent
cb843a40e5
commit
93ed190913
6 changed files with 34 additions and 27 deletions
|
@ -8,6 +8,7 @@ import pytest
|
|||
import sys
|
||||
from sets import Set
|
||||
from ldapcherry.backend.backendLdap import Backend
|
||||
from ldapcherry import syslog_error
|
||||
from ldapcherry.exceptions import *
|
||||
import cherrypy
|
||||
|
||||
|
@ -15,57 +16,59 @@ cfg = {
|
|||
'module' : 'ldapcherry.backend.ldap',
|
||||
'groupdn' : 'ou=group,dc=example,dc=com',
|
||||
'people' : 'ou=group,dc=example,dc=com',
|
||||
'authdn' : 'cn=ldapcherry,dc=example,dc=com',
|
||||
'binddn' : 'cn=ldapcherry,dc=example,dc=com',
|
||||
'password' : 'password',
|
||||
'uri' : 'ldaps://ldap.ldapcherry.org',
|
||||
'ca' : '/etc/dnscherry/TEST-cacert.pem',
|
||||
'starttls' : 'on',
|
||||
'starttls' : 'off',
|
||||
'checkcert' : 'off',
|
||||
'user.filter.tmpl' : '(uid=%(username)s)',
|
||||
'group.filter.tmpl' : '(member=%(userdn)s)',
|
||||
'user_filter_tmpl' : '(uid=%(username)s)',
|
||||
'group_filter_tmpl' : '(member=%(userdn)s)',
|
||||
}
|
||||
|
||||
cherrypy.log.error = syslog_error
|
||||
|
||||
class TestError(object):
|
||||
|
||||
def testNominal(self):
|
||||
inv = Backend(cfg, cherrypy.log)
|
||||
inv = Backend(cfg, cherrypy.log, 'ldap')
|
||||
return True
|
||||
|
||||
def testConnect(self):
|
||||
inv = Backend(cfg, cherrypy.log)
|
||||
inv = Backend(cfg, cherrypy.log, 'ldap')
|
||||
inv._connect()
|
||||
return True
|
||||
|
||||
def testConnectSSL(self):
|
||||
inv = Backend(cfg, cherrypy.log)
|
||||
inv = Backend(cfg, cherrypy.log, 'ldap')
|
||||
return True
|
||||
|
||||
def testConnectSSLNoCheck(self):
|
||||
inv = Backend(cfg, cherrypy.log)
|
||||
inv = Backend(cfg, cherrypy.log, 'ldap')
|
||||
return True
|
||||
|
||||
def testAuthSuccess(self):
|
||||
inv = Backend(cfg, cherrypy.log)
|
||||
inv = Backend(cfg, cherrypy.log, 'ldap')
|
||||
return True
|
||||
|
||||
def testAuthSuccess(self):
|
||||
inv = Backend(cfg, cherrypy.log)
|
||||
inv = Backend(cfg, cherrypy.log, 'ldap')
|
||||
return True
|
||||
|
||||
def testAuthFailure(self):
|
||||
inv = Backend(cfg, cherrypy.log)
|
||||
inv = Backend(cfg, cherrypy.log, 'ldap')
|
||||
return True
|
||||
|
||||
def testMissingParam(self):
|
||||
cfg2 = {}
|
||||
return True
|
||||
try:
|
||||
inv = Backend(cfg2, cherrypy.log)
|
||||
inv = Backend(cfg2, cherrypy.log, 'ldap')
|
||||
except MissingKey:
|
||||
return
|
||||
else:
|
||||
raise AssertionError("expected an exception")
|
||||
|
||||
def testGetUser(self):
|
||||
inv = Backend(cfg, cherrypy.log)
|
||||
inv = Backend(cfg, cherrypy.log, 'ldap')
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue