def test_portlet_remove(self):
        self.loginAsPortalOwner()
        self.create_portlet(u'review', ReviewAssignment())

        event = ActionSucceededEvent(self.folder, None, None, None)
        event.old_state, event.new_state = 'pending', 'published'
        workflowTriggersReviewPortletReload(self.portal, self.view, event)
        result = self.view.render()
        command = result[0]
        self.failUnless(command.has_key('selector'))
        self.failUnless(command['selector'].startswith('portletwrapper'))
        self.failUnless(command.has_key('name'))
        self.assertEqual(command['name'], 'deleteNode')
 def test_update_of_review_portlet(self):
     self.loginAsPortalOwner()
     portal = self.portal
     self.portal.invokeFactory('Document', 'test-page')
     portal.portal_workflow.doActionFor(self.portal['test-page'], 'submit')
     self.create_portlet(u'review', ReviewAssignment())
     event = ActionSucceededEvent(self.folder, None, None, None)
     event.old_state, event.new_state = 'private', 'pending'
     workflowTriggersReviewPortletReload(self.portal, self.view, event)
     result = self.view.render()
     command = result[0]
     self.failUnless(command.has_key('selector'))
     self.failUnless(command['selector'].startswith('portletwrapper'))
     self.failUnless(command.has_key('name'))
     self.assertEqual(command['name'], 'replaceInnerHTML')
     self.failUnless(command.has_key('params'))
     params = result[0]['params']
     self.failUnless(params.has_key('html'))
     html = params['html']
     self.failUnless('portletWorkflowReview' in html)
     self.failUnless(command.has_key('selectorType'))
     self.assertEqual(command['selectorType'], 'htmlid')