def test_execute_object_without_subject(self): e = SubjectAction() e.same_as_parent = False e.subject = ['Bar', ] o = self.folder['cmf'] ex = getMultiAdapter((self.folder, e, DummyEvent(o)), IExecutable) self.assertEquals(False, ex())
def test_execute_same_as_parent(self): e = SubjectAction() e.same_as_parent = True e.subject = [] ex = getMultiAdapter((self.folder, e, DummyEvent(self.sub_folder)), IExecutable) self.assertEquals(True, ex()) self.assertEquals(self.sub_folder.Subject(), self.folder.Subject())
def test_execute_with_subject(self): e = SubjectAction() e.same_as_parent = False e.subject = ['Bar', ] ex = getMultiAdapter((self.folder, e, DummyEvent(self.sub_folder)), IExecutable) self.assertEquals(True, ex()) self.assertEquals(list(self.sub_folder.Subject()), e.subject)
def test_invoke_edit_view(self): element = getUtility(IRuleAction, name='sc.contentrules.actions.Subject') e = SubjectAction() editview = getMultiAdapter((e, self.folder.REQUEST), name=element.editview) self.failUnless(isinstance(editview, SubjectEditForm))