[2732] | 1 | import transaction |
---|
| 2 | |
---|
| 3 | from Products.Five import zcml |
---|
| 4 | from Products.Five import fiveconfigure |
---|
| 5 | from Testing import ZopeTestCase as ztc |
---|
| 6 | |
---|
| 7 | from Products.PloneTestCase.layer import PloneSite |
---|
[2734] | 8 | from Products.PloneTestCase import setup as ptc_setup |
---|
[2732] | 9 | from Products.PloneTestCase import PloneTestCase as ptc |
---|
| 10 | |
---|
| 11 | PACKAGES = [ |
---|
| 12 | 'quintagroup.captcha.core', |
---|
| 13 | 'quintagroup.pfg.captcha', |
---|
| 14 | ] |
---|
[3168] | 15 | REQUIREMENTS = ['PloneFormGen', ] + PACKAGES |
---|
[2732] | 16 | |
---|
| 17 | ptc.setupPloneSite() |
---|
| 18 | |
---|
[2853] | 19 | # !!! Not initialized factory methods for the content types |
---|
| 20 | # !!! (for Plone-4+) if located in NotInstalled.setUp |
---|
| 21 | # !!! method of the layer class. |
---|
| 22 | ztc.installProduct('PloneFormGen') |
---|
| 23 | |
---|
[3168] | 24 | |
---|
[2732] | 25 | class NotInstalled(PloneSite): |
---|
| 26 | """ Only package register, without installation into portal |
---|
| 27 | """ |
---|
| 28 | @classmethod |
---|
| 29 | def setUp(cls): |
---|
| 30 | fiveconfigure.debug_mode = True |
---|
| 31 | import quintagroup.pfg.captcha |
---|
| 32 | zcml.load_config('configure.zcml', quintagroup.pfg.captcha) |
---|
| 33 | fiveconfigure.debug_mode = False |
---|
| 34 | ztc.installPackage('quintagroup.pfg.captcha') |
---|
| 35 | ztc.installPackage('quintagroup.captcha.core') |
---|
| 36 | |
---|
[2734] | 37 | @classmethod |
---|
| 38 | def tearDown(cls): |
---|
| 39 | ptc_setup.cleanupPloneSite(ptc_setup.portal_name) |
---|
[2732] | 40 | |
---|
[2734] | 41 | |
---|
[2732] | 42 | class Installed(NotInstalled): |
---|
| 43 | """ Install product into the portal |
---|
| 44 | """ |
---|
| 45 | @classmethod |
---|
| 46 | def setUp(cls): |
---|
| 47 | app = ztc.app() |
---|
| 48 | portal = app[ptc_setup.portal_name] |
---|
| 49 | |
---|
| 50 | # Sets the local site/manager |
---|
| 51 | ptc_setup._placefulSetUp(portal) |
---|
| 52 | # Install PROJECT |
---|
| 53 | qi = getattr(portal, 'portal_quickinstaller', None) |
---|
[2734] | 54 | qi.installProduct("quintagroup.pfg.captcha") |
---|
[2732] | 55 | transaction.commit() |
---|
| 56 | |
---|
| 57 | @classmethod |
---|
| 58 | def tearDown(cls): |
---|
| 59 | ptc_setup._placefulTearDown() |
---|
| 60 | |
---|
[3168] | 61 | |
---|
[2732] | 62 | class TestCase(ptc.PloneTestCase): |
---|
| 63 | layer = Installed |
---|
| 64 | |
---|
[2734] | 65 | |
---|
[2732] | 66 | class TestCaseNotInstalled(ptc.PloneTestCase): |
---|
| 67 | layer = NotInstalled |
---|