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

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

pep8fixes

  • 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',
18          'captchas_contact_info']
19
20TOOL_ICON = 'skins/plone_captchas/tool.gif'
21TOOL_ID = 'portal_captchas'
22CONFIGLET_ID = "qpc_tool"
23PROPERTY_SHEET = 'qPloneCaptchas'
24
25# register_form profile
26RF_PROFILE = 'profile-quintagroup.plonecaptchas:register_form'
27
28ptc.setupPloneSite()
29
30
31class NotInstalled(PloneSite):
32    """ Only package register, without installation into portal
33    """
34
35    @classmethod
36    def setUp(cls):
37        fiveconfigure.debug_mode = True
38        import quintagroup.captcha.core
39        import quintagroup.plonecaptchas
40        zcml.load_config('configure.zcml', quintagroup.captcha.core)
41        zcml.load_config('configure.zcml', quintagroup.plonecaptchas)
42        fiveconfigure.debug_mode = False
43        ztc.installPackage('quintagroup.plonecaptchas')
44        ztc.installPackage('quintagroup.captcha.core')
45
46
47class Installed(NotInstalled):
48    """ Install product into the portal
49    """
50    @classmethod
51    def setUp(cls):
52        app = ztc.app()
53        portal = app[ptc_setup.portal_name]
54
55        # Sets the local site/manager
56        ptc_setup._placefulSetUp(portal)
57        # Install PROJECT
58        qi = getattr(portal, 'portal_quickinstaller', None)
59        qi.installProduct(PRODUCT_NAME)
60
61        # Run register_form profile
62        gs = getattr(portal, 'portal_setup', None)
63        gs.runAllImportStepsFromProfile(RF_PROFILE)
64
65        transaction.commit()
66
67    @classmethod
68    def tearDown(cls):
69        ptc_setup._placefulTearDown()
70
71
72class TestCase(ptc.PloneTestCase):
73    layer = Installed
74
75
76class TestCaseNotInstalled(ptc.PloneTestCase):
77    layer = NotInstalled
78
79
80class FunctionalTestCase(ptc.FunctionalTestCase):
81    layer = Installed
82
83
84class FunctionalTestCaseNotInstalled(ptc.FunctionalTestCase):
85    layer = NotInstalled
Note: See TracBrowser for help on using the repository browser.