from Products.Five import zcml
from Products.Five import fiveconfigure
from Testing import ZopeTestCase as ztc
from Products.PloneTestCase import PloneTestCase as ptc
from Products.PloneTestCase.layer import onsetup
@onsetup
def setup_optilux_policy():
"""Set up the additional producst required for the Optilux site
policy.
The @onsetup decorator causes the ececution of this body to be
deferred until the setup of the Plone site testing layer."""
# Load the ZCML configuration for the optilux.policy package.
fiveconfigure.debug_mode = True
import optilux.policy
zcml.load_config('configure.zcml', optilux.policy)
fiveconfigure.debug_mode = False
# We need to tell the testing framework that these products
# should be available. This can't happen until after we have loaded
# the ZCML.
ztc.installPackage('optilux.policy')
# The order here is important: We first call the (deferred) function
# which installs the products we need for the Optilux package. Then,
# we let PloneTestCase set up this product on installation.
setup_optilux_policy()
ptc.setupPloneSite(products=['optilux.policy'])
class OptiluxPolicyTestCase(ptc.PloneTestCase):
"""We use this base class for all the tests in this package. If necessary.
we can put common utility or setup code in here.
"""