source: products/quintagroup.plonetabs/trunk/quintagroup/plonetabs/tests/test_setup.py @ 3437

Last change on this file since 3437 was 3437, checked in by potar, 9 years ago

Merged tests branch

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