Back to index

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

List of all members.

Public Member Functions

def setUp
def test_folderMove
def test_contentPaste

Public Attributes

 site

Static Public Attributes

 layer = TraversingEventZCMLLayer

Private Member Functions

def _makeOne

Detailed Description

Definition at line 424 of file test_PortalFolder.py.


Member Function Documentation

def CMFCore.tests.test_PortalFolder.PortalFolderMoveTests._makeOne (   self,
  id,
  args,
  kw 
) [private]

Definition at line 433 of file test_PortalFolder.py.

00433 
00434     def _makeOne(self, id, *args, **kw):
00435         from Products.CMFCore.PortalFolder import PortalFolder
00436 
00437         return self.site._setObject( id, PortalFolder(id, *args, **kw) )

Definition at line 428 of file test_PortalFolder.py.

00428 
00429     def setUp(self):
00430         SecurityTest.setUp(self)
00431         self.root._setObject( 'site', DummySite('site') )
00432         self.site = self.root.site

Definition at line 486 of file test_PortalFolder.py.

00486 
00487     def test_contentPaste(self):
00488         #
00489         #   Does copy / paste work?
00490         #
00491         ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
00492         ttool = self.site._setObject( 'portal_types', TypesTool() )
00493         fti = FTIDATA_DUMMY[0].copy()
00494         ttool._setObject( 'Dummy Content', FTI(**fti) )
00495         sub1 = self._makeOne('sub1')
00496         sub2 = self._makeOne('sub2')
00497         sub3 = self._makeOne('sub3')
00498         self.assertEqual( len(ctool), 0 )
00499 
00500         sub1._setObject( 'dummy', DummyContent( 'dummy', catalog=1 ) )
00501         self.failUnless( 'dummy' in sub1.objectIds() )
00502         self.failUnless( 'dummy' in sub1.contentIds() )
00503         self.failIf( 'dummy' in sub2.objectIds() )
00504         self.failIf( 'dummy' in sub2.contentIds() )
00505         self.failIf( 'dummy' in sub3.objectIds() )
00506         self.failIf( 'dummy' in sub3.contentIds() )
00507         self.failUnless( has_path(ctool._catalog, '/bar/site/sub1/dummy') )
00508         self.failIf( has_path(ctool._catalog, '/bar/site/sub2/dummy') )
00509         self.failIf( has_path(ctool._catalog, '/bar/site/sub3/dummy') )
00510 
00511         cookie = sub1.manage_copyObjects( ids = ( 'dummy', ) )
00512         # Waaa! force sub2 to allow paste of Dummy object.
00513         sub2.all_meta_types = []
00514         sub2.all_meta_types.extend( sub2.all_meta_types )
00515         sub2.all_meta_types.extend( extra_meta_types() )
00516         sub2.manage_pasteObjects( cookie )
00517         self.failUnless( 'dummy' in sub1.objectIds() )
00518         self.failUnless( 'dummy' in sub1.contentIds() )
00519         self.failUnless( 'dummy' in sub2.objectIds() )
00520         self.failUnless( 'dummy' in sub2.contentIds() )
00521         self.failIf( 'dummy' in sub3.objectIds() )
00522         self.failIf( 'dummy' in sub3.contentIds() )
00523         self.failUnless( has_path(ctool._catalog, '/bar/site/sub1/dummy') )
00524         self.failUnless( has_path(ctool._catalog, '/bar/site/sub2/dummy') )
00525         self.failIf( has_path(ctool._catalog, '/bar/site/sub3/dummy') )
00526 
00527         transaction.savepoint(optimistic=True)
00528         cookie = sub1.manage_cutObjects( ids = ('dummy',) )
00529         # Waaa! force sub2 to allow paste of Dummy object.
00530         sub3.all_meta_types = []
00531         sub3.all_meta_types.extend(sub3.all_meta_types)
00532         sub3.all_meta_types.extend( extra_meta_types() )
00533         sub3.manage_pasteObjects(cookie)
00534         self.failIf( 'dummy' in sub1.objectIds() )
00535         self.failIf( 'dummy' in sub1.contentIds() )
00536         self.failUnless( 'dummy' in sub2.objectIds() )
00537         self.failUnless( 'dummy' in sub2.contentIds() )
00538         self.failUnless( 'dummy' in sub3.objectIds() )
00539         self.failUnless( 'dummy' in sub3.contentIds() )
00540         self.failIf( has_path(ctool._catalog, '/bar/site/sub1/dummy') )
00541         self.failUnless( has_path(ctool._catalog, '/bar/site/sub2/dummy') )
00542         self.failUnless( has_path(ctool._catalog, '/bar/site/sub3/dummy') )
00543 

Here is the call graph for this function:

Definition at line 438 of file test_PortalFolder.py.

00438 
00439     def test_folderMove(self):
00440         #
00441         #   Does the catalog stay synched when folders are moved?
00442         #
00443         from Products.CMFCore.PortalFolder import PortalFolder
00444 
00445         ttool = self.site._setObject( 'portal_types', TypesTool() )
00446         ctool = self.site._setObject( 'portal_catalog', CatalogTool() )
00447         ctool.addIndex('getId', 'FieldIndex')
00448         self.assertEqual( len(ctool), 0 )
00449 
00450         folder = self._makeOne('folder')
00451         folder._setObject( 'sub', PortalFolder( 'sub', '' ) )
00452         folder.sub._setObject( 'foo', DummyContent( 'foo', catalog=1 ) )
00453         self.assertEqual( len(ctool), 1 )
00454         self.failUnless( 'foo' in ctool.uniqueValuesFor('getId') )
00455         self.failUnless( has_path(ctool._catalog,
00456                                   '/bar/site/folder/sub/foo') )
00457 
00458         transaction.savepoint(optimistic=True)
00459         folder.manage_renameObject(id='sub', new_id='new_sub')
00460         self.assertEqual( len(ctool), 1 )
00461         self.failUnless( 'foo' in ctool.uniqueValuesFor('getId') )
00462         self.failUnless( has_path(ctool._catalog,
00463                                   '/bar/site/folder/new_sub/foo') )
00464 
00465         folder._setObject( 'bar', DummyContent( 'bar', catalog=1 ) )
00466         self.assertEqual( len(ctool), 2 )
00467         self.failUnless( 'bar' in ctool.uniqueValuesFor('getId') )
00468         self.failUnless( has_path(ctool._catalog, '/bar/site/folder/bar') )
00469 
00470         folder._setObject( 'sub2', PortalFolder( 'sub2', '' ) )
00471         sub2 = folder.sub2
00472         # Waaa! force sub2 to allow paste of Dummy object.
00473         sub2.all_meta_types = []
00474         sub2.all_meta_types.extend( sub2.all_meta_types )
00475         sub2.all_meta_types.extend( extra_meta_types() )
00476 
00477         transaction.savepoint(optimistic=True)
00478         cookie = folder.manage_cutObjects(ids=['bar'])
00479         sub2.manage_pasteObjects(cookie)
00480 
00481         self.failUnless( 'foo' in ctool.uniqueValuesFor('getId') )
00482         self.failUnless( 'bar' in ctool.uniqueValuesFor('getId') )
00483         self.assertEqual( len(ctool), 2 )
00484         self.failUnless( has_path(ctool._catalog,
00485                                   '/bar/site/folder/sub2/bar') )

Here is the call graph for this function:


Member Data Documentation

Definition at line 426 of file test_PortalFolder.py.

Definition at line 431 of file test_PortalFolder.py.


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