Пример #1
0
 def test_set_policy_default_local_roles_1(self):
     """
     When the event has no changes, nothing is reindexed, and no roles
     are deleted or set.
     """
     setPolicyDefaultLocalRoles(self.obj, self.event)
     self.failUnless(self.obj.reindexed == False)
     self.failUnless(self.obj.del_roles == [])
     self.failUnless(self.obj.set_roles == [])
 def test_set_policy_default_local_roles_1(self):
     """
     When the event has no changes, nothing is reindexed, and no roles
     are deleted or set.
     """
     setPolicyDefaultLocalRoles(self.obj, self.event)
     self.assertFalse(self.obj.reindexed)
     self.failUnless(self.obj.del_roles == [])
     self.failUnless(self.obj.set_roles == [])
 def test_set_policy_default_local_roles_7(self):
     """
     When the event has old roles for a group, but no current roles,
     the roles for the group get removed, and the object reindexed.
     """
     self.event.old_group_roles = {'group1': ['role1', 'role2']}
     self.event.new_group_roles = {}
     setPolicyDefaultLocalRoles(self.obj, self.event)
     self.assertTrue(self.obj.reindexed)
     self.failUnless(self.obj.del_roles == ['group1'])
     self.failUnless(self.obj.set_roles == [])
 def test_set_policy_default_local_roles_5(self):
     """
     When the event has new roles for a group without previous roles, the
     group becomes GroupReader and the object is reindexed.
     """
     self.event.new_group_roles = {'group1': ['role1', 'role2']}
     setPolicyDefaultLocalRoles(self.obj, self.event)
     self.assertTrue(self.obj.reindexed)
     self.failUnless(self.obj.del_roles == [])
     expected = [('group1', ['GroupReader'])]
     self.failUnless(self.obj.set_roles == expected)
Пример #5
0
 def test_set_policy_default_local_roles_7(self):
     """
     When the event has old roles for a group, but no current roles, the roles
     for the group get removed, and the object reindexed.
     """
     self.event.old_group_roles = {'group1': ['role1', 'role2']}
     self.event.new_group_roles = {}
     setPolicyDefaultLocalRoles(self.obj, self.event)
     self.failUnless(self.obj.reindexed == True)
     self.failUnless(self.obj.del_roles == ['group1'])
     self.failUnless(self.obj.set_roles == [])
Пример #6
0
 def test_set_policy_default_local_roles_5(self):
     """
     When the event has new roles for a group without previous roles, the
     group becomes GroupReader and the object is reindexed.
     """
     self.event.new_group_roles = {'group1': ['role1', 'role2']}
     setPolicyDefaultLocalRoles(self.obj, self.event)
     self.failUnless(self.obj.reindexed == True)
     self.failUnless(self.obj.del_roles == [])
     expected = [('group1', ['GroupReader'])]
     self.failUnless(self.obj.set_roles == expected)
 def test_set_policy_default_local_roles_4(self):
     """
     When the event has old roles for a user, but no current roles, the roles
     for the user get removed, and the object reindexed.
     """
     self.event.old_user_roles = {'user1':['role1', 'role2']}
     self.event.new_user_roles = {} 
     setPolicyDefaultLocalRoles(self.obj, self.event)
     self.failUnless(self.obj.reindexed == True)
     self.failUnless(self.obj.del_roles == ['user1'])
     self.failUnless(self.obj.set_roles == [])
 def test_set_policy_default_local_roles_2(self):
     """
     When the event has new roles for a user without previous roles, user
     becomes GroupReader and the object is reindexed.
     """
     self.event.new_user_roles = {'user1':['role1', 'role2']}
     setPolicyDefaultLocalRoles(self.obj, self.event)
     self.failUnless(self.obj.reindexed == True)
     self.failUnless(self.obj.del_roles == [])
     expected = [('user1', ['GroupReader'])]
     self.failUnless(self.obj.set_roles == expected)
Пример #9
0
 def test_set_policy_default_local_roles_3(self):
     """
     When the event has new roles for a user with previous roles, the user
     becomes GroupReader again, and the object is reindexed. 
     """
     self.event.old_user_roles = {'user1': ['role1']}
     self.event.new_user_roles = {'user1': ['role1', 'role2']}
     setPolicyDefaultLocalRoles(self.obj, self.event)
     self.failUnless(self.obj.reindexed == True)
     self.failUnless(self.obj.del_roles == [])
     expected = [('user1', ['GroupReader'])]
     self.failUnless(self.obj.set_roles == expected)