source: products/quintagroup.dropdownmenu/trunk/quintagroup/dropdownmenu/tests/base.py @ 3151

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

pep8 fixes

  • Property svn:eol-style set to native
File size: 2.5 KB
Line 
1from zope.interface import alsoProvides
2
3from AccessControl import getSecurityManager
4from AccessControl.SecurityManagement import setSecurityManager
5
6from Testing import ZopeTestCase as ztc
7from Products.Five import fiveconfigure
8from Products.PloneTestCase import PloneTestCase as ptc
9
10from collective.testcaselayer.ptc import BasePTCLayer, ptc_layer
11
12from Products.CMFCore.utils import getToolByName
13
14from quintagroup.dropdownmenu import PROJECT_NAME
15from quintagroup.dropdownmenu.interfaces import IDropDownMenuLayer
16
17IPREFIX = 'quintagroup.dropdownmenu.interfaces.IDropDownMenuSettings.'
18
19# This step made in collective.testcaselayer.ptc
20#ptc.setupPloneSite()
21
22
23class NotInstalled(BasePTCLayer):
24    """Initialize the package, without installation into portal
25    """
26    def afterSetUp(self):
27        fiveconfigure.debug_mode = True
28        import quintagroup.dropdownmenu
29        self.loadZCML('configure.zcml', package=quintagroup.dropdownmenu)
30        fiveconfigure.debug_mode = False
31        ztc.installPackage(PROJECT_NAME)
32
33
34class Installed(BasePTCLayer):
35    """ Install product into the portal
36    """
37    def afterSetUp(self):
38        self.addProduct(PROJECT_NAME)
39
40
41class UnInstalled(BasePTCLayer):
42    """ UnInstall product from the portal
43    """
44    def afterSetUp(self):
45        sm = getSecurityManager()
46        self.loginAsPortalOwner()
47        try:
48            qi = self.portal.portal_quickinstaller
49            qi.uninstallProducts(products=[PROJECT_NAME, ])
50            #self._refreshSkinData()
51        finally:
52            setSecurityManager(sm)
53
54NotInstalledLayer = NotInstalled([ptc_layer, ])
55InstalledLayer = Installed([NotInstalledLayer, ])
56UnInstalledLayer = UnInstalled([InstalledLayer, ])
57
58
59class TestCaseNotInstalled(ptc.PloneTestCase):
60    layer = NotInstalledLayer
61
62
63class TestCase(ptc.PloneTestCase):
64    layer = InstalledLayer
65
66    def afterSetUp(self):
67        # mark request with our browser layer
68        super(TestCase, self).afterSetUp()
69        alsoProvides(self.app.REQUEST, IDropDownMenuLayer)
70
71
72class TestCaseUnInstalled(ptc.PloneTestCase):
73    layer = UnInstalledLayer
74
75
76class FunctionalTestCaseNotInstalled(ptc.FunctionalTestCase):
77    layer = NotInstalledLayer
78
79
80class FunctionalTestCase(ptc.FunctionalTestCase):
81    layer = InstalledLayer
82
83    def afterSetUp(self):
84        # mark request with our browser layer
85        super(FunctionalTestCase, self).afterSetUp()
86        alsoProvides(self.app.REQUEST, IDropDownMenuLayer)
87
88
89class FunctionalTestCaseUnInstalled(ptc.FunctionalTestCase):
90    layer = UnInstalledLayer
Note: See TracBrowser for help on using the repository browser.