def testExecute(self): e = SetLayoutAction() e.layout = 'folder_summary_view' ex = getMultiAdapter((self.folder, e, DummyEvent(self.sub_folder)), IExecutable) self.assertEquals(True, ex()) self.assertEquals(self.sub_folder.layout, e.layout)
def testExecuteWithError(self): e = SetLayoutAction() e.layout = 'document_view' ex = getMultiAdapter((self.folder, e, DummyEvent(self.sub_folder)), IExecutable) self.assertEquals(False, ex()) # Layout not set self.assertEquals(hasattr(self.sub_folder, 'layout'), False)
def testInvokeEditView(self): element = getUtility(IRuleAction, name='sc.contentrules.actions.layout') e = SetLayoutAction() editview = getMultiAdapter((e, self.folder.REQUEST), name=element.editview) self.failUnless(isinstance(editview, SetLayoutEditForm))