def test_add_invalid_path(self): tool = SkinsTool() # We start out with no wkin selections self.assertEquals(len(tool.getSkinSelections()), 0) # Add a skin selection with an invalid path element paths = 'foo, bar, .svn' tool.addSkinSelection('fooskin', paths) # Make sure the skin selection exists paths = tool.getSkinPath('fooskin') self.failIf(paths is None) # Test for the contents self.failIf(paths.find('foo') == -1) self.failIf(paths.find('bar') == -1) self.failUnless(paths.find('.svn') == -1)
def test_getCurrentSkinName(self): from Products.CMFCore.interfaces import ISkinsTool from Products.CMFCore.SkinsTool import SkinsTool som = self._makeOne() pathA = ('foo, bar') pathB = ('bar, foo') stool = SkinsTool() stool.addSkinSelection('skinA', pathA) stool.addSkinSelection('skinB', pathB) stool.manage_properties(default_skin='skinA') getSiteManager().registerUtility(stool, ISkinsTool) # Expect the default skin name to be returned self.assertTrue(som.getCurrentSkinName() == 'skinA') # after a changeSkin the new skin name should be returned som.changeSkin('skinB', som.REQUEST) self.assertTrue(som.getCurrentSkinName() == 'skinB')