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