Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
CMFCore.exportimport.tests.test_typeinfo.importTypesToolTests Class Reference
Inheritance diagram for CMFCore.exportimport.tests.test_typeinfo.importTypesToolTests:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.exportimport.tests.test_typeinfo.importTypesToolTests:
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_with_filenames
def test_normal_update

Static Public Attributes

 layer = ExportImportZCMLLayer

Static Private Attributes

 _EMPTY_TOOL_EXPORT = _EMPTY_TOOL_EXPORT
 _FILENAME_EXPORT = _FILENAME_EXPORT
 _NORMAL_TOOL_EXPORT = _NORMAL_TOOL_EXPORT

Detailed Description

Definition at line 398 of file test_typeinfo.py.


Member Function Documentation

Definition at line 406 of file test_typeinfo.py.

00406 
00407     def test_empty_default_purge(self):
00408         from Products.CMFCore.exportimport.typeinfo import importTypesTool
00409 
00410         site = self._initSite(1)
00411         tool = site.portal_types
00412 
00413         self.assertEqual(len(tool.objectIds()), 2)
00414 
00415         context = DummyImportContext(site)
00416         context._files['types.xml'] = self._EMPTY_TOOL_EXPORT
00417         importTypesTool(context)
00418 
00419         self.assertEqual(len(tool.objectIds()), 0)

Here is the call graph for this function:

Definition at line 420 of file test_typeinfo.py.

00420 
00421     def test_empty_explicit_purge(self):
00422         from Products.CMFCore.exportimport.typeinfo import importTypesTool
00423 
00424         site = self._initSite(1)
00425         tool = site.portal_types
00426 
00427         self.assertEqual(len(tool.objectIds()), 2)
00428 
00429         context = DummyImportContext(site, True)
00430         context._files['types.xml'] = self._EMPTY_TOOL_EXPORT
00431         importTypesTool(context)
00432 
00433         self.assertEqual(len(tool.objectIds()), 0)

Here is the call graph for this function:

Definition at line 434 of file test_typeinfo.py.

00434 
00435     def test_empty_skip_purge(self):
00436         from Products.CMFCore.exportimport.typeinfo import importTypesTool
00437 
00438         site = self._initSite(1)
00439         tool = site.portal_types
00440 
00441         self.assertEqual(len(tool.objectIds()), 2)
00442 
00443         context = DummyImportContext(site, False)
00444         context._files['types.xml'] = self._EMPTY_TOOL_EXPORT
00445         importTypesTool(context)
00446 
00447         self.assertEqual(len(tool.objectIds()), 2)

Here is the call graph for this function:

Definition at line 448 of file test_typeinfo.py.

00448 
00449     def test_normal(self):
00450         from Products.CMFCore.exportimport.typeinfo import importTypesTool
00451 
00452         site = self._initSite()
00453         tool = site.portal_types
00454 
00455         self.assertEqual(len(tool.objectIds()), 0)
00456 
00457         context = DummyImportContext(site)
00458         context._files['types.xml'] = self._NORMAL_TOOL_EXPORT
00459         context._files['types/foo.xml'] = _FOO_EXPORT % 'foo'
00460         context._files['types/bar.xml'] = _BAR_EXPORT % 'bar'
00461         importTypesTool(context)
00462 
00463         self.assertEqual(len(tool.objectIds()), 2)
00464         self.failUnless('foo' in tool.objectIds())
00465         self.failUnless('bar' in tool.objectIds())

Here is the call graph for this function:

Definition at line 484 of file test_typeinfo.py.

00484 
00485     def test_normal_update(self):
00486         from Products.CMFCore.exportimport.typeinfo import importTypesTool
00487 
00488         site = self._initSite()
00489         tool = site.portal_types
00490 
00491         context = DummyImportContext(site)
00492         context._files['types.xml'] = self._NORMAL_TOOL_EXPORT
00493         context._files['types/foo.xml'] = _FOO_EXPORT % 'foo'
00494         context._files['types/bar.xml'] = _BAR_EXPORT % 'bar'
00495         importTypesTool(context)
00496 
00497         self.assertEqual(tool.foo.title, 'Foo')
00498         self.assertEqual(tool.foo.content_meta_type, 'Foo Thing')
00499         self.assertEqual(tool.foo.content_icon, 'foo.png')
00500         self.assertEqual(tool.foo.immediate_view, 'foo_view')
00501         self.assertEqual(tool.foo._aliases,
00502                          {'(Default)': 'foo_view', 'view': 'foo_view'})
00503 
00504         context = DummyImportContext(site, False)
00505         context._files['types.xml'] = _UPDATE_TOOL_IMPORT
00506         context._files['types/foo.xml'] = _UPDATE_FOO_IMPORT
00507         importTypesTool(context)
00508 
00509         self.assertEqual(tool.foo.title, 'Foo')
00510         self.assertEqual(tool.foo.content_meta_type, 'Foo Thing')
00511         self.assertEqual(tool.foo.content_icon, 'foo.png')
00512         self.assertEqual(tool.foo.immediate_view, 'foo_view')
00513         self.assertEqual(tool.foo._aliases,
00514                {'(Default)': 'foo_view', 'view': 'foo_view', 'spam': 'eggs'})
00515 

Here is the call graph for this function:

Definition at line 466 of file test_typeinfo.py.

00466 
00467     def test_with_filenames(self):
00468         from Products.CMFCore.exportimport.typeinfo import importTypesTool
00469 
00470         site = self._initSite()
00471         tool = site.portal_types
00472 
00473         self.assertEqual(len(tool.objectIds()), 0)
00474 
00475         context = DummyImportContext(site)
00476         context._files['types.xml'] = self._FILENAME_EXPORT
00477         context._files['types/foo_object.xml'] = _FOO_EXPORT % 'foo object'
00478         context._files['types/bar_object.xml'] = _BAR_EXPORT % 'bar object'
00479         importTypesTool(context)
00480 
00481         self.assertEqual(len(tool.objectIds()), 2)
00482         self.failUnless('foo object' in tool.objectIds())
00483         self.failUnless('bar object' in tool.objectIds())

Here is the call graph for this function:


Member Data Documentation

Definition at line 402 of file test_typeinfo.py.

Definition at line 403 of file test_typeinfo.py.

Definition at line 404 of file test_typeinfo.py.

Definition at line 400 of file test_typeinfo.py.


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