Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFPlone.tests.testNewsPortletView.TestNewsPortletView Class Reference
Inheritance diagram for CMFPlone.tests.testNewsPortletView.TestNewsPortletView:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testNewsPortletView.TestNewsPortletView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testImplementsINewsPortlet
def testNewsItems
def testUnpublishedNewsItems
def testNoNewsItems
def testAllNewsLink
def testAllNewsLinkNoNewsFolder
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 url
 news
 workflow

Detailed Description

Definition at line 18 of file testNewsPortletView.py.


Member Function Documentation

Definition at line 20 of file testNewsPortletView.py.

00020 
00021     def afterSetUp(self):
00022         self.url = self.portal.portal_url
00023         self.news = self.portal.news
00024         self.workflow = self.portal.portal_workflow
00025         self.setupAuthenticator()

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

NewsPortlet.all_news_link() must return URL of 'news' folder if it exists

Definition at line 53 of file testNewsPortletView.py.

00053 
00054     def testAllNewsLink(self):
00055         """NewsPortlet.all_news_link() must return URL of 'news' folder if it exists"""
00056         view = NewsPortlet(self.portal, self.app.REQUEST)
00057         url = view.all_news_link()
00058         self.failUnlessEqual(url, self.portal.absolute_url()+'/news')

Here is the call graph for this function:

NewsPortlet.all_news_link() must return URL of 'newslisting'
template if 'news' does not exist

Definition at line 59 of file testNewsPortletView.py.

00059 
00060     def testAllNewsLinkNoNewsFolder(self):
00061         """
00062         NewsPortlet.all_news_link() must return URL of 'newslisting'
00063         template if 'news' does not exist
00064         """
00065         # We must have permission to delete objects
00066         self.setRoles(('Manager',))
00067         self.portal.manage_delObjects(['news'])
00068         view = NewsPortlet(self.portal, self.app.REQUEST)
00069         url = view.all_news_link()
00070         self.failUnlessEqual(url, self.portal.absolute_url()+'/news_listing')
00071 

Here is the call graph for this function:

NewsPortlet must implement INewsPortlet

Definition at line 26 of file testNewsPortletView.py.

00026 
00027     def testImplementsINewsPortlet(self):
00028         """NewsPortlet must implement INewsPortlet"""
00029         self.failUnless(INewsPortlet.implementedBy(NewsPortlet))

NewsPortlet.published_news_items() must return published News Items

Definition at line 30 of file testNewsPortletView.py.

00030 
00031     def testNewsItems(self):
00032         """NewsPortlet.published_news_items() must return published News Items"""
00033         self.setRoles(['Manager'])
00034         self.folder.invokeFactory('News Item', id='newsitem', text='data', title='Foo')
00035         self.workflow.doActionFor(self.folder.newsitem, 'publish')
00036         view = NewsPortlet(self.portal, self.app.REQUEST)
00037         result = view.published_news_items()
00038         self.failUnlessEqual(len(result), 1)
00039         self.failUnlessEqual(result[0].getId, 'newsitem')

Here is the call graph for this function:

NewsPortlet.published_news_items() must return empty list if no News Items

Definition at line 47 of file testNewsPortletView.py.

00047 
00048     def testNoNewsItems(self):
00049         """NewsPortlet.published_news_items() must return empty list if no News Items"""
00050         view = NewsPortlet(self.portal, self.app.REQUEST)
00051         result = view.published_news_items()
00052         self.failUnlessEqual(len(result), 0)

Here is the call graph for this function:

NewsPortlet.published_news_items() must not return unpublished News Items

Definition at line 40 of file testNewsPortletView.py.

00040 
00041     def testUnpublishedNewsItems(self):
00042         """NewsPortlet.published_news_items() must not return unpublished News Items"""
00043         self.folder.invokeFactory('News Item', id='newsitem', text='data', title='Foo')
00044         view = NewsPortlet(self.portal, self.app.REQUEST)
00045         result = view.published_news_items()
00046         self.failUnlessEqual(len(result), 0)

Here is the call graph for this function:


Member Data Documentation

Definition at line 22 of file testNewsPortletView.py.

Definition at line 21 of file testNewsPortletView.py.

Definition at line 23 of file testNewsPortletView.py.


The documentation for this class was generated from the following file: