[965] | 1 | import transaction |
---|
| 2 | |
---|
[832] | 3 | from Products.Five import zcml, fiveconfigure |
---|
| 4 | |
---|
| 5 | from Testing import ZopeTestCase as ztc |
---|
[965] | 6 | from AccessControl.SecurityManagement import newSecurityManager, \ |
---|
| 7 | noSecurityManager |
---|
[832] | 8 | |
---|
| 9 | from Products.PloneTestCase import PloneTestCase as ptc |
---|
[965] | 10 | from Products.PloneTestCase.layer import onsetup, PloneSiteLayer |
---|
[832] | 11 | from Products.CMFCore.utils import getToolByName |
---|
| 12 | |
---|
[3112] | 13 | from quintagroup.plonecomments.tests.config import PRODUCT |
---|
[832] | 14 | |
---|
[965] | 15 | |
---|
[832] | 16 | @onsetup |
---|
| 17 | def setup_product(): |
---|
| 18 | """Set up additional products and ZCML required to test this product. |
---|
| 19 | |
---|
| 20 | The @onsetup decorator causes the execution of this body to be deferred |
---|
| 21 | until the setup of the Plone site testing layer. |
---|
| 22 | """ |
---|
| 23 | |
---|
| 24 | # Load the ZCML configuration for this package and its dependencies |
---|
| 25 | |
---|
| 26 | fiveconfigure.debug_mode = True |
---|
| 27 | import quintagroup.plonecomments |
---|
| 28 | zcml.load_config('configure.zcml', quintagroup.plonecomments) |
---|
| 29 | zcml.load_config('overrides.zcml', quintagroup.plonecomments) |
---|
| 30 | fiveconfigure.debug_mode = False |
---|
| 31 | |
---|
| 32 | # We need to tell the testing framework that these products |
---|
| 33 | # should be available. This can't happen until after we have loaded |
---|
| 34 | # the ZCML. |
---|
[2983] | 35 | if not ptc.PLONE31: |
---|
| 36 | ztc.installPackage("plone.browserlayer") |
---|
[832] | 37 | ztc.installPackage(PRODUCT) |
---|
[2983] | 38 | transaction.commit() |
---|
[832] | 39 | |
---|
[2983] | 40 | |
---|
[832] | 41 | # The order here is important: We first call the deferred function and then |
---|
| 42 | # let PloneTestCase install it during Plone site setup |
---|
| 43 | |
---|
| 44 | setup_product() |
---|
[2983] | 45 | if not ptc.PLONE31: |
---|
| 46 | ptc.setupPloneSite(products=["plone.browserlayer", PRODUCT]) |
---|
| 47 | else: |
---|
| 48 | ptc.setupPloneSite(products=[PRODUCT]) |
---|
[832] | 49 | |
---|
[965] | 50 | |
---|
[832] | 51 | class TestCase(ptc.PloneTestCase): |
---|
| 52 | """Base class used for test cases |
---|
| 53 | """ |
---|
| 54 | |
---|
[965] | 55 | |
---|
[832] | 56 | class FunctionalTestCase(ptc.FunctionalTestCase): |
---|
| 57 | """Test case class used for functional (doc-)tests |
---|
[965] | 58 | """ |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | class TestErase(TestCase): |
---|
[3096] | 62 | """Test case class used for uninstalling tests |
---|
| 63 | """ |
---|