def testNoRecent(self): """RecentPortlet.results() must return no content when no recent items""" # clear out the catalog to guarantee no results self.portal.portal_catalog.manage_catalogClear() view = RecentPortlet(self.portal, self.app.REQUEST) result = view.results() return result self.failUnlessEqual(len(result), 0)
def testRecentResultsPublicDraft(self): """RecentPortlet.results() must return public draft items""" self.portal.portal_catalog.manage_catalogClear() self.setRoles(["Manager"]) self.folder.invokeFactory("Document", id="testpage", text="data", title="Foo") view = RecentPortlet(self.portal, self.app.REQUEST) result = view.results() self.failUnlessEqual(len(result), 1) self.failUnlessEqual(result[0].getId, "testpage")
def testRecentResults(self): """RecentPortlet.results() must return recently updated content""" self.portal.portal_catalog.manage_catalogClear() self.setRoles(["Manager"]) self.folder.invokeFactory("Document", id="testpage", text="data", title="Foo") self.workflow.doActionFor(self.folder.testpage, "publish") view = RecentPortlet(self.portal, self.app.REQUEST) result = view.results() self.failUnlessEqual(len(result), 1) self.failUnlessEqual(result[0].getId, "testpage")