Back to index

plone3  3.1.7
Functions | Variables
plone.portlets.tests Namespace Reference

Functions

def configurationSetUp
def configurationTearDown
def test_safe_render
def test_suite

Variables

 optionflags = doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS

Function Documentation

Definition at line 11 of file tests.py.

00011 
00012 def configurationSetUp(test):
00013     setUp()
00014 
00015     import zope.contentprovider
00016     import zope.security
00017     import zope.app.component
00018     import zope.app.container
00019     import zope.app.pagetemplate
00020     import zope.app.security
00021 
00022     XMLConfig('meta.zcml', zope.security)()
00023     XMLConfig('meta.zcml', zope.app.component)()
00024     XMLConfig('meta.zcml', zope.app.pagetemplate)()
00025     XMLConfig('meta.zcml', zope.app.security)()
00026 
00027     # BBB conditional code for loading the utility dispatchers
00028     # In Zope 2.11 they are in zope.component
00029     try:
00030         import zope.component
00031         XMLConfig('configure.zcml', zope.component)()
00032     except IOError:
00033         pass
00034     # In Zope 2.10 they are in zope.app.event
00035     try:
00036         import zope.app.event
00037         XMLConfig('configure.zcml', zope.app.event)()
00038     except (ImportError, IOError):
00039         pass
00040 
00041     XMLConfig('configure.zcml', zope.app.security)()
00042     XMLConfig('configure.zcml', zope.app.container)()
00043     XMLConfig('configure.zcml', zope.contentprovider)()
00044     
00045     XMLConfig('configure.zcml', plone.portlets)()
00046 

Here is the call graph for this function:

Definition at line 47 of file tests.py.

00047 
00048 def configurationTearDown(test):
00049     tearDown()

Here is the call graph for this function:

Definition at line 50 of file tests.py.

00050 
00051 def test_safe_render():
00052     r"""
00053     Render the portlet safely, so that when an exception
00054     occurs, we log and don't bail out.
00055 
00056       >>> from plone.portlets.manager import PortletManagerRenderer
00057       >>> class PortletRenderer:
00058       ...     def __init__(self, error=False):
00059       ...         self.error = error
00060       ...     def render(self):
00061       ...         if self.error:
00062       ...             raise Exception()
00063       ...         return 'portlet rendered'
00064 
00065     When no error occurs, ``safe_render`` will return the portlet
00066     renderer's ``render()``:
00067     
00068       >>> renderer = PortletManagerRenderer(*(None,) * 4)
00069       >>> renderer.safe_render(PortletRenderer())
00070       'portlet rendered'
00071 
00072     When an error is raised, the ``error_message`` template is
00073     rendered:
00074     
00075       >>> renderer.error_message = lambda: 'error rendered'
00076       >>> renderer.safe_render(PortletRenderer(error=True))
00077       'error rendered'
00078     """

Definition at line 79 of file tests.py.

00079 
00080 def test_suite():
00081     return unittest.TestSuite((
00082         doctest.DocFileSuite(
00083             'README.txt',
00084             setUp=configurationSetUp,
00085             tearDown=configurationTearDown,
00086             optionflags=optionflags),
00087         doctest.DocFileSuite(
00088             'uisupport.txt',
00089             setUp=configurationSetUp,
00090             tearDown=configurationTearDown,
00091             optionflags=optionflags),
00092         doctest.DocFileSuite(
00093             'utils.txt',
00094             setUp=configurationSetUp,
00095             tearDown=configurationTearDown,
00096             optionflags=optionflags),
00097         doctest.DocTestSuite()))


Variable Documentation

plone.portlets.tests.optionflags = doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS

Definition at line 9 of file tests.py.