Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
CMFCore.exportimport.tests.test_skins.importSkinsToolTests Class Reference
Inheritance diagram for CMFCore.exportimport.tests.test_skins.importSkinsToolTests:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.exportimport.tests.test_skins.importSkinsToolTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_remove_skin_path
def test_empty_default_purge
def test_empty_explicit_purge
def test_empty_skip_purge
def test_normal
def test_fragment_skip_purge
def test_fragment3_skip_purge
def test_fragment4_removal
def test_fragment5_based_skin
def setUp
def tearDown

Static Public Attributes

 layer = ExportImportZCMLLayer

Static Private Attributes

 _EMPTY_EXPORT = _EMPTY_EXPORT
 _FRAGMENT1_IMPORT = _FRAGMENT1_IMPORT
 _FRAGMENT2_IMPORT = _FRAGMENT2_IMPORT
 _FRAGMENT3_IMPORT = _FRAGMENT3_IMPORT
 _FRAGMENT4_IMPORT = _FRAGMENT4_IMPORT
 _FRAGMENT5_IMPORT = _FRAGMENT5_IMPORT
 _FRAGMENT6_IMPORT = _FRAGMENT6_IMPORT
 _NORMAL_EXPORT = _NORMAL_EXPORT

Detailed Description

Definition at line 352 of file test_skins.py.


Member Function Documentation

Reimplemented from CMFCore.exportimport.tests.test_skins._DVRegistrySetup.

Definition at line 303 of file test_skins.py.

00303 
00304     def setUp(self):
00305         BaseRegistryTests.setUp(self)
00306         _DVRegistrySetup.setUp(self)

Reimplemented from CMFCore.exportimport.tests.test_skins._DVRegistrySetup.

Definition at line 307 of file test_skins.py.

00307 
00308     def tearDown(self):
00309         _DVRegistrySetup.tearDown(self)
00310         BaseRegistryTests.tearDown(self)
00311 

Definition at line 383 of file test_skins.py.

00383 
00384     def test_empty_default_purge(self):
00385         from Products.CMFCore.exportimport.skins import importSkinsTool
00386 
00387         _IDS = ('one', 'two', 'three')
00388         _PATHS = {'basic': 'one', 'fancy': 'three, two, one'}
00389 
00390         site = self._initSite(selections=_PATHS, ids=_IDS)
00391         skins_tool = site.portal_skins
00392 
00393         self.failIf(site._skin_setup_called)
00394         self.assertEqual(len(skins_tool.getSkinPaths()), 2)
00395         self.assertEqual(len(skins_tool.objectItems()), 3)
00396 
00397         context = DummyImportContext(site)
00398         context._files['skins.xml'] = self._EMPTY_EXPORT
00399         importSkinsTool(context)
00400 
00401         self.assertEqual(skins_tool.default_skin, "default_skin")
00402         self.assertEqual(skins_tool.request_varname, "request_varname")
00403         self.failIf(skins_tool.allow_any)
00404         self.failIf(skins_tool.cookie_persistence)
00405         self.failUnless(site._skin_setup_called)
00406         self.assertEqual(len(skins_tool.getSkinPaths()), 0)
00407         self.assertEqual(len(skins_tool.objectItems()), 0)

Here is the call graph for this function:

Definition at line 408 of file test_skins.py.

00408 
00409     def test_empty_explicit_purge(self):
00410         from Products.CMFCore.exportimport.skins import importSkinsTool
00411 
00412         _IDS = ('one', 'two', 'three')
00413         _PATHS = {'basic': 'one', 'fancy': 'three, two, one'}
00414 
00415         site = self._initSite(selections=_PATHS, ids=_IDS)
00416         skins_tool = site.portal_skins
00417 
00418         self.failIf(site._skin_setup_called)
00419         self.assertEqual(len(skins_tool.getSkinPaths()), 2)
00420         self.assertEqual(len(skins_tool.objectItems()), 3)
00421 
00422         context = DummyImportContext(site, True)
00423         context._files['skins.xml'] = self._EMPTY_EXPORT
00424         importSkinsTool(context)
00425 
00426         self.assertEqual(skins_tool.default_skin, "default_skin")
00427         self.assertEqual(skins_tool.request_varname, "request_varname")
00428         self.failIf(skins_tool.allow_any)
00429         self.failIf(skins_tool.cookie_persistence)
00430         self.failUnless(site._skin_setup_called)
00431         self.assertEqual(len(skins_tool.getSkinPaths()), 0)
00432         self.assertEqual(len(skins_tool.objectItems()), 0)

Here is the call graph for this function:

Definition at line 433 of file test_skins.py.

00433 
00434     def test_empty_skip_purge(self):
00435         from Products.CMFCore.exportimport.skins import importSkinsTool
00436 
00437         _IDS = ('one', 'two', 'three')
00438         _PATHS = {'basic': 'one', 'fancy': 'three, two, one'}
00439 
00440         site = self._initSite(selections=_PATHS, ids=_IDS)
00441         skins_tool = site.portal_skins
00442 
00443         self.failIf(site._skin_setup_called)
00444         self.assertEqual(len(skins_tool.getSkinPaths()), 2)
00445         self.assertEqual(len(skins_tool.objectItems()), 3)
00446 
00447         context = DummyImportContext(site, False)
00448         context._files['skins.xml'] = self._EMPTY_EXPORT
00449         importSkinsTool(context)
00450 
00451         self.assertEqual(skins_tool.default_skin, "default_skin")
00452         self.assertEqual(skins_tool.request_varname, "request_varname")
00453         self.failIf(skins_tool.allow_any)
00454         self.failIf(skins_tool.cookie_persistence)
00455         self.failUnless(site._skin_setup_called)
00456         self.assertEqual(len(skins_tool.getSkinPaths()), 2)
00457         self.assertEqual(len(skins_tool.objectItems()), 3)

Here is the call graph for this function:

Definition at line 525 of file test_skins.py.

00525 
00526     def test_fragment3_skip_purge(self):
00527         from Products.CMFCore.exportimport.skins import importSkinsTool
00528 
00529         _IDS = ('one', 'two')
00530         _PATHS = {'basic': 'one', 'fancy': 'two,one'}
00531 
00532         site = self._initSite(selections=_PATHS, ids=_IDS)
00533         skins_tool = site.portal_skins
00534 
00535         self.failIf(site._skin_setup_called)
00536         skin_paths = skins_tool.getSkinPaths()
00537         self.assertEqual(len(skin_paths), 2)
00538         self.assertEqual(skin_paths[0], ('basic', 'one'))
00539         self.assertEqual(skin_paths[1], ('fancy', 'two,one'))
00540         self.assertEqual(len(skins_tool.objectItems()), 2)
00541 
00542         context = DummyImportContext(site, False)
00543         context._files['skins.xml'] = self._FRAGMENT3_IMPORT
00544         importSkinsTool(context)
00545 
00546         self.assertEqual(skins_tool.default_skin, "default_skin")
00547         self.assertEqual(skins_tool.request_varname, "request_varname")
00548         self.failIf(skins_tool.allow_any)
00549         self.failIf(skins_tool.cookie_persistence)
00550         self.failUnless(site._skin_setup_called)
00551         skin_paths = skins_tool.getSkinPaths()
00552         self.assertEqual(len(skin_paths), 2)
00553         self.assertEqual(skin_paths[0], ('basic', 'three,one,four'))
00554         self.assertEqual(skin_paths[1],
00555                           ('fancy', 'three,two,one,four'))
00556         self.assertEqual(len(skins_tool.objectItems()), 4)

Here is the call graph for this function:

Definition at line 557 of file test_skins.py.

00557 
00558     def test_fragment4_removal(self):
00559         from Products.CMFCore.exportimport.skins import importSkinsTool
00560 
00561         _IDS = ('one', 'two')
00562         _PATHS = {'basic': 'one', 'fancy': 'two,one'}
00563 
00564         site = self._initSite(selections=_PATHS, ids=_IDS)
00565         skins_tool = site.portal_skins
00566 
00567         skin_paths = skins_tool.getSkinPaths()
00568         self.assertEqual(len(skin_paths), 2)
00569         self.assertEqual(skin_paths[0], ('basic', 'one'))
00570         self.assertEqual(skin_paths[1], ('fancy', 'two,one'))
00571         self.assertEqual(len(skins_tool.objectItems()), 2)
00572 
00573         context = DummyImportContext(site, False)
00574         context._files['skins.xml'] = self._FRAGMENT3_IMPORT
00575         importSkinsTool(context)
00576 
00577         self.failUnless(site._skin_setup_called)
00578         skin_paths = skins_tool.getSkinPaths()
00579         self.assertEqual(len(skin_paths), 2)
00580         self.assertEqual(skin_paths[0], ('basic', 'three,one,four'))
00581         self.assertEqual(skin_paths[1], ('fancy', 'three,two,one,four'))
00582         self.assertEqual(len(skins_tool.objectItems()), 4)
00583 
00584         context = DummyImportContext(site, False)
00585         context._files['skins.xml'] = self._FRAGMENT4_IMPORT
00586 
00587         importSkinsTool(context)
00588 
00589         self.failUnless(site._skin_setup_called)
00590         skin_paths = skins_tool.getSkinPaths()
00591         self.assertEqual(len(skin_paths), 2)
00592         self.assertEqual(skin_paths[0], ('basic', 'one,four'))
00593         self.assertEqual(skin_paths[1], ('fancy', 'two,one,four'))
00594         self.assertEqual(len(skins_tool.objectItems()), 4)

Here is the call graph for this function:

Definition at line 595 of file test_skins.py.

00595 
00596     def test_fragment5_based_skin(self):
00597         from Products.CMFCore.exportimport.skins import importSkinsTool
00598 
00599         _IDS = ('one', 'two', 'three', 'four')
00600         _PATHS = {'basic': 'one,three,four', 'existing': 'one,two,four'}
00601 
00602         site = self._initSite(selections=_PATHS, ids=_IDS)
00603         skins_tool = site.portal_skins
00604 
00605         skin_paths = skins_tool.getSkinPaths()
00606         self.assertEqual(len(skin_paths), 2)
00607         self.assertEqual(skin_paths[0], ('basic', 'one,three,four'))
00608         self.assertEqual(skin_paths[1], ('existing', 'one,two,four'))
00609         self.assertEqual(len(skins_tool.objectItems()), 4)
00610 
00611         context = DummyImportContext(site, False)
00612         context._files['skins.xml'] = self._FRAGMENT5_IMPORT
00613 
00614         importSkinsTool(context)
00615 
00616         self.failUnless(site._skin_setup_called)
00617         skin_paths = skins_tool.getSkinPaths()
00618         self.assertEqual(len(skin_paths), 4)
00619         self.assertEqual(skin_paths[0], ('basic', 'one,three,four'))
00620         self.assertEqual(skin_paths[1], ('existing', 'one,two,three,four'))
00621         self.assertEqual(skin_paths[2], ('new', 'one,two,three,four'))
00622         self.assertEqual(skin_paths[3], ('wrongbase', 'two'))
00623         self.assertEqual(len(skins_tool.objectItems()), 4)
00624 

Here is the call graph for this function:

Definition at line 480 of file test_skins.py.

00480 
00481     def test_fragment_skip_purge(self):
00482         from Products.CMFCore.exportimport.skins import importSkinsTool
00483 
00484         _IDS = ('one', 'two')
00485         _PATHS = {'basic': 'one', 'fancy': 'two,one'}
00486 
00487         site = self._initSite(selections=_PATHS, ids=_IDS)
00488         skins_tool = site.portal_skins
00489 
00490         self.failIf(site._skin_setup_called)
00491         skin_paths = skins_tool.getSkinPaths()
00492         self.assertEqual(len(skin_paths), 2)
00493         self.assertEqual(skin_paths[0], ('basic', 'one'))
00494         self.assertEqual(skin_paths[1], ('fancy', 'two,one'))
00495         self.assertEqual(len(skins_tool.objectItems()), 2)
00496 
00497         context = DummyImportContext(site, False)
00498         context._files['skins.xml'] = self._FRAGMENT1_IMPORT
00499         importSkinsTool(context)
00500 
00501         self.assertEqual(skins_tool.default_skin, "default_skin")
00502         self.assertEqual(skins_tool.request_varname, "request_varname")
00503         self.failIf(skins_tool.allow_any)
00504         self.failIf(skins_tool.cookie_persistence)
00505         self.failUnless(site._skin_setup_called)
00506         skin_paths = skins_tool.getSkinPaths()
00507         self.assertEqual(len(skin_paths), 2)
00508         self.assertEqual(skin_paths[0], ('basic', 'one,three'))
00509         self.assertEqual(skin_paths[1], ('fancy', 'three,two,one'))
00510         self.assertEqual(len(skins_tool.objectItems()), 3)
00511 
00512         context._files['skins.xml'] = self._FRAGMENT2_IMPORT
00513         importSkinsTool(context)
00514 
00515         self.assertEqual(skins_tool.default_skin, "default_skin")
00516         self.assertEqual(skins_tool.request_varname, "request_varname")
00517         self.failIf(skins_tool.allow_any)
00518         self.failIf(skins_tool.cookie_persistence)
00519         self.failUnless(site._skin_setup_called)
00520         skin_paths = skins_tool.getSkinPaths()
00521         self.assertEqual(len(skin_paths), 2)
00522         self.assertEqual(skin_paths[0], ('basic', 'one,three,four'))
00523         self.assertEqual(skin_paths[1], ('fancy', 'three,four,two,one'))
00524         self.assertEqual(len(skins_tool.objectItems()), 4)

Here is the call graph for this function:

Definition at line 458 of file test_skins.py.

00458 
00459     def test_normal(self):
00460         from Products.CMFCore.exportimport.skins import importSkinsTool
00461 
00462         site = self._initSite()
00463         skins_tool = site.portal_skins
00464 
00465         self.failIf(site._skin_setup_called)
00466         self.assertEqual(len(skins_tool.getSkinPaths()), 0)
00467         self.assertEqual(len(skins_tool.objectItems()), 0)
00468 
00469         context = DummyImportContext(site)
00470         context._files['skins.xml'] = self._NORMAL_EXPORT
00471         importSkinsTool(context)
00472 
00473         self.assertEqual(skins_tool.default_skin, "basic")
00474         self.assertEqual(skins_tool.request_varname, "skin_var")
00475         self.failUnless(skins_tool.allow_any)
00476         self.failUnless(skins_tool.cookie_persistence)
00477         self.failUnless(site._skin_setup_called)
00478         self.assertEqual(len(skins_tool.getSkinPaths()), 2)
00479         self.assertEqual(len(skins_tool.objectItems()), 3)

Here is the call graph for this function:

Definition at line 366 of file test_skins.py.

00366 
00367     def test_remove_skin_path(self):
00368         from Products.CMFCore.exportimport.skins import importSkinsTool
00369 
00370         _IDS = ('one', 'two', 'three')
00371         _PATHS = {'basic': 'one', 'fancy': 'three, two, one'}
00372 
00373         site = self._initSite(selections=_PATHS, ids=_IDS)
00374         skins_tool = site.portal_skins
00375         self.failUnless(skins_tool._getSelections().has_key('fancy'))
00376 
00377         context = DummyImportContext(site)
00378         context._files['skins.xml'] = self._FRAGMENT6_IMPORT
00379         importSkinsTool(context)
00380 
00381         self.failIf(skins_tool._getSelections().has_key('fancy'))
00382 

Here is the call graph for this function:


Member Data Documentation

Definition at line 356 of file test_skins.py.

Definition at line 357 of file test_skins.py.

Definition at line 358 of file test_skins.py.

Definition at line 359 of file test_skins.py.

Definition at line 360 of file test_skins.py.

Definition at line 361 of file test_skins.py.

Definition at line 362 of file test_skins.py.

Definition at line 363 of file test_skins.py.

Definition at line 354 of file test_skins.py.


The documentation for this class was generated from the following file: