def test_has_perm_add_with_obj_collaborators_non_any_no_change(self):
     permission_logic = CollaboratorsPermissionLogic(any_permission=False,
                                              change_permission=False)
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertFalse(
             permission_logic.has_perm(self.user2, self.perm1, self.article))
 def test_has_perm_add_with_obj_collaborators(self):
     permission_logic = CollaboratorsPermissionLogic()
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertTrue(
             permission_logic.has_perm(self.user2, self.perm1, self.article))
 def test_has_perm_delete_with_obj_collaborators_diff_field_name(self):
     permission_logic = CollaboratorsPermissionLogic(field_name='editors')
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertFalse(
             permission_logic.has_perm(self.user2, self.perm3, self.article))
 def test_has_perm_delete_with_obj_collaborators(self):
     permission_logic = CollaboratorsPermissionLogic()
     self.assertTrue(
             permission_logic.has_perm(self.user2, self.perm3, self.article))
 def test_has_perm_add_with_obj_collaborators_diff_field_name(self):
     permission_logic = CollaboratorsPermissionLogic(field_name='editors')
     self.assertFalse(
             permission_logic.has_perm(self.user2, self.perm1, self.article))
 def test_has_perm_delete_with_obj(self):
     permission_logic = CollaboratorsPermissionLogic()
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertFalse(
             permission_logic.has_perm(self.user1, self.perm3, self.article))
 def test_has_perm_add_with_obj_collaborators(self):
     permission_logic = CollaboratorsPermissionLogic()
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertTrue(
         permission_logic.has_perm(self.user2, self.perm1, self.article))
 def test_has_perm_add_with_obj_collaborators_non_any(self):
     permission_logic = CollaboratorsPermissionLogic(any_permission=False)
     self.assertFalse(
             permission_logic.has_perm(self.user2, self.perm1, self.article))
 def test_has_perm_change_with_obj_collaborators_non_any_no_delete(self):
     permission_logic = CollaboratorsPermissionLogic(any_permission=False,
                                              delete_permission=False)
     self.assertTrue(
             permission_logic.has_perm(self.user2, self.perm2, self.article))
 def test_has_perm_change_without_obj(self):
     permission_logic = CollaboratorsPermissionLogic()
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertTrue(permission_logic.has_perm(self.user1, self.perm2))
 def test_has_perm_delete_with_obj(self):
     permission_logic = CollaboratorsPermissionLogic()
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertFalse(
         permission_logic.has_perm(self.user1, self.perm3, self.article))
 def test_has_perm_delete_with_obj_non_any_no_delete(self):
     permission_logic = CollaboratorsPermissionLogic(
         any_permission=False, delete_permission=False)
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertFalse(
         permission_logic.has_perm(self.user2, self.perm3, self.article))
 def test_has_perm_add_with_obj_collaborators_non_any_no_change(self):
     permission_logic = CollaboratorsPermissionLogic(
         any_permission=False, change_permission=False)
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertFalse(
         permission_logic.has_perm(self.user2, self.perm1, self.article))
 def test_has_perm_delete_with_obj_collaborators_diff_field_name(self):
     permission_logic = CollaboratorsPermissionLogic(field_name='editors')
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertFalse(
         permission_logic.has_perm(self.user2, self.perm3, self.article))
 def test_has_perm_delete_with_obj_non_any_no_delete(self):
     permission_logic = CollaboratorsPermissionLogic(any_permission=False,
                                              delete_permission=False)
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertFalse(
             permission_logic.has_perm(self.user2, self.perm3, self.article))
 def test_has_perm_delete_without_obj(self):
     permission_logic = CollaboratorsPermissionLogic()
     self.assertFalse(permission_logic.has_perm(self.user1, self.perm3))
 def test_has_perm_change_without_obj(self):
     permission_logic = CollaboratorsPermissionLogic()
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertTrue(permission_logic.has_perm(self.user1, self.perm2))
 def test_has_perm_change_with_obj(self):
     permission_logic = CollaboratorsPermissionLogic()
     self.assertFalse(
             permission_logic.has_perm(self.user1, self.perm2, self.article))
 def test_has_perm_add_without_obj_with_anonymous(self):
     permission_logic = CollaboratorsPermissionLogic()
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertFalse(permission_logic.has_perm(self.anonymous, self.perm1))
 def test_has_perm_change_with_obj_with_anonymous(self):
     permission_logic = CollaboratorsPermissionLogic()
     add_permission_logic(self.article.__class__, permission_logic)
     self.assertFalse(
         permission_logic.has_perm(self.anonymous, self.perm2,
                                   self.article))