1
0
Fork 0
mirror of https://github.com/kakwa/ldapcherry synced 2025-07-03 03:47:35 +02:00

implement search

This commit is contained in:
kakwa 2015-05-31 19:38:31 +02:00
parent c9b971e8b0
commit 53660ee1d2
4 changed files with 38 additions and 8 deletions

View file

@ -30,12 +30,24 @@ class TestError(object):
expected = Set(['ldap', 'ad'])
assert ret == expected
def testGetSearchAttributes(self):
inv = Attributes('./tests/cfg/attributes.yml')
ret = inv.get_search_attributes()
expected = {'first-name': 'First Name', 'cn': 'Display Name', 'name': 'Name', 'uid': 'UID', 'email': 'Name'}
assert ret == expected
def testGetBackendAttributes(self):
inv = Attributes('./tests/cfg/attributes.yml')
ret = inv.get_backend_attributes('ldap')
expected = ['shell', 'cn', 'uid', 'uidNumber', 'gidNumber', 'home', 'userPassword', 'givenName', 'email', 'sn']
assert ret == expected
def testGetKey(self):
inv = Attributes('./tests/cfg/attributes.yml')
ret = inv.get_key()
expected = 'uid'
assert ret == expected
def testWrongGetBackendAttributes(self):
inv = Attributes('./tests/cfg/attributes.yml')
try:
@ -44,7 +56,6 @@ class TestError(object):
return
else:
raise AssertionError("expected an exception")
def testNoFile(self):
try: