Пример #1
0
 def testNewsItems(self):
     """NewsPortlet.published_news_items() must return published News Items"""
     self.setRoles(['Manager'])
     self.folder.invokeFactory('News Item', id='newsitem', text='data', title='Foo')
     self.workflow.doActionFor(self.folder.newsitem, 'publish')
     view = NewsPortlet(self.portal, self.app.REQUEST)
     result = view.published_news_items()
     self.failUnlessEqual(len(result), 1)
     self.failUnlessEqual(result[0].getId, 'newsitem')
Пример #2
0
 def testAllNewsLinkNoNewsFolder(self):
     """
     NewsPortlet.all_news_link() must return URL of 'newslisting'
     template if 'news' does not exist
     """
     # We must have permission to delete objects
     self.setRoles(('Manager',))
     self.portal.manage_delObjects(['news'])
     view = NewsPortlet(self.portal, self.app.REQUEST)
     url = view.all_news_link()
     self.failUnlessEqual(url, self.portal.absolute_url()+'/news_listing')
Пример #3
0
 def testAllNewsLink(self):
     """NewsPortlet.all_news_link() must return URL of 'news' folder if it exists"""
     view = NewsPortlet(self.portal, self.app.REQUEST)
     url = view.all_news_link()
     self.failUnlessEqual(url, self.portal.absolute_url()+'/news')
Пример #4
0
 def testNoNewsItems(self):
     """NewsPortlet.published_news_items() must return empty list if no News Items"""
     view = NewsPortlet(self.portal, self.app.REQUEST)
     result = view.published_news_items()
     self.failUnlessEqual(len(result), 0)
Пример #5
0
 def testUnpublishedNewsItems(self):
     """NewsPortlet.published_news_items() must not return unpublished News Items"""
     self.folder.invokeFactory('News Item', id='newsitem', text='data', title='Foo')
     view = NewsPortlet(self.portal, self.app.REQUEST)
     result = view.published_news_items()
     self.failUnlessEqual(len(result), 0)