mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 17:34:21 +01:00
add unit test for get_groups
This commit is contained in:
parent
dc7f07ab38
commit
231b591d6a
@ -15,7 +15,7 @@ import ldap
|
|||||||
|
|
||||||
cfg = {
|
cfg = {
|
||||||
'module' : 'ldapcherry.backend.ldap',
|
'module' : 'ldapcherry.backend.ldap',
|
||||||
'groupdn' : 'ou=group,dc=example,dc=org',
|
'groupdn' : 'ou=groups,dc=example,dc=org',
|
||||||
'userdn' : 'ou=People,dc=example,dc=org',
|
'userdn' : 'ou=People,dc=example,dc=org',
|
||||||
'binddn' : 'cn=dnscherry,dc=example,dc=org',
|
'binddn' : 'cn=dnscherry,dc=example,dc=org',
|
||||||
'password' : 'password',
|
'password' : 'password',
|
||||||
@ -121,6 +121,12 @@ class TestError(object):
|
|||||||
expected = {'uid': 'jwatson', 'cn': 'John Watson', 'sn': 'watson'}
|
expected = {'uid': 'jwatson', 'cn': 'John Watson', 'sn': 'watson'}
|
||||||
assert ret == expected
|
assert ret == expected
|
||||||
|
|
||||||
|
def testGetUser(self):
|
||||||
|
inv = Backend(cfg, cherrypy.log, 'ldap', attr)
|
||||||
|
ret = inv.get_groups('jwatson')
|
||||||
|
expected = ['cn=itpeople,ou=Groups,dc=example,dc=org']
|
||||||
|
assert ret == expected
|
||||||
|
|
||||||
def testSearchUser(self):
|
def testSearchUser(self):
|
||||||
inv = Backend(cfg, cherrypy.log, 'ldap', attr)
|
inv = Backend(cfg, cherrypy.log, 'ldap', attr)
|
||||||
ret = inv.search('smith')
|
ret = inv.search('smith')
|
||||||
|
Loading…
Reference in New Issue
Block a user