Back to index

plone3  3.1.7
test_doctests.py
Go to the documentation of this file.
00001 from zope.testing import doctest
00002 from unittest import TestSuite
00003 
00004 from Testing.ZopeTestCase import FunctionalDocFileSuite
00005 from Products.PloneTestCase.PloneTestCase import PloneTestCase
00006 from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
00007 from Products.PloneTestCase.PloneTestCase import setupPloneSite
00008 from Products.CMFCore.utils import getToolByName
00009 
00010 
00011 setupPloneSite()
00012 
00013 OPTIONFLAGS = (doctest.REPORT_ONLY_FIRST_FAILURE |
00014                doctest.ELLIPSIS |
00015                doctest.NORMALIZE_WHITESPACE)
00016 
00017 
00018 class SiteMapTestCase(FunctionalTestCase):
00019     """base test case with convenience methods for all sitemap tests"""
00020 
00021     def afterSetUp(self):
00022         super(SiteMapTestCase, self).afterSetUp()
00023         from Products.Five.testbrowser import Browser
00024         self.browser = Browser()
00025 
00026         self.uf = self.portal.acl_users
00027         self.uf.userFolderAddUser('root', 'secret', ['Manager'], [])
00028 
00029         self.ptool = self.getToolByName('portal_properties')
00030         self.site_props = self.ptool.site_properties
00031 
00032     def getToolByName(self, name):
00033         """docstring for getToolByName"""
00034         return getToolByName(self.portal, name)
00035 
00036 
00037 def test_suite():
00038     tests = ['sitemap.txt']
00039     suite = TestSuite()
00040     for test in tests:
00041         suite.addTest(FunctionalDocFileSuite(test,
00042             optionflags=OPTIONFLAGS,
00043             package="plone.app.layout.sitemap.tests",
00044             test_class=SiteMapTestCase))
00045     return suite