1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-24 18:24:31 +01:00

more complex unit test for get_roles

This commit is contained in:
kakwa 2015-05-16 19:40:16 +02:00
parent 991f8ee72d
commit 19f98aa664
2 changed files with 19 additions and 5 deletions

View File

@ -26,3 +26,14 @@ groups = {
print inv.get_roles(groups)
groups = {
'ad' : ['Domain Users', 'Domain Users 2'],
'ldap': ['cn=users,ou=group,dc=example,dc=com',
'cn=nagios admins,ou=group,dc=example,dc=com',
'cn=developpers,ou=group,dc=example,dc=com',
],
'toto': ['not a group'],
}
print inv.get_roles(groups)

View File

@ -62,9 +62,12 @@ class TestError(object):
def testGetRole(self):
inv = Roles('./tests/cfg/roles.yml')
groups = {
'ad' : ['Domain Users', 'Domain Users 2'],
'ldap': ['cn=users,ou=group,dc=example,dc=com']
}
expected = {'unusedgroups': {'ad': Set(['Domain Users 2'])}, 'roles': Set(['users'])}
'ad' : ['Domain Users', 'Domain Users 2'],
'ldap': ['cn=users,ou=group,dc=example,dc=com',
'cn=nagios admins,ou=group,dc=example,dc=com',
'cn=developpers,ou=group,dc=example,dc=com',
],
'toto': ['not a group'],
}
expected = {'unusedgroups': {'toto': Set(['not a group']), 'ad': Set(['Domain Users 2'])}, 'roles': Set(['developpers', 'admin-lv2'])}
assert inv.get_roles(groups) == expected