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