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:
parent
991f8ee72d
commit
19f98aa664
@ -26,3 +26,14 @@ groups = {
|
|||||||
|
|
||||||
print inv.get_roles(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)
|
||||||
|
@ -62,9 +62,12 @@ class TestError(object):
|
|||||||
def testGetRole(self):
|
def testGetRole(self):
|
||||||
inv = Roles('./tests/cfg/roles.yml')
|
inv = Roles('./tests/cfg/roles.yml')
|
||||||
groups = {
|
groups = {
|
||||||
'ad' : ['Domain Users', 'Domain Users 2'],
|
'ad' : ['Domain Users', 'Domain Users 2'],
|
||||||
'ldap': ['cn=users,ou=group,dc=example,dc=com']
|
'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',
|
||||||
expected = {'unusedgroups': {'ad': Set(['Domain Users 2'])}, 'roles': Set(['users'])}
|
],
|
||||||
|
'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
|
assert inv.get_roles(groups) == expected
|
||||||
|
Loading…
Reference in New Issue
Block a user