copied paula.testing -> paula.app.testing
[paula.git] / paula.app.testing / src / paula / testing / plonetesting.py
blob55b836d86c753daaba7399ba8c3f91f8883e603b
1 from Products.Five import zcml
2 from Products.Five import fiveconfigure
4 from Testing import ZopeTestCase as ztc
6 from Products.PloneTestCase import PloneTestCase as ptc
7 from Products.PloneTestCase.layer import onsetup, PloneSite
8 from Products.PloneTestCase.PloneTestCase import setupPloneSite
10 from plone.app.controlpanel.tests import ControlPanelTestCase
11 from kss.core.tests.base import KSSLayer, KSSViewTestCase
13 from paula.testing.testing import my_import
15 @onsetup
16 def setup_package(pkg_name, deps=[]):
17 """
18 The @onsetup decorator causes the execution of this body to be deferred
19 until the setup of the Plone site testing layer.
20 """
22 # Load the ZCML configuration for the optilux.policy package.
23 # This includes the other products below as well.
25 fiveconfigure.debug_mode = True
27 mod = my_import(pkg_name)
28 zcml.load_config('ftesting.zcml', mod)
29 fiveconfigure.debug_mode = False
31 # We need to tell the testing framework that these products
32 # should be available. This can't happen until after we have loaded
33 # the ZCML.
35 ztc.installPackage(pkg_name)
36 for x in deps:
37 ztc.installPackage(x)
39 class PloneTestCase(ptc.PloneTestCase):
40 """Base class used for test cases
41 """
43 class FunctionalTestCase(ptc.FunctionalTestCase):
44 """Test case class used for functional (doc-)tests
45 """
47 class PanelTestCase(FunctionalTestCase, ControlPanelTestCase):
48 """Test case used for the control panel tests, with some convenience
49 methods from plone.app.controlpanel.
50 """
52 class KSSTestCase(FunctionalTestCase, KSSViewTestCase):
53 """Test case used for KSS tests
54 """
56 class layer(KSSLayer, PloneSite):
57 pass