Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes
plone.app.viewletmanager.tests.test_exportimport.importViewletSettingsStorageTests Class Reference
Inheritance diagram for plone.app.viewletmanager.tests.test_exportimport.importViewletSettingsStorageTests:
Inheritance graph
[legend]
Collaboration diagram for plone.app.viewletmanager.tests.test_exportimport.importViewletSettingsStorageTests:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_empty_default_purge
def test_empty_explicit_purge
def test_empty_skip_purge
def test_specific_child_purge
def test_normal
def test_fragment_skip_purge
def test_fragment3_skip_purge
def test_fragment4_remove
def test_fragment5_based_on
def test_fragment6_make_default
def test_syntax_error_reporting
def setUp

Public Attributes

 site
 storage

Static Public Attributes

 layer = Layer

Static Private Attributes

 _VIEWLETS_XML = _VIEWLETS_XML
 _EMPTY_EXPORT = _EMPTY_EXPORT
 _CHILD_PURGE_IMPORT = _CHILD_PURGE_IMPORT
 _FRAGMENT1_IMPORT = _FRAGMENT1_IMPORT
 _FRAGMENT2_IMPORT = _FRAGMENT2_IMPORT
 _FRAGMENT3_IMPORT = _FRAGMENT3_IMPORT
 _FRAGMENT4_IMPORT = _FRAGMENT4_IMPORT
 _FRAGMENT5_IMPORT = _FRAGMENT5_IMPORT
 _FRAGMENT6_IMPORT = _FRAGMENT6_IMPORT

Detailed Description

Definition at line 237 of file test_exportimport.py.


Member Function Documentation

Definition at line 179 of file test_exportimport.py.

00179 
00180     def setUp(self):
00181         BaseRegistryTests.setUp(self)
00182         setHooks()
00183         self.root.site = Folder(id='site')
00184         self.site = self.root.site
00185         gen = PloneGenerator()
00186         gen.enableSite(self.site)
00187         setSite(self.site)
00188         sm = getSiteManager(self.site)
00189         sm.registerUtility(ViewletSettingsStorage(), IViewletSettingsStorage)
00190         self.storage = getUtility(IViewletSettingsStorage)

Definition at line 249 of file test_exportimport.py.

00249 
00250     def test_empty_default_purge(self):
00251         from plone.app.viewletmanager.exportimport.storage import \
00252                                                 importViewletSettingsStorage
00253 
00254         _ORDER = COMMON_SETUP_ORDER
00255         _HIDDEN = COMMON_SETUP_HIDDEN
00256         self._populateSite(order=_ORDER, hidden=_HIDDEN)
00257 
00258         site = self.site
00259         utility = self.storage
00260 
00261         self.assertEqual(len(utility.getOrder('top', 'fancy')), 3)
00262         self.assertEqual(len(utility.getOrder('top', 'basic')), 1)
00263         self.assertEqual(len(utility.getHidden('top', 'light')), 1)
00264         self.assertEqual(len(utility.getOrder('top', 'undefined')), 3)
00265 
00266         context = DummyImportContext(site)
00267         context._files['viewlets.xml'] = self._EMPTY_EXPORT
00268         importViewletSettingsStorage(context)
00269 
00270         self.assertEqual(len(utility.getOrder('top', 'fancy')), 0)
00271         self.assertEqual(len(utility.getOrder('top', 'basic')), 0)
00272         self.assertEqual(len(utility.getHidden('top', 'light')), 0)
00273         self.assertEqual(len(utility.getOrder('top', 'undefined')), 0)

Here is the call graph for this function:

Definition at line 274 of file test_exportimport.py.

00274 
00275     def test_empty_explicit_purge(self):
00276         from plone.app.viewletmanager.exportimport.storage import \
00277                                                 importViewletSettingsStorage
00278 
00279         _ORDER = COMMON_SETUP_ORDER
00280         _HIDDEN = COMMON_SETUP_HIDDEN
00281         self._populateSite(order=_ORDER, hidden=_HIDDEN)
00282 
00283         site = self.site
00284         utility = self.storage
00285 
00286         self.assertEqual(len(utility.getOrder('top', 'fancy')), 3)
00287         self.assertEqual(len(utility.getOrder('top', 'basic')), 1)
00288         self.assertEqual(len(utility.getHidden('top', 'light')), 1)
00289         self.assertEqual(len(utility.getOrder('top', 'undefined')), 3)
00290 
00291         context = DummyImportContext(site, True)
00292         context._files['viewlets.xml'] = self._EMPTY_EXPORT
00293         importViewletSettingsStorage(context)
00294 
00295         self.assertEqual(len(utility.getOrder('top', 'fancy')), 0)
00296         self.assertEqual(len(utility.getOrder('top', 'basic')), 0)
00297         self.assertEqual(len(utility.getHidden('top', 'light')), 0)
00298         self.assertEqual(len(utility.getOrder('top', 'undefined')), 0)

Here is the call graph for this function:

Definition at line 299 of file test_exportimport.py.

00299 
00300     def test_empty_skip_purge(self):
00301         from plone.app.viewletmanager.exportimport.storage import \
00302                                                 importViewletSettingsStorage
00303 
00304         _ORDER = COMMON_SETUP_ORDER
00305         _HIDDEN = COMMON_SETUP_HIDDEN
00306         self._populateSite(order=_ORDER, hidden=_HIDDEN)
00307 
00308         site = self.site
00309         utility = self.storage
00310 
00311         self.assertEqual(len(utility.getOrder('top', 'fancy')), 3)
00312         self.assertEqual(len(utility.getOrder('top', 'basic')), 1)
00313         self.assertEqual(len(utility.getHidden('top', 'light')), 1)
00314         self.assertEqual(len(utility.getOrder('top', 'undefined')), 3)
00315 
00316         context = DummyImportContext(site, False)
00317         context._files['viewlets.xml'] = self._EMPTY_EXPORT
00318         importViewletSettingsStorage(context)
00319 
00320         self.assertEqual(len(utility.getOrder('top', 'fancy')), 3)
00321         self.assertEqual(len(utility.getOrder('top', 'basic')), 1)
00322         self.assertEqual(len(utility.getHidden('top', 'light')), 1)
00323         self.assertEqual(len(utility.getOrder('top', 'undefined')), 3)

Here is the call graph for this function:

Definition at line 416 of file test_exportimport.py.

00416 
00417     def test_fragment3_skip_purge(self):
00418         from plone.app.viewletmanager.exportimport.storage import \
00419                                                 importViewletSettingsStorage
00420 
00421         _ORDER = COMMON_SETUP_ORDER
00422         _HIDDEN = COMMON_SETUP_HIDDEN
00423         self._populateSite(order=_ORDER, hidden=_HIDDEN)
00424 
00425         site = self.site
00426         utility = self.storage
00427         self.assertEqual(len(utility._order.keys()), 2)
00428         self.assertEqual(len(utility._hidden.keys()), 1)
00429 
00430         self.assertEqual(utility.getOrder('top', 'fancy'),
00431                                     ('two', 'three', 'one'))
00432         self.assertEqual(utility.getOrder('top', 'undefined (fallback)'),
00433                                     ('two', 'three', 'one'))
00434         self.assertEqual(utility.getOrder('top', 'basic'), ('one',))
00435         self.assertEqual(utility.getHidden('top', 'light'), ('two',))
00436 
00437         context = DummyImportContext(site, False)
00438         context._files['viewlets.xml'] = self._FRAGMENT3_IMPORT
00439         importViewletSettingsStorage(context)
00440 
00441         self.assertEqual(utility.getOrder('top', 'basic'),
00442                                                 ('three', 'one', 'four'))
00443         self.assertEqual(utility.getOrder('top', 'fancy'),
00444                                             ('three', 'two', 'one', 'four'))
00445         self.assertEqual(utility.getHidden('top', 'light'), ('two',))

Here is the call graph for this function:

Definition at line 446 of file test_exportimport.py.

00446 
00447     def test_fragment4_remove(self):
00448         from plone.app.viewletmanager.exportimport.storage import \
00449                                                 importViewletSettingsStorage
00450 
00451         _ORDER = COMMON_SETUP_ORDER
00452         _HIDDEN = COMMON_SETUP_HIDDEN
00453         self._populateSite(order=_ORDER, hidden=_HIDDEN)
00454 
00455         site = self.site
00456         utility = self.storage
00457         self.assertEqual(len(utility._order.keys()), 2)
00458         self.assertEqual(len(utility._hidden.keys()), 1)
00459 
00460         self.assertEqual(utility.getOrder('top', 'fancy'),
00461                                     ('two', 'three', 'one'))
00462         self.assertEqual(utility.getOrder('top', 'undefined (fallback)'),
00463                                     ('two', 'three', 'one'))
00464         self.assertEqual(utility.getOrder('top', 'basic'), ('one',))
00465         self.assertEqual(utility.getHidden('top', 'light'), ('two',))
00466 
00467         context = DummyImportContext(site, False)
00468         context._files['viewlets.xml'] = self._FRAGMENT4_IMPORT
00469         importViewletSettingsStorage(context)
00470 
00471         self.assertEqual(utility.getOrder('top', 'basic'), ('one',))
00472         self.assertEqual(utility.getOrder('top', 'fancy'), ('two', 'one'))
00473         self.assertEqual(utility.getHidden('top', 'light'), ('two',))

Here is the call graph for this function:

Definition at line 474 of file test_exportimport.py.

00474 
00475     def test_fragment5_based_on(self):
00476         from plone.app.viewletmanager.exportimport.storage import \
00477                                                 importViewletSettingsStorage
00478 
00479         _ORDER = COMMON_SETUP_ORDER
00480         _HIDDEN = COMMON_SETUP_HIDDEN
00481         self._populateSite(order=_ORDER, hidden=_HIDDEN)
00482 
00483         site = self.site
00484         utility = self.storage
00485         self.assertEqual(len(utility._order.keys()), 2)
00486         self.assertEqual(len(utility._hidden.keys()), 1)
00487 
00488         self.assertEqual(utility.getOrder('top', 'fancy'),
00489                                     ('two', 'three', 'one'))
00490         self.assertEqual(utility.getOrder('top', 'undefined (fallback)'),
00491                                     ('two', 'three', 'one'))
00492         self.assertEqual(utility.getOrder('top', 'basic'), ('one',))
00493         self.assertEqual(utility.getHidden('top', 'light'), ('two',))
00494 
00495         context = DummyImportContext(site, False)
00496         context._files['viewlets.xml'] = self._FRAGMENT5_IMPORT
00497         importViewletSettingsStorage(context)
00498 
00499         self.assertEqual(len(utility._order.keys()), 5)
00500 
00501         self.assertEqual(utility.getOrder('top', 'fancy'),
00502                                     ('two', 'three', 'one'))
00503         self.assertEqual(utility.getOrder('top', 'existing'),
00504                                     ('two', 'three', 'one'))
00505         self.assertEqual(utility.getOrder('top', 'new'),
00506                                     ('three', 'two', 'one'))
00507         self.assertEqual(utility.getOrder('top', 'wrongbase'), ('two',))
00508         self.assertEqual(utility.getOrder('top', 'undefined (fallback)'),
00509                                     ('two', 'three', 'one'))
00510         self.assertEqual(utility.getOrder('top', 'basic'), ('one',))
00511         self.assertEqual(utility.getHidden('top', 'light'), ('two',))

Here is the call graph for this function:

Definition at line 512 of file test_exportimport.py.

00512 
00513     def test_fragment6_make_default(self):
00514         from plone.app.viewletmanager.exportimport.storage import \
00515                                                 importViewletSettingsStorage
00516 
00517         _ORDER = COMMON_SETUP_ORDER
00518         _HIDDEN = COMMON_SETUP_HIDDEN
00519         self._populateSite(order=_ORDER, hidden=_HIDDEN)
00520 
00521         site = self.site
00522         utility = self.storage
00523         self.assertEqual(len(utility._order.keys()), 2)
00524         self.assertEqual(len(utility._hidden.keys()), 1)
00525 
00526         self.assertEqual(utility.getOrder('top', 'fancy'),
00527                                     ('two', 'three', 'one'))
00528         self.assertEqual(utility.getOrder('top', 'undefined (fallback)'),
00529                                     ('two', 'three', 'one'))
00530         self.assertEqual(utility.getOrder('top', 'basic'), ('one',))
00531         self.assertEqual(utility.getHidden('top', 'light'), ('two',))
00532 
00533         context = DummyImportContext(site, False)
00534         context._files['viewlets.xml'] = self._FRAGMENT6_IMPORT
00535         importViewletSettingsStorage(context)
00536 
00537         self.assertEqual(utility.getOrder('top', 'undefined'),
00538                                         ('one', 'two', 'three'))
00539         self.assertEqual(utility.getHidden('top', 'undefined'), ('two',))
        

Here is the call graph for this function:

Definition at line 369 of file test_exportimport.py.

00369 
00370     def test_fragment_skip_purge(self):
00371         from plone.app.viewletmanager.exportimport.storage import \
00372                                                 importViewletSettingsStorage
00373 
00374         _ORDER = COMMON_SETUP_ORDER
00375         _HIDDEN = COMMON_SETUP_HIDDEN
00376         self._populateSite(order=_ORDER, hidden=_HIDDEN)
00377 
00378         site = self.site
00379         utility = self.storage
00380         self.assertEqual(len(utility._order.keys()), 2)
00381         self.assertEqual(len(utility._hidden.keys()), 1)
00382 
00383         self.assertEqual(utility.getOrder('top', 'fancy'),
00384                                     ('two', 'three', 'one'))
00385         self.assertEqual(utility.getOrder('top', 'undefined (fallback)'),
00386                                     ('two', 'three', 'one'))
00387         self.assertEqual(utility.getOrder('top', 'basic'), ('one',))
00388         self.assertEqual(utility.getHidden('top', 'light'), ('two',))
00389 
00390         context = DummyImportContext(site, False)
00391         context._files['viewlets.xml'] = self._FRAGMENT1_IMPORT
00392         importViewletSettingsStorage(context)
00393 
00394         self.assertEqual(utility.getOrder('top', 'basic'), ('one',))
00395         self.assertEqual(utility.getOrder('top', 'fancy'),
00396                                             ('three', 'two', 'one'))
00397         self.assertEqual(utility.getHidden('top', 'light'), ('two',))
00398 
00399         context._files['viewlets.xml'] = self._FRAGMENT2_IMPORT
00400         importViewletSettingsStorage(context)
00401 
00402         self.assertEqual(len(utility._order.keys()), 2)
00403         self.assertEqual(len(utility._hidden.keys()), 1)
00404 
00405         self.assertEqual(utility.getOrder('top', 'fancy'),
00406                                     ('three', 'four', 'two', 'one'))
00407         self.assertEqual(utility.getOrder('top', 'basic'),
00408                                             ('one', 'four'))
00409         self.assertEqual(utility.getHidden('top', 'light'), ('two',))
00410 
00411         context._files['viewlets.xml'] = self._FRAGMENT1_IMPORT
00412         importViewletSettingsStorage(context)
00413 
00414         self.assertEqual(utility.getOrder('top', 'fancy'),
00415                                     ('four', 'three', 'two', 'one'))

Here is the call graph for this function:

Definition at line 349 of file test_exportimport.py.

00349 
00350     def test_normal(self):
00351         from plone.app.viewletmanager.exportimport.storage import \
00352                                                 importViewletSettingsStorage
00353 
00354         site = self.site
00355         utility = self.storage
00356         self.assertEqual(len(utility._order.keys()), 0)
00357         self.assertEqual(len(utility._hidden.keys()), 0)
00358 
00359         context = DummyImportContext(site, False)
00360         context._files['viewlets.xml'] = self._VIEWLETS_XML
00361         importViewletSettingsStorage(context)
00362 
00363         self.assertEqual(utility.getOrder('top', 'fancy'),
00364                                             ('two', 'three', 'one'))
00365         self.assertEqual(utility.getOrder('top', 'undefined (fallback)'),
00366                                             ('two', 'three', 'one'))
00367         self.assertEqual(utility.getOrder('top', 'basic'), ('one',))
00368         self.assertEqual(utility.getHidden('top', 'light'), ('two',))

Here is the call graph for this function:

Definition at line 324 of file test_exportimport.py.

00324 
00325     def test_specific_child_purge(self):
00326         from plone.app.viewletmanager.exportimport.storage import \
00327                                                 importViewletSettingsStorage
00328 
00329         _ORDER = COMMON_SETUP_ORDER
00330         _HIDDEN = COMMON_SETUP_HIDDEN
00331         self._populateSite(order=_ORDER, hidden=_HIDDEN)
00332 
00333         site = self.site
00334         utility = self.storage
00335 
00336         self.assertEqual(len(utility.getOrder('top', 'fancy')), 3)
00337         self.assertEqual(len(utility.getOrder('top', 'basic')), 1)
00338         self.assertEqual(len(utility.getHidden('top', 'light')), 1)
00339         self.assertEqual(len(utility.getOrder('top', 'undefined')), 3)
00340 
00341         context = DummyImportContext(site, False)
00342         context._files['viewlets.xml'] = self._CHILD_PURGE_IMPORT
00343         importViewletSettingsStorage(context)
00344 
00345         self.assertEqual(len(utility.getOrder('top', 'fancy')), 0)
00346         self.assertEqual(len(utility.getOrder('top', 'basic')), 1)
00347         self.assertEqual(len(utility.getHidden('top', 'light')), 0)
00348         self.assertEqual(len(utility.getOrder('top', 'undefined')), 0)

Here is the call graph for this function:

Definition at line 540 of file test_exportimport.py.

00540 
00541     def test_syntax_error_reporting(self):
00542         from plone.app.viewletmanager.exportimport.storage import \
00543                                                 importViewletSettingsStorage
00544         from xml.parsers.expat import ExpatError
00545         site = self.site
00546         context = DummyImportContext(site, False)
00547         context._files['viewlets.xml'] = """<?xml version="1.0"?>\n<"""
00548         self.assertRaises(ExpatError, importViewletSettingsStorage, context)


Member Data Documentation

Definition at line 241 of file test_exportimport.py.

Definition at line 240 of file test_exportimport.py.

Definition at line 242 of file test_exportimport.py.

Definition at line 243 of file test_exportimport.py.

Definition at line 244 of file test_exportimport.py.

Definition at line 245 of file test_exportimport.py.

Definition at line 246 of file test_exportimport.py.

Definition at line 247 of file test_exportimport.py.

Definition at line 239 of file test_exportimport.py.

Definition at line 177 of file test_exportimport.py.

Definition at line 183 of file test_exportimport.py.

Definition at line 189 of file test_exportimport.py.


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