def test_getRoles_1(self):
     """
     Expecting an empty list when no user or group roles attributes exist
     """
     class Dummy:
         pass
     obj = Dummy()
     local_roles = LocalRoles(obj)
     self.assertEqual([], local_roles.getRoles('dummy'))
 def test_getRoles_5(self):
     """
     Expecting the list of roles when a group has roles assigned.
     """
     class Dummy:
         user_roles = None
         group_roles = {'group1': ['role1', 'role2']}
     obj = Dummy()
     local_roles = LocalRoles(obj)
     self.assertEqual(['role1', 'role2'], local_roles.getRoles('group1'))
 def test_getRoles_4(self):
     """
     Expecting the list of roles when a user has roles assigned.
     """
     class Dummy:
         user_roles = {'user1': ['role1']}
         group_roles = None
     obj = Dummy()
     local_roles = LocalRoles(obj)
     self.assertEqual(['role1'], local_roles.getRoles('user1'))
Example #4
0
    def test_getRoles_1(self):
        """
        Expecting an empty list when no user or group roles attributes exist
        """
        class Dummy:
            pass

        obj = Dummy()
        local_roles = LocalRoles(obj)
        self.assertEqual([], local_roles.getRoles('dummy'))
 def test_getRoles_3(self):
     """
     Expecting an empty list when the user and group roles attributes are
     empty dictionaries.
     """
     class Dummy:
         user_roles = {}
         group_roles = {}
     obj = Dummy()
     local_roles = LocalRoles(obj)
     self.assertEqual([], local_roles.getRoles('dummy'))
 def test_getRoles_2(self):
     """
     Expecting an empty list when the user and group roles attributes are
     None.
     """
     class Dummy:
         user_roles = None
         group_roles = None
     obj = Dummy()
     local_roles = LocalRoles(obj)
     self.assertEqual([], local_roles.getRoles('dummy'))
Example #7
0
    def test_getRoles_5(self):
        """
        Expecting the list of roles when a group has roles assigned.
        """
        class Dummy:
            user_roles = None
            group_roles = {'group1': ['role1', 'role2']}

        obj = Dummy()
        local_roles = LocalRoles(obj)
        self.assertEqual(['role1', 'role2'], local_roles.getRoles('group1'))
Example #8
0
    def test_getRoles_3(self):
        """
        Expecting an empty list when the user and group roles attributes are
        empty dictionaries.
        """
        class Dummy:
            user_roles = {}
            group_roles = {}

        obj = Dummy()
        local_roles = LocalRoles(obj)
        self.assertEqual([], local_roles.getRoles('dummy'))
Example #9
0
    def test_getRoles_2(self):
        """
        Expecting an empty list when the user and group roles attributes are
        None.
        """
        class Dummy:
            user_roles = None
            group_roles = None

        obj = Dummy()
        local_roles = LocalRoles(obj)
        self.assertEqual([], local_roles.getRoles('dummy'))
Example #10
0
    def test_getRoles_4(self):
        """
        Expecting the list of roles when a user has roles assigned.
        """
        class Dummy:
            user_roles = {
                'user1': ['role1'],
            }
            group_roles = None

        obj = Dummy()
        local_roles = LocalRoles(obj)
        self.assertEqual(['role1'], local_roles.getRoles('user1'))