source: products/quintagroup.pfg.captcha/branches/migration/quintagroup/pfg/captcha/tests/base.py @ 2732

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

#222: Splited tests.py module into 2 layers with notinstalled and installed quintagroup.pfg.captcha packages

  • 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
9from Products.PloneTestCase.layer import onsetup
10
11from Products.PloneTestCase.layer import PloneSite
12from Products.PloneTestCase import PloneTestCase as ptc
13from Products.PloneTestCase import setup as ptc_setup
14
15from Products.PloneTestCase.PloneTestCase import portal_owner
16from Products.PloneTestCase.PloneTestCase import default_password
17
18PACKAGES = [
19    'quintagroup.captcha.core',
20    'quintagroup.pfg.captcha',
21]
22PROFILES = [p+':default' for p in PACKAGES]
23REQUIREMENTS = ['PloneFormGen',] + PACKAGES
24
25ptc.setupPloneSite()
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.installProduct('PloneFormGen')
37        ztc.installPackage('quintagroup.pfg.captcha')
38        ztc.installPackage('quintagroup.captcha.core')
39
40
41class Installed(NotInstalled):
42    """ Install product into the portal
43    """
44    @classmethod
45    def setUp(cls):
46        app = ztc.app()
47        portal = app[ptc_setup.portal_name]
48
49        # Sets the local site/manager
50        ptc_setup._placefulSetUp(portal)
51        # Install PROJECT
52        qi = getattr(portal, 'portal_quickinstaller', None)
53        for p in REQUIREMENTS:
54            qi.installProduct(p)
55        transaction.commit()
56
57    @classmethod
58    def tearDown(cls):
59        ptc_setup._placefulTearDown()
60       
61
62class TestCase(ptc.PloneTestCase):
63    layer = Installed
64
65class TestCaseNotInstalled(ptc.PloneTestCase):
66    layer = NotInstalled
Note: See TracBrowser for help on using the repository browser.