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, 13 years ago

pep8, pyflakes fixes

  • Property svn:eol-style set to native
File size: 1.8 KB
RevLine 
[2732]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
[2734]8from Products.PloneTestCase import setup as ptc_setup
[2732]9from Products.PloneTestCase import PloneTestCase as ptc
10
11PACKAGES = [
12    'quintagroup.captcha.core',
13    'quintagroup.pfg.captcha',
14]
[3168]15REQUIREMENTS = ['PloneFormGen', ] + PACKAGES
[2732]16
17ptc.setupPloneSite()
18
[2853]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
[3168]24
[2732]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
[2734]37    @classmethod
38    def tearDown(cls):
39        ptc_setup.cleanupPloneSite(ptc_setup.portal_name)
[2732]40
[2734]41
[2732]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)
[2734]54        qi.installProduct("quintagroup.pfg.captcha")
[2732]55        transaction.commit()
56
57    @classmethod
58    def tearDown(cls):
59        ptc_setup._placefulTearDown()
60
[3168]61
[2732]62class TestCase(ptc.PloneTestCase):
63    layer = Installed
64
[2734]65
[2732]66class TestCaseNotInstalled(ptc.PloneTestCase):
67    layer = NotInstalled
Note: See TracBrowser for help on using the repository browser.