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 73035 2007-03-07 16:41:03Z jens $
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.CMFDefault
00034         import Products.CMFTopic
00035         import Products.DCWorkflow
00036 
00037         zcml.load_config('configure.zcml', Products.CMFDefault)
00038         zcml.load_config('configure.zcml', Products.CMFTopic)
00039         zcml.load_config('configure.zcml', Products.DCWorkflow)
00040 
00041         app = ZopeTestCase.app()
00042         addConfiguredSite(app, 'site', 'Products.CMFDefault:default',
00043                           snapshot=False)
00044         transaction.commit()
00045         ZopeTestCase.close(app)
00046 
00047     @classmethod
00048     def tearDown(cls):
00049         app = ZopeTestCase.app()
00050         app._delObject('site')
00051         transaction.commit()
00052         ZopeTestCase.close(app)
00053