# # Skeleton CMFTestCase # import os, sys if __name__ == '__main__': execfile(os.path.join(sys.path[0], 'framework.py')) from Products.CMFTestCase import CMFTestCase CMFTestCase.installProduct('SomeProduct') CMFTestCase.setupCMFSite() class TestSomeProduct(CMFTestCase.CMFTestCase): def afterSetUp(self): pass def testSomething(self): # Test something self.assertEqual(1+1, 2) def test_suite(): from unittest import TestSuite, makeSuite suite = TestSuite() suite.addTest(makeSuite(TestSomeProduct)) return suite if __name__ == '__main__':
""" $Id: test_doctests.py 14058 2005-11-18 01:03:05Z dreamcatcher $ """ import os import sys if __name__ == '__main__': execfile(os.path.join(sys.path[0], 'framework.py')) # Load fixture from Testing import ZopeTestCase from Testing.ZopeTestCase import FunctionalDocFileSuite from Products.CMFTestCase import CMFTestCase CMFTestCase.installProduct('PageTemplates') CMFTestCase.installProduct('StandardCacheManagers') CMFTestCase.installProduct('PolicyHTTPCacheManager') CMFTestCase.setupCMFSite() class FunctionalTest(CMFTestCase.FunctionalTestCase): pass def test_suite(): import unittest suite = unittest.TestSuite() for fname in ( 'cache_manager.txt', ): suite.addTest( FunctionalDocFileSuite( fname,
import doctest import unittest from Products.CMFTestCase import CMFTestCase from Products.GenericSetup import EXTENSION, profile_registry from Testing.ZopeTestCase import FunctionalDocFileSuite as Suite CMFTestCase.installProduct('CMFQuickInstallerTool') CMFTestCase.installProduct('CMFCalendar') CMFTestCase.setupCMFSite() OPTIONFLAGS = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE) def registerTestProfile(test): profile_registry.registerProfile('test', 'CMFQI test profile', 'Test profile for CMFQuickInstallerTool', 'profiles/test', 'Products.CMFQuickInstallerTool', EXTENSION, for_=None) def test_suite(): return unittest.TestSuite(( Suite('actions.txt', optionflags=OPTIONFLAGS, package='Products.CMFQuickInstallerTool.tests', setUp=registerTestProfile,
import types # ZopeTestCase imports and setup. from Testing import ZopeTestCase from Testing.ZopeTestCase import transaction, user_name, user_password # CMFTestCase imports. try: from Products.CMFTestCase import CMFTestCase except ImportError: # No CMF :-S def test_suite(): from unittest import TestSuite return TestSuite() else: CMFTestCase.installProduct('MailHost') # CMF barfs without this. CMFTestCase.installProduct('ZCTextIndex') # CMF 1.5+ requires this. CMFTestCase.installProduct('CMFCore') CMFTestCase.installProduct('CMFDefault') CMFTestCase.installProduct('ZSyncer') # Zope imports, must follow the ZopeTestCase product installations. from Products.CMFCore.utils import getToolByName from Products.CMFCore.DirectoryView import addDirectoryViews from Products.CMFDefault.Portal import manage_addCMFSite from Products.ZSyncer.ZSyncer import manage_addZSyncer from Products.ZSyncer.ZSyncer import ZSyncerObjNotFound from Products.ZSyncer import zs_globals from Products.ZSyncer.ZSyncerTool import manage_addZSyncerTool from Products.ZSyncer.ZSyncer import ZSyncer, Config, ZSyncerConfigError from Products.ZSyncer.ZSyncer import OK, EXTRA, MISSING, OOD
def installProducts(): for product in product_dependencies: CMFTestCase.installProduct(product)
# # Tests a CMF product # import os, sys if __name__ == '__main__': execfile(os.path.join(sys.path[0], 'framework.py')) from Products.CMFTestCase import CMFTestCase CMFTestCase.installProduct('CMFCalendar') profiles = ('CMFCalendar:default',) if CMFTestCase.CMF21: profiles = ('Products.CMFCalendar:default',) if CMFTestCase.CMF16: CMFTestCase.setupCMFSite(extension_profiles=profiles) else: CMFTestCase.setupCMFSite(products=('CMFCalendar',)) class TestCalendar(CMFTestCase.CMFTestCase): def afterSetUp(self): self.catalog = self.portal.portal_catalog def testToolsInstalled(self): self.failUnless(hasattr(self.portal, 'portal_calendar'))