[756] | 1 | import unittest |
---|
[865] | 2 | |
---|
| 3 | from plone.browserlayer.utils import registered_layers |
---|
| 4 | |
---|
[756] | 5 | from Products.CMFCore.utils import getToolByName |
---|
| 6 | |
---|
| 7 | from quintagroup.plonetabs.tests.base import PloneTabsTestCase |
---|
| 8 | |
---|
[3437] | 9 | |
---|
[756] | 10 | class TestSetup(PloneTabsTestCase): |
---|
[3437] | 11 | |
---|
[756] | 12 | def afterSetUp(self): |
---|
[865] | 13 | self.loginAsPortalOwner() |
---|
[3437] | 14 | |
---|
[756] | 15 | def test_actionIcons(self): |
---|
| 16 | tool = getToolByName(self.portal, 'portal_actionicons') |
---|
| 17 | icon_ids = [i._action_id for i in tool.listActionIcons()] |
---|
[3608] | 18 | self.failUnless('plonetabs' in icon_ids, 'There is no plonetabs action' |
---|
| 19 | 'icon in actionicons tool.') |
---|
[3437] | 20 | |
---|
[756] | 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, |
---|
[3608] | 25 | 'There is no plonetabs action in control panel.') |
---|
[3437] | 26 | |
---|
[756] | 27 | def test_cssRegistry(self): |
---|
| 28 | tool = getToolByName(self.portal, 'portal_css') |
---|
| 29 | css = tool.getResource('++resource++plonetabs.css') |
---|
[3608] | 30 | self.failIf(css is None, 'There is no ++resource++plonetabs.css ' |
---|
| 31 | 'stylesheets registered.') |
---|
[3437] | 32 | |
---|
[756] | 33 | def test_jsRegistry(self): |
---|
| 34 | tool = getToolByName(self.portal, 'portal_javascripts') |
---|
[3437] | 35 | |
---|
[756] | 36 | prototype = tool.getResource('++resource++prototype.js') |
---|
| 37 | self.failIf(prototype is None, |
---|
[3608] | 38 | 'There is no ++resource++prototype.js script registered.') |
---|
[756] | 39 | self.failUnless(prototype._data['enabled'], |
---|
[3608] | 40 | '++resource++prototype.js script is disabled.') |
---|
[3437] | 41 | |
---|
[756] | 42 | effects = tool.getResource('++resource++pt_effects.js') |
---|
| 43 | self.failIf(effects is None, |
---|
[3608] | 44 | 'There is no ++resource++pt_effects.js script registered.') |
---|
[3437] | 45 | |
---|
[756] | 46 | dad = tool.getResource('++resource++sa_dragdrop.js') |
---|
[3608] | 47 | self.failIf(dad is None, 'There is no ++resource++sa_dragdrop.js ' |
---|
| 48 | 'script registered.') |
---|
[756] | 49 | |
---|
| 50 | def test_propertiesTool(self): |
---|
| 51 | tool = getToolByName(self.portal, 'portal_properties') |
---|
[3608] | 52 | self.failUnless(hasattr(tool, 'tabs_properties'), 'There is no ' |
---|
| 53 | 'tabs_properties sheet in portal properties tool.') |
---|
[756] | 54 | titles = tool.tabs_properties.getProperty('titles', None) |
---|
| 55 | self.assertEquals(titles, |
---|
[3608] | 56 | ('portal_tabs|Portal Tabs Configuration', |
---|
| 57 | 'portal_footer|Portal Footer Configuration'), |
---|
| 58 | 'Site properties was not setup properly' |
---|
| 59 | ) |
---|
[3437] | 60 | |
---|
[865] | 61 | def test_browserLayerRegistered(self): |
---|
| 62 | layers = [o.__name__ for o in registered_layers()] |
---|
[3608] | 63 | self.failUnless('IPloneTabsProductLayer' in layers, 'There should be ' |
---|
| 64 | 'quintagroup.ploentabs browser layer registered.') |
---|
[756] | 65 | |
---|
[3437] | 66 | |
---|
[756] | 67 | def test_suite(): |
---|
| 68 | suite = unittest.TestSuite() |
---|
| 69 | suite.addTest(unittest.makeSuite(TestSetup)) |
---|
| 70 | return suite |
---|