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:
parent
dd5d7b9c19
commit
cee73ceb93
4 changed files with 71 additions and 1 deletions
|
@ -109,7 +109,6 @@ home:
|
|||
backends:
|
||||
ldap: home
|
||||
ad: Home
|
||||
|
||||
password:
|
||||
description: "Password of the user"
|
||||
display_name: "Password"
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue