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

Last change on this file since 2853 was 2853, checked in by mylan, 14 years ago

#231: Fix problems with FormFolder? creation in tests for plone-4

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