add unit test for get_groups

This commit is contained in:
kakwa 2015-05-27 21:56:55 +02:00
parent dc7f07ab38
commit 231b591d6a
1 changed files with 7 additions and 1 deletions

View File

@ -15,7 +15,7 @@ import ldap
cfg = {
'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',
'binddn' : 'cn=dnscherry,dc=example,dc=org',
'password' : 'password',
@ -121,6 +121,12 @@ class TestError(object):
expected = {'uid': 'jwatson', 'cn': 'John Watson', 'sn': 'watson'}
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):
inv = Backend(cfg, cherrypy.log, 'ldap', attr)
ret = inv.search('smith')