Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFPlone.tests.testCatalogTool.TestCatalogOrdering Class Reference
Inheritance diagram for CMFPlone.tests.testCatalogTool.TestCatalogOrdering:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testCatalogTool.TestCatalogOrdering:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testInitialOrder
def testOrderIsUpdatedOnMoveDown
def testOrderIsUpdatedOnMoveUp
def testOrderIsUpdatedOnMoveTop
def testOrderIsUpdatedOnMoveBottom
def testOrderIsFineWithObjectCreation
def testOrderIsFineWithObjectDeletion
def testOrderIsFineWithObjectRenaming
def testOrderAfterALotOfChanges
def testAllObjectsHaveOrder
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 catalog

Detailed Description

Definition at line 548 of file testCatalogTool.py.


Member Function Documentation

Definition at line 550 of file testCatalogTool.py.

00550 
00551     def afterSetUp(self):
00552         self.catalog = self.portal.portal_catalog
00553         self.folder.invokeFactory('Document', id='doc1', text='foo')
00554         self.folder.invokeFactory('Document', id='doc2', text='bar')
00555         self.folder.invokeFactory('Document', id='doc3', text='bloo')
00556         self.folder.invokeFactory('Document', id='doc4', text='blee')

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 652 of file testCatalogTool.py.

00652 
00653     def testAllObjectsHaveOrder(self):
00654         #Make sure that a query with sort_on='getObjPositionInParent'
00655         #returns the same number of results as one without, make sure
00656         #the Members folder is in the catalog and has getObjPositionInParent
00657         all_objs = self.catalog()
00658         sorted_objs = self.catalog(sort_on='getObjPositionInParent')
00659         self.failUnlessEqual(len(all_objs), len(sorted_objs))
00660 
00661         members = self.portal.Members
00662         members_path = '/'.join(members.getPhysicalPath())
00663         members_query = self.catalog(path=members_path)
00664         members_sorted = self.catalog(path=members_path, sort_on = 'getObjPositionInParent')
00665         self.failUnless(len(members_query))
00666         self.failUnlessEqual(len(members_query),len(members_sorted))
00667 

Definition at line 557 of file testCatalogTool.py.

00557 
00558     def testInitialOrder(self):
00559         self.failUnlessEqual(self.folder.getObjectPosition('doc1'), 0)
00560         self.failUnlessEqual(self.folder.getObjectPosition('doc2'), 1)
00561         self.failUnlessEqual(self.folder.getObjectPosition('doc3'), 2)
00562         self.failUnlessEqual(self.folder.getObjectPosition('doc4'), 3)

Definition at line 626 of file testCatalogTool.py.

00626 
00627     def testOrderAfterALotOfChanges(self):
00628         # ['doc1','doc2','doc3','doc4']
00629 
00630         self.folder.folder_position('down','doc1')
00631         self.folder.folder_position('down','doc1')
00632         # ['doc2','doc3','doc1','doc4']
00633 
00634         self.folder.folder_position('top','doc3')
00635         # ['doc3','doc2','doc1','doc4']
00636 
00637         self.folder.invokeFactory('Document', id='doc5', text='blam')
00638         self.folder.invokeFactory('Document', id='doc6', text='blam')
00639         self.folder.invokeFactory('Document', id='doc7', text='blam')
00640         self.folder.invokeFactory('Document', id='doc8', text='blam')
00641         # ['doc3','doc2','doc1','doc4','doc5','doc6','doc7','doc8',]
00642 
00643         #self.folder.manage_renameObjects('Document', id='doc5', text='blam')
00644 
00645         self.folder.manage_delObjects(['doc3','doc4','doc5','doc7'])
00646         expected = ['doc2','doc1','doc6','doc8', 'front-page']
00647 
00648         folder_docs = self.catalog(portal_type = 'Document',
00649                                    path = self.folder.getPhysicalPath(),
00650                                    sort_on = 'getObjPositionInParent')
00651         self.failUnlessEqual([b.getId for b in folder_docs], expected)

Definition at line 595 of file testCatalogTool.py.

00595 
00596     def testOrderIsFineWithObjectCreation(self):
00597         self.folder.invokeFactory('Document', id='doc5', text='blam')
00598         folder_docs = self.catalog(portal_type = 'Document',
00599                                    path = self.folder.getPhysicalPath(),
00600                                    sort_on = 'getObjPositionInParent')
00601         expected = ['doc1','doc2','doc3','doc4','doc5', 'front-page']
00602         self.failUnlessEqual([b.getId for b in folder_docs], expected)

Definition at line 603 of file testCatalogTool.py.

00603 
00604     def testOrderIsFineWithObjectDeletion(self):
00605         self.folder.manage_delObjects(['doc3',])
00606         folder_docs = self.catalog(portal_type = 'Document',
00607                                    path = self.folder.getPhysicalPath(),
00608                                    sort_on = 'getObjPositionInParent')
00609         expected = ['doc1','doc2','doc4', 'front-page']
00610         self.failUnlessEqual([b.getId for b in folder_docs], expected)

Definition at line 611 of file testCatalogTool.py.

00611 
00612     def testOrderIsFineWithObjectRenaming(self):
00613 
00614         # I don't know why this is failing. manage_renameObjects throws an error
00615         # that blames permissions or lack of support by the obj. The obj is a
00616         # Plone Document, and the owner of doc2 is portal_owner. Harumph.
00617 
00618         transaction.savepoint(optimistic=True)
00619 
00620         self.folder.manage_renameObjects(['doc2'], ['buzz'])
00621         folder_docs = self.catalog(portal_type = 'Document',
00622                                    path = self.folder.getPhysicalPath(),
00623                                    sort_on = 'getObjPositionInParent')
00624         expected = ['doc1','buzz','doc3','doc4', 'front-page']
00625         self.failUnlessEqual([b.getId for b in folder_docs], expected)

Definition at line 587 of file testCatalogTool.py.

00587 
00588     def testOrderIsUpdatedOnMoveBottom(self):
00589         self.folder.folder_position('bottom','doc3')
00590         folder_docs = self.catalog(portal_type = 'Document',
00591                                    path = self.folder.getPhysicalPath(),
00592                                    sort_on = 'getObjPositionInParent')
00593         expected = ['doc1','doc2','doc4','doc3', 'front-page']
00594         self.failUnlessEqual([b.getId for b in folder_docs], expected)

Definition at line 563 of file testCatalogTool.py.

00563 
00564     def testOrderIsUpdatedOnMoveDown(self):
00565         self.folder.folder_position('down','doc1')
00566         folder_docs = self.catalog(portal_type = 'Document',
00567                                    path = self.folder.getPhysicalPath(),
00568                                    sort_on = 'getObjPositionInParent')
00569         expected = ['doc2','doc1','doc3','doc4', 'front-page']
00570         self.failUnlessEqual([b.getId for b in folder_docs], expected)

Definition at line 579 of file testCatalogTool.py.

00579 
00580     def testOrderIsUpdatedOnMoveTop(self):
00581         self.folder.folder_position('top','doc3')
00582         folder_docs = self.catalog(portal_type = 'Document',
00583                                    path = self.folder.getPhysicalPath(),
00584                                    sort_on = 'getObjPositionInParent')
00585         expected = ['doc3','doc1','doc2','doc4', 'front-page']
00586         self.failUnlessEqual([b.getId for b in folder_docs], expected)

Definition at line 571 of file testCatalogTool.py.

00571 
00572     def testOrderIsUpdatedOnMoveUp(self):
00573         self.folder.folder_position('up','doc3')
00574         folder_docs = self.catalog(portal_type = 'Document',
00575                                    path = self.folder.getPhysicalPath(),
00576                                    sort_on = 'getObjPositionInParent')
00577         expected = ['doc1','doc3','doc2','doc4', 'front-page']
00578         self.failUnlessEqual([b.getId for b in folder_docs], expected)


Member Data Documentation

Definition at line 551 of file testCatalogTool.py.


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