def test_withdraw(self): """ withdraw request for approval (normal scenario) """ content = self.root.test message = 'please approve.' publisher = IPublicationWorkflow(content) publisher.request_approval(message) self.assertTrue(publisher.withdraw_request('made a mistake')) self.assertFalse(content.is_approval_requested()) with self.assertRaises(VersioningError): publisher.withdraw_request('make an other mistake')
def test_request_approval(self): factory = self.root.manage_addProduct["Silva"] factory.manage_addMockupVersionedContent("document", "Document") document = self.root.document self.layer.login("author") # Request approval with AssertLog(self, [["author", "request approval", "/root/document/0"]]): IPublicationWorkflow(document).request_approval("Ready") # Withdraw approval with AssertLog(self, [["author", "cancel request approval", "/root/document/0"]]): adapter = IPublicationWorkflow(document) adapter.withdraw_request("Not really ready") IPublicationWorkflow(document).request_approval("Ready") self.layer.login("chiefeditor") # Reject approval with AssertLog(self, [["chiefeditor", "reject request approval", "/root/document/0"]]): IPublicationWorkflow(document).reject_request("Not really ready")