Back to index

plone3  3.1.7
testing.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2006 Zope Corporation and Contributors. All Rights Reserved.
00004 #
00005 # This software is subject to the provisions of the Zope Public License,
00006 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
00007 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00008 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00009 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00010 # FOR A PARTICULAR PURPOSE.
00011 #
00012 ##############################################################################
00013 """ Unit test layers.
00014 
00015 $Id: testing.py 73064 2007-03-08 14:03:20Z yuppie $
00016 """
00017 
00018 from Testing import ZopeTestCase
00019 ZopeTestCase.installProduct('ZCTextIndex', 1)
00020 ZopeTestCase.installProduct('CMFCore', 1)
00021 
00022 import transaction
00023 from Products.Five import zcml
00024 
00025 from Products.CMFCore.testing import FunctionalZCMLLayer
00026 from Products.CMFDefault.factory import addConfiguredSite
00027 
00028 
00029 class FunctionalLayer(FunctionalZCMLLayer):
00030 
00031     @classmethod
00032     def setUp(cls):
00033         import Products.CMFCalendar
00034         import Products.CMFDefault
00035         import Products.CMFTopic
00036         import Products.DCWorkflow
00037 
00038         zcml.load_config('configure.zcml', Products.CMFCalendar)
00039         zcml.load_config('configure.zcml', Products.CMFDefault)
00040         zcml.load_config('configure.zcml', Products.CMFTopic)
00041         zcml.load_config('configure.zcml', Products.DCWorkflow)
00042 
00043         app = ZopeTestCase.app()
00044         addConfiguredSite(app, 'site', 'Products.CMFDefault:default',
00045                           snapshot=False,
00046                           extension_ids=('Products.CMFCalendar:default',
00047                                         'Products.CMFCalendar:skins_support'))
00048         transaction.commit()
00049         ZopeTestCase.close(app)
00050 
00051     @classmethod
00052     def tearDown(cls):
00053         app = ZopeTestCase.app()
00054         app._delObject('site')
00055         transaction.commit()
00056         ZopeTestCase.close(app)
00057