def testGetAllRoles(self):
        test_ob = LocalRoles(None)
        test_ob.context = Mock()
        test_ob.context.members = set(['member1', 'member2'])
        test_ob.context.managers = set(['manager1', 'manager2'])
        test_ob.context.invitedMembers = set(['invited1', 'invited2'])
        test_ob.context.invitedManagers = set(['invited3', 'invited4'])

        expected = [
            ('invited1', ('Reader')),
            ('invited2', ('Reader')),
            ('invited3', ('Reader')),
            ('invited4', ('Reader')),
            ('manager1', ('Editor', 'Contributor')),
            ('manager2', ('Editor', 'Contributor')),
            ('member1', ('Contributor')),
            ('member2', ('Contributor')),
        ]

        self.assertEquals(expected,
            sorted(test_ob.getAllRoles(), key=lambda x: x[0]))
    def testGetRoles(self):
        test_ob = LocalRoles(None)
        test_ob.context = Mock()
        test_ob.context.members = set(['member1'])
        test_ob.context.managers = set(['manager1'])
        test_ob.context.invitedMembers = set(['invited1'])
        test_ob.context.invitedManagers = set(['invited3'])

        self.assertEquals(
            set(['Reader']),
            set(test_ob.getRoles('invited1')))
        self.assertEquals(
            set(['Reader']),
            set(test_ob.getRoles('invited3')))
        self.assertEquals(
            set(['Contributor']),
            set(test_ob.getRoles('member1')))
        self.assertEquals(
            set(['Editor', 'Contributor']),
            set(test_ob.getRoles('manager1')))