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