def test_allowed_local_users_and_groups_1(self):
     """First test for empty list when no roles are set
     """
     class Dummy:
         user_roles = None
         group_roles = None
     obj = Dummy()
     self.assertEqual((), allowedLocalUsersAndGroups(obj)())
 def test_allowed_local_users_and_groups_4(self):
     """Test with one user and one group
     """
     class Dummy:
         user_roles = {'user1': ['role1']}
         group_roles = {'group1': ['role1']}
     obj = Dummy()
     expected = ('user:user1', 'group:group1')
     self.assertEqual(expected, allowedLocalUsersAndGroups(obj)())
예제 #3
0
    def test_allowed_local_users_and_groups_1(self):
        """First test for empty list when no roles are set
        """
        class Dummy:
            user_roles = None
            group_roles = None

        obj = Dummy()
        self.assertEqual((), allowedLocalUsersAndGroups(obj)())
예제 #4
0
    def test_allowed_local_users_and_groups_4(self):
        """Test with one user and one group
        """
        class Dummy:
            user_roles = {'user1': ['role1']}
            group_roles = {'group1': ['role1']}

        obj = Dummy()
        expected = ('user:user1', 'group:group1')
        self.assertEqual(expected, allowedLocalUsersAndGroups(obj)())
 def test_allowed_local_users_and_groups_5(self):
     """Test with multiple users and one groups
     """
     class Dummy:
         user_roles = {'user1':['role1'], 'user2':['role2'], 'user3':['role3']}
         group_roles = {'group1':['role1'], 'group2':['role2']}
     obj = Dummy()
     expected = ['group:group1', 'group:group2', 'user:user1', 'user:user2', 'user:user3']
     result = allowedLocalUsersAndGroups(obj)()
     result = list(result)
     result.sort()
     self.assertEqual(expected, result)
예제 #6
0
    def test_allowed_local_users_and_groups_5(self):
        """Test with multiple users and one groups
        """
        class Dummy:
            user_roles = {
                'user1': ['role1'],
                'user2': ['role2'],
                'user3': ['role3']
            }
            group_roles = {'group1': ['role1'], 'group2': ['role2']}

        obj = Dummy()
        expected = [
            'group:group1', 'group:group2', 'user:user1', 'user:user2',
            'user:user3'
        ]
        result = allowedLocalUsersAndGroups(obj)()
        result = list(result)
        result.sort()
        self.assertEqual(expected, result)