source: products/quintagroup.plonecaptchas/branches/plone4/quintagroup/plonecaptchas/tests/base.py @ 3154

Last change on this file since 3154 was 3154, checked in by vmaksymiv, 13 years ago

pyfakes fixes

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1import transaction
2
3from Products.Five import zcml
4from Products.Five import fiveconfigure
5
6from Testing import ZopeTestCase as ztc
7
8from Products.PloneTestCase import setup as ptc_setup
9from Products.PloneTestCase import PloneTestCase as ptc
10from Products.PloneTestCase.layer import PloneSite
11
12from quintagroup.plonecaptchas.config import PRODUCT_NAME
13
14# TESTING CONSTANTS
15CAPTCHA_KEY = 'captcha_key'
16CAPTCHAS_COUNT = 165
17LAYERS = ['captchas_discussion', 'captchas_sendto_form', "captchas_contact_info"]
18
19TOOL_ICON = 'skins/plone_captchas/tool.gif'
20TOOL_ID = 'portal_captchas'
21CONFIGLET_ID = "qpc_tool"
22PROPERTY_SHEET = 'qPloneCaptchas'
23
24# register_form profile
25RF_PROFILE = 'profile-quintagroup.plonecaptchas:register_form'
26
27ptc.setupPloneSite()
28
29class NotInstalled(PloneSite):
30    """ Only package register, without installation into portal
31    """
32
33    @classmethod
34    def setUp(cls):
35        fiveconfigure.debug_mode = True
36        import quintagroup.captcha.core
37        import quintagroup.plonecaptchas
38        zcml.load_config('configure.zcml', quintagroup.captcha.core)
39        zcml.load_config('configure.zcml', quintagroup.plonecaptchas)
40        fiveconfigure.debug_mode = False
41        ztc.installPackage('quintagroup.plonecaptchas')
42        ztc.installPackage('quintagroup.captcha.core')
43
44
45class Installed(NotInstalled):
46    """ Install product into the portal
47    """
48    @classmethod
49    def setUp(cls):
50        app = ztc.app()
51        portal = app[ptc_setup.portal_name]
52
53        # Sets the local site/manager
54        ptc_setup._placefulSetUp(portal)
55        # Install PROJECT
56        qi = getattr(portal, 'portal_quickinstaller', None)
57        qi.installProduct(PRODUCT_NAME)
58
59        # Run register_form profile
60        gs = getattr(portal, 'portal_setup', None)
61        gs.runAllImportStepsFromProfile(RF_PROFILE)
62
63        transaction.commit()
64
65    @classmethod
66    def tearDown(cls):
67        ptc_setup._placefulTearDown()
68
69
70class TestCase(ptc.PloneTestCase):
71    layer = Installed
72
73class TestCaseNotInstalled(ptc.PloneTestCase):
74    layer = NotInstalled
75
76
77class FunctionalTestCase(ptc.FunctionalTestCase):
78    layer = Installed
79
80class FunctionalTestCaseNotInstalled(ptc.FunctionalTestCase):
81    layer = NotInstalled
Note: See TracBrowser for help on using the repository browser.