1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-11 12:08:51 +01:00

adding a test for get_roles

This commit is contained in:
kakwa 2015-05-16 19:15:20 +02:00
parent ab660ebe96
commit 6289f62c6c

View File

@ -6,6 +6,7 @@ from __future__ import unicode_literals
import pytest import pytest
import sys import sys
from sets import Set
from ldapcherry.roles import Roles from ldapcherry.roles import Roles
from ldapcherry.exceptions import DumplicateRoleKey, MissingKey, DumplicateRoleContent, MissingRolesFile from ldapcherry.exceptions import DumplicateRoleKey, MissingKey, DumplicateRoleContent, MissingRolesFile
from ldapcherry.pyyamlwrapper import DumplicatedKey, RelationError from ldapcherry.pyyamlwrapper import DumplicatedKey, RelationError
@ -58,3 +59,12 @@ class TestError(object):
else: else:
raise AssertionError("expected an exception") raise AssertionError("expected an exception")
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'])}
assert inv.get_roles(groups) == expected