def testStateChange(self): from plone.app.content.browser.contents.workflow import WorkflowActionView # noqa self.request.form['transition'] = 'publish' default_effective = DateTime('1969/12/31 00:00:00 {}'.format( DateTime().timezone() )) default_effective_index = self.convertDateTimeToIndexRepr( default_effective ) pc = getToolByName(self.portal, "portal_catalog") # i need to call it, to populate catalog indexes pc() self.assertEqual( pc.uniqueValuesFor('effective'), (default_effective_index,)) view = WorkflowActionView(self.portal.page, self.request) view() workflowTool = getToolByName(self.portal, "portal_workflow") self.assertEqual( workflowTool.getInfoFor(self.portal.page, 'review_state'), 'published') # commit to update indexes in catalog commit() effective_index = self.convertDateTimeToIndexRepr( self.portal.page.effective_date ) self.assertEqual( pc.uniqueValuesFor('effective'), (effective_index,))
def testStateChange(self): from plone.app.content.browser.contents.workflow import WorkflowActionView # noqa self.request.form['transition'] = 'publish' view = WorkflowActionView(self.portal.page, self.request) view() workflowTool = getToolByName(self.portal, "portal_workflow") self.assertEquals( workflowTool.getInfoFor(self.portal.page, 'review_state'), 'published')