mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-25 02:34:31 +01:00
adding unit tests
This commit is contained in:
parent
46470a0924
commit
30cfd248f7
26
tests/cfg/nested.yml
Normal file
26
tests/cfg/nested.yml
Normal file
@ -0,0 +1,26 @@
|
||||
users:
|
||||
backends_groups:
|
||||
ad: [Domain Users]
|
||||
ldap: ['cn=users,ou=group,dc=example,dc=com']
|
||||
display_name: Simple Users
|
||||
subroles:
|
||||
admin-lv2:
|
||||
LC_admins: true
|
||||
backends_groups:
|
||||
ad: [Domain Users]
|
||||
ldap: ['cn=nagios admins,ou=group,dc=example,dc=com']
|
||||
display_name: Administrators Level 2
|
||||
subroles:
|
||||
admin-lv3:
|
||||
backends_groups:
|
||||
ad: [Domain Users, Administrators, Domain Controllers]
|
||||
ldap: ['cn=dns admins,ou=group,dc=example,dc=com', 'cn=nagios admins,ou=group,dc=example,dc=com',
|
||||
'cn=puppet admins,ou=group,dc=example,dc=com',]
|
||||
display_name: Administrators Level 3
|
||||
subroles: {}
|
||||
developpers:
|
||||
backends_groups:
|
||||
ad: [Domain Users]
|
||||
ldap: ['cn=developpers,ou=group,dc=example,dc=com']
|
||||
display_name: Developpers
|
||||
subroles: {}
|
@ -67,6 +67,11 @@ class TestError(object):
|
||||
}
|
||||
assert res == expected
|
||||
|
||||
def testNested(self):
|
||||
inv = Roles('./tests/cfg/nested.yml')
|
||||
expected = {'developpers': {'backends_groups': {'ad': ['Domain Users'], 'ldap': ['cn=developpers,ou=group,dc=example,dc=com', 'cn=users,ou=group,dc=example,dc=com']}, 'display_name': 'Developpers'}, 'admin-lv3': {'backends_groups': {'ad': ['Domain Users', 'Administrators', 'Domain Controllers'], 'ldap': ['cn=nagios admins,ou=group,dc=example,dc=com', 'cn=users,ou=group,dc=example,dc=com', 'cn=puppet admins,ou=group,dc=example,dc=com', 'cn=dns admins,ou=group,dc=example,dc=com']}, 'display_name': 'Administrators Level 3'}, 'admin-lv2': {'backends_groups': {'ad': ['Domain Users'], 'ldap': ['cn=nagios admins,ou=group,dc=example,dc=com', 'cn=users,ou=group,dc=example,dc=com']}, 'display_name': 'Administrators Level 2', 'LC_admins': True}, 'users': {'backends_groups': {'ad': ['Domain Users'], 'ldap': ['cn=users,ou=group,dc=example,dc=com']}, 'display_name': 'Simple Users'}}
|
||||
assert expected == inv.flatten
|
||||
|
||||
def testGetGroupMissingRole(self):
|
||||
inv = Roles('./tests/cfg/roles.yml')
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user