[Product-Developers] unit testing framework for policy product

Hans-Peter Locher hans-peter.locher at inquant.de
Fri Aug 15 13:09:55 UTC 2008


Hi,
I want to test a policy product (egg), which sets up various products  
on installation.

The policy product does this by including the packages zcml, and  
quickinstalling them in a setuphandler.

One of the products I need to install creates some content in the site.
The prolem is, when loading the configure.zcml in the deferred startup  
method,
I get an unauthorized error when adding content.

How can this be solved?

Is it possible e.g. to set a role Manager, before ptc.setupPloneSite?
or can the zcml be loaded after the setupPloneSite?

Any ideas?

Thanks very much.



code of tests base class:


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

import zff.jc.policy

@onsetup
def setup_zff_jc_policy():
     """Set up the additional products
     """

     fiveconfigure.debug_mode = True
     zcml.load_config('configure.zcml', zff.jc.policy)
     fiveconfigure.debug_mode = False


     ztc.installPackage('zff.jc.policy')

setup_zff_jc_policy()

ptc.setupPloneSite(products=['zff.jc.policy'])


class ZFFTestCase(ptc.PloneTestCase):
     """Base class used for test cases
     """


--
Hans-Peter Locher
InQuant GmbH
Parkstrasse 25
D-88212 Ravensburg
http://www.inquant.de
+49 (0) 751 35 44 112
+49 (0) 751 35 44 115 (FAX)

Geschäftsführer: Lutz Mende
HRB 552769, St.Nr.: 77025/22069, USt.-IdNr.: DE245179196

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20080815/91eddf9e/attachment-0001.html>


More information about the Product-Developers mailing list