From 6289f62c6c113735d352d2818ec8d230052643ef Mon Sep 17 00:00:00 2001 From: kakwa Date: Sat, 16 May 2015 19:15:20 +0200 Subject: [PATCH] adding a test for get_roles --- tests/test_Roles.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_Roles.py b/tests/test_Roles.py index 8505729..6be78ef 100644 --- a/tests/test_Roles.py +++ b/tests/test_Roles.py @@ -6,6 +6,7 @@ from __future__ import unicode_literals import pytest import sys +from sets import Set from ldapcherry.roles import Roles from ldapcherry.exceptions import DumplicateRoleKey, MissingKey, DumplicateRoleContent, MissingRolesFile from ldapcherry.pyyamlwrapper import DumplicatedKey, RelationError @@ -58,3 +59,12 @@ class TestError(object): else: 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