1
0
Fork 0
mirror of https://github.com/kakwa/ldapcherry synced 2025-07-04 20:37:48 +02:00

adding check function to validate attributes type

This commit is contained in:
kakwa 2015-07-14 11:21:33 +02:00
parent dd5d7b9c19
commit cee73ceb93
4 changed files with 71 additions and 1 deletions

View file

@ -109,7 +109,6 @@ home:
backends:
ldap: home
ad: Home
password:
description: "Password of the user"
display_name: "Password"

View file

@ -89,6 +89,23 @@ class TestError(object):
else:
raise AssertionError("expected an exception")
def testValidate(self):
inv = Attributes('./tests/cfg/attributes.yml')
attrs = {'cn': 'test', 'email': 'test@example.org', 'uidNumber': 4242, 'shell': '/bin/bash', 'logscript': 'login1.bat'}
for attrid in attrs:
inv.check_attr(attrid, attrs[attrid])
def testValidateError(self):
inv = Attributes('./tests/cfg/attributes.yml')
attrs = {'email': 'notamail', 'uidNumber': 'not an integer', 'shell': '/bin/not in list', 'logscript': 'not fixed'}
for attrid in attrs:
try:
inv.check_attr(attrid, attrs[attrid])
except WrongAttrValue:
pass
else:
raise AssertionError("expected an exception")
# def testGetDisplayName(self):
# inv = Attributes('./tests/cfg/attributes.yml')
# res = inv.get_display_name('users')