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

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

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