Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
CMFCore.exportimport.tests.test_actions.importActionProvidersTests Class Reference
Inheritance diagram for CMFCore.exportimport.tests.test_actions.importActionProvidersTests:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.exportimport.tests.test_actions.importActionProvidersTests:
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_normal
def test_i18n
def test_insert_skip_purge
def test_remove_skip_purge

Static Public Attributes

 layer = ExportImportZCMLLayer

Detailed Description

Definition at line 413 of file test_actions.py.


Member Function Documentation

Definition at line 417 of file test_actions.py.

00417 
00418     def test_empty_default_purge(self):
00419         from Products.CMFCore.exportimport.actions \
00420                 import importActionProviders
00421 
00422         site = self._initSite(2, 0)
00423         atool = site.portal_actions
00424 
00425         self.assertEqual(len(atool.listActionProviders()), 2)
00426         self.failUnless('portal_foo' in atool.listActionProviders())
00427         self.failUnless('portal_actions' in atool.listActionProviders())
00428 
00429         context = DummyImportContext(site)
00430         context._files['actions.xml'] = _EMPTY_EXPORT
00431         importActionProviders(context)
00432 
00433         self.assertEqual(len(atool.listActionProviders()), 1)
00434         self.failIf('portal_foo' in atool.listActionProviders())
00435         self.failUnless('portal_actions' in atool.listActionProviders())
00436         self.assertEqual(len(atool.objectIds()), 0)

Here is the call graph for this function:

Definition at line 437 of file test_actions.py.

00437 
00438     def test_empty_explicit_purge(self):
00439         from Products.CMFCore.exportimport.actions \
00440                 import importActionProviders
00441 
00442         site = self._initSite(2, 0)
00443         atool = site.portal_actions
00444 
00445         self.assertEqual(len(atool.listActionProviders()), 2)
00446         self.failUnless('portal_foo' in atool.listActionProviders())
00447         self.failUnless('portal_actions' in atool.listActionProviders())
00448 
00449         context = DummyImportContext(site, True)
00450         context._files['actions.xml'] = _EMPTY_EXPORT
00451         importActionProviders(context)
00452 
00453         self.assertEqual(len(atool.listActionProviders()), 1)
00454         self.failIf('portal_foo' in atool.listActionProviders())
00455         self.failUnless('portal_actions' in atool.listActionProviders())
00456         self.assertEqual(len(atool.objectIds()), 0)

Here is the call graph for this function:

Definition at line 457 of file test_actions.py.

00457 
00458     def test_empty_skip_purge(self):
00459         from Products.CMFCore.exportimport.actions \
00460                 import importActionProviders
00461 
00462         site = self._initSite(2, 0)
00463         atool = site.portal_actions
00464 
00465         self.assertEqual(len(atool.listActionProviders()), 2)
00466         self.failUnless('portal_foo' in atool.listActionProviders())
00467         self.failUnless('portal_actions' in atool.listActionProviders())
00468 
00469         context = DummyImportContext(site, False)
00470         context._files['actions.xml'] = _EMPTY_EXPORT
00471         importActionProviders(context)
00472 
00473         self.assertEqual(len(atool.listActionProviders()), 2)
00474         self.failUnless('portal_foo' in atool.listActionProviders())
00475         self.failUnless('portal_actions' in atool.listActionProviders())

Here is the call graph for this function:

Definition at line 520 of file test_actions.py.

00520 
00521     def test_i18n(self):
00522         from Products.CMFCore.exportimport.actions \
00523                 import exportActionProviders
00524         from Products.CMFCore.exportimport.actions \
00525                 import importActionProviders
00526 
00527         site = self._initSite(0, 0)
00528         atool = site.portal_actions
00529 
00530         context = DummyImportContext(site)
00531         context._files['actions.xml'] = _I18N_IMPORT
00532         importActionProviders(context)
00533 
00534         self.assertEqual(len(atool.listActionProviders()), 1)
00535         self.assertEqual(atool.objectIds(), ['dummy'])
00536         self.assertEqual(atool.dummy.objectIds(), ['foo'])
00537         self.assertEqual(atool.dummy.foo.i18n_domain, 'foo_domain')
00538 
00539         # complete the roundtrip
00540         context = DummyExportContext(site)
00541         exportActionProviders(context)
00542 
00543         self.assertEqual(len(context._wrote), 1)
00544         filename, text, content_type = context._wrote[0]
00545         self.assertEqual(filename, 'actions.xml')
00546         self._compareDOM(text, _I18N_IMPORT)
00547         self.assertEqual(content_type, 'text/xml')

Here is the call graph for this function:

Definition at line 548 of file test_actions.py.

00548 
00549     def test_insert_skip_purge(self):
00550         from Products.CMFCore.exportimport.actions \
00551                 import importActionProviders
00552 
00553         site = self._initSite(0, 0)
00554         atool = site.portal_actions
00555 
00556         context = DummyImportContext(site)
00557         context._files['actions.xml'] = _NEWSYTLE_EXPORT
00558         importActionProviders(context)
00559 
00560         self.assertEqual(len(atool.listActionProviders()), 1)
00561         self.assertEqual(atool.objectIds(), ['dummy'])
00562         self.assertEqual(atool.dummy.objectIds(), ['foo', 'bar'])
00563         self.assertEqual(atool.dummy.foo.icon_expr, '')
00564 
00565         context = DummyImportContext(site, False)
00566         context._files['actions.xml'] = _INSERT_IMPORT
00567         importActionProviders(context)
00568 
00569         self.assertEqual(len(atool.listActionProviders()), 1)
00570         self.assertEqual(atool.objectIds(), ['dummy'])
00571         self.assertEqual(atool.dummy.objectIds(), ['spam', 'bar', 'foo'])
00572         self.assertEqual(atool.dummy.foo.icon_expr, 'string:foo_icon.png')

Here is the call graph for this function:

Definition at line 476 of file test_actions.py.

00476 
00477     def test_normal(self):
00478         from Products.CMFCore.exportimport.actions \
00479                 import exportActionProviders
00480         from Products.CMFCore.exportimport.actions \
00481                 import importActionProviders
00482 
00483         site = self._initSite(1, 1)
00484         atool = site.portal_actions
00485         foo = site.portal_foo
00486         bar = site.portal_bar
00487 
00488         self.assertEqual(len(atool.listActionProviders()), 1)
00489         self.failIf('portal_foo' in atool.listActionProviders())
00490         self.failIf(foo.listActions())
00491         self.failIf('portal_bar' in atool.listActionProviders())
00492         self.failIf(bar.listActions())
00493         self.failUnless('portal_actions' in atool.listActionProviders())
00494 
00495         context = DummyImportContext(site)
00496         context._files['actions.xml'] = _NORMAL_EXPORT
00497         importActionProviders(context)
00498 
00499         self.assertEqual(len(atool.listActionProviders()), 1)
00500         self.failIf('portal_foo' in atool.listActionProviders())
00501         self.failUnless('portal_actions' in atool.listActionProviders())
00502 
00503         self.assertEqual(len(atool.objectIds()), 1)
00504         self.failUnless('dummy' in atool.objectIds())
00505         self.assertEqual(len(atool.dummy.objectIds()) , 2)
00506         self.failUnless('foo' in atool.dummy.objectIds())
00507         self.failUnless('bar' in atool.dummy.objectIds())
00508         self.failIf(foo.listActions())
00509         self.failIf(bar.listActions())
00510 
00511         # complete the roundtrip
00512         context = DummyExportContext(site)
00513         exportActionProviders(context)
00514 
00515         self.assertEqual(len(context._wrote), 1)
00516         filename, text, content_type = context._wrote[0]
00517         self.assertEqual(filename, 'actions.xml')
00518         self._compareDOM(text, _NEWSYTLE_EXPORT)
00519         self.assertEqual(content_type, 'text/xml')

Here is the call graph for this function:

Definition at line 573 of file test_actions.py.

00573 
00574     def test_remove_skip_purge(self):
00575         from Products.CMFCore.exportimport.actions \
00576                 import importActionProviders
00577 
00578         site = self._initSite(2, 2)
00579         atool = site.portal_actions
00580 
00581         self.assertEqual(atool.listActionProviders(),
00582                           ['portal_actions', 'portal_foo', 'portal_bar'])
00583 
00584         context = DummyImportContext(site, False)
00585         context._files['actions.xml'] = _REMOVE_IMPORT
00586         importActionProviders(context)
00587 
00588         self.assertEqual(atool.listActionProviders(), ['portal_foo'])
00589 

Here is the call graph for this function:


Member Data Documentation

Definition at line 415 of file test_actions.py.


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