source: products/quintagroup.pfg.captcha/trunk/quintagroup/pfg/captcha/tests/base.py @ 3168

Last change on this file since 3168 was 3168, checked in by vmaksymiv, 9 years ago

pep8, pyflakes fixes

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1import transaction
2
3from Products.Five import zcml
4from Products.Five import fiveconfigure
5from Testing import ZopeTestCase as ztc
6
7from Products.PloneTestCase.layer import PloneSite
8from Products.PloneTestCase import setup as ptc_setup
9from Products.PloneTestCase import PloneTestCase as ptc
10
11PACKAGES = [
12    'quintagroup.captcha.core',
13    'quintagroup.pfg.captcha',
14]
15REQUIREMENTS = ['PloneFormGen', ] + PACKAGES
16
17ptc.setupPloneSite()
18
19# !!! Not initialized factory methods for the content types
20# !!! (for Plone-4+) if located in NotInstalled.setUp
21# !!! method of the layer class.
22ztc.installProduct('PloneFormGen')
23
24
25class 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
37    @classmethod
38    def tearDown(cls):
39        ptc_setup.cleanupPloneSite(ptc_setup.portal_name)
40
41
42class 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)
54        qi.installProduct("quintagroup.pfg.captcha")
55        transaction.commit()
56
57    @classmethod
58    def tearDown(cls):
59        ptc_setup._placefulTearDown()
60
61
62class TestCase(ptc.PloneTestCase):
63    layer = Installed
64
65
66class TestCaseNotInstalled(ptc.PloneTestCase):
67    layer = NotInstalled
Note: See TracBrowser for help on using the repository browser.