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