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