source: products/quintagroup.plonetabs/branches/tests/quintagroup/plonetabs/tests/test_setup.py @ 3402

Last change on this file since 3402 was 3402, checked in by potar, 8 years ago

Fixing pep8

File size: 3.1 KB
Line 
1import unittest
2
3from zope.component import getSiteManager
4
5from plone.browserlayer.utils import registered_layers
6
7from Products.CMFCore.utils import getToolByName
8
9from quintagroup.plonetabs.tests.base import PloneTabsTestCase
10
11
12class TestSetup(PloneTabsTestCase):
13
14    def afterSetUp(self):
15        self.loginAsPortalOwner()
16
17    def test_actionIcons(self):
18        tool = getToolByName(self.portal, 'portal_actionicons')
19        icon_ids = [i._action_id for i in tool.listActionIcons()]
20        self.failUnless('plonetabs' in icon_ids,
21            'There is no plonetabs action icon in actionicons tool.')
22
23    def test_controlPanel(self):
24        tool = getToolByName(self.portal, 'portal_controlpanel')
25        action_ids = [a.id for a in tool.listActions()]
26        self.failUnless('plonetabs' in action_ids,
27            'There is no plonetabs action in control panel.')
28
29    def test_cssRegistry(self):
30        tool = getToolByName(self.portal, 'portal_css')
31        css = tool.getResource('++resource++plonetabs.css')
32        self.failIf(css is None,
33            'There is no ++resource++plonetabs.css stylesheets registered.')
34
35    def test_jsRegistry(self):
36        tool = getToolByName(self.portal, 'portal_javascripts')
37
38        prototype = tool.getResource('++resource++prototype.js')
39        self.failIf(prototype is None,
40            'There is no ++resource++prototype.js script registered.')
41        self.failUnless(prototype._data['enabled'],
42            '++resource++prototype.js script is disabled.')
43
44        effects = tool.getResource('++resource++pt_effects.js')
45        self.failIf(effects is None,
46            'There is no ++resource++pt_effects.js script registered.')
47
48        dad = tool.getResource('++resource++sa_dragdrop.js')
49        self.failIf(dad is None,
50            'There is no ++resource++sa_dragdrop.js script registered.')
51
52    def test_kssRegistry(self):
53        tool = getToolByName(self.portal, 'portal_kss')
54        kss = tool.getResource('++resource++plonetabs.kss')
55        self.failIf(kss is None,
56            'There is no ++resource++plonetabs.kss sheets registered.')
57        kss = tool.getResource('++resource++plonetabsmode.kss')
58        self.failIf(kss is None,
59            'There is no ++resource++plonetabsmode.kss sheets registered.')
60
61    def test_propertiesTool(self):
62        tool = getToolByName(self.portal, 'portal_properties')
63        self.failUnless(hasattr(tool, 'tabs_properties'),
64            'There is no tabs_properties sheet in portal properties tool.')
65        titles = tool.tabs_properties.getProperty('titles', None)
66        self.assertEquals(titles,
67            ('portal_tabs|Portal Tabs Configuration',
68             'portal_footer|Portal Footer Configuration'),
69            'Site properties was not setup properly'
70        )
71
72    def test_browserLayerRegistered(self):
73        sm = getSiteManager(self.portal)
74        layers = [o.__name__ for o in registered_layers()]
75        self.failUnless('IPloneTabsProductLayer' in layers,
76            'There should be quintagroup.ploentabs browser layer registered.')
77
78
79def test_suite():
80    suite = unittest.TestSuite()
81    suite.addTest(unittest.makeSuite(TestSetup))
82    return suite
Note: See TracBrowser for help on using the repository browser.