Back to index

plone3  3.1.7
Public Member Functions
CMFPlone.tests.testOrderSupport.TestOrderSupport Class Reference
Inheritance diagram for CMFPlone.tests.testOrderSupport.TestOrderSupport:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testOrderSupport.TestOrderSupport:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testGetObjectPosition
def testMoveObject
def testMoveObjectToSamePos
def testMoveObjectToFirstPos
def testMoveObjectToLastPos
def testMoveObjectOutLowerBounds
def testMoveObjectOutUpperBounds
def testMoveObjectsUp
def testMoveObjectsDown
def testMoveObjectsToTop
def testMoveObjectsToBottom
def testMoveTwoObjectsUp
def testMoveTwoObjectsDown
def testMoveTwoObjectsToTop
def testMoveTwoObjectsToBottom
def testRenameObject
def testRenameFirstObject
def testRenameLastObject
def testOrderObjects
def DISABLED_test_manage_move_objects_up
def DISABLED_test_manage_move_objects_down
def DISABLED_test_manage_move_objects_to_top
def DISABLED_test_manage_move_objects_to_bottom
def testSubsetIds
def testSkipObjectsNotInSubsetIds
def testIgnoreNonObjects
def testMoveCMFObjectsOnly
def testMoveUpCMFObjectsOnly
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Detailed Description

Definition at line 10 of file testOrderSupport.py.


Member Function Documentation

Definition at line 12 of file testOrderSupport.py.

00012 
00013     def afterSetUp(self):
00014         membership = self.portal.portal_membership
00015         # Add a bunch of subobjects we can order later on
00016         self.folder.invokeFactory('Document', id='foo')
00017         self.folder.invokeFactory('Document', id='bar')
00018         self.folder.invokeFactory('Document', id='baz')

Definition at line 147 of file testOrderSupport.py.

00147 
00148     def DISABLED_test_manage_move_objects_down(self):
00149         # Make sure ZMI method works
00150         self.folder.manage_move_objects_down(self.app.REQUEST, ids=['bar'])
00151         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00152         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00153         self.assertEqual(self.folder.getObjectPosition('bar'), 2)

Definition at line 161 of file testOrderSupport.py.

00161 
00162     def DISABLED_test_manage_move_objects_to_bottom(self):
00163         # Make sure ZMI method works
00164         self.folder.manage_move_objects_to_bottom(self.app.REQUEST, ids=['bar'])
00165         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00166         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00167         self.assertEqual(self.folder.getObjectPosition('bar'), 2)

Definition at line 154 of file testOrderSupport.py.

00154 
00155     def DISABLED_test_manage_move_objects_to_top(self):
00156         # Make sure ZMI method works
00157         self.folder.manage_move_objects_to_top(self.app.REQUEST, ids=['bar'])
00158         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00159         self.assertEqual(self.folder.getObjectPosition('foo'), 1)
00160         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

Definition at line 140 of file testOrderSupport.py.

00140 
00141     def DISABLED_test_manage_move_objects_up(self):
00142         # Make sure ZMI method works
00143         self.folder.manage_move_objects_up(self.app.REQUEST, ids=['bar'])
00144         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00145         self.assertEqual(self.folder.getObjectPosition('foo'), 1)
00146         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

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 19 of file testOrderSupport.py.

00019 
00020     def testGetObjectPosition(self):
00021         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00022         self.assertEqual(self.folder.getObjectPosition('bar'), 1)
00023         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

Definition at line 180 of file testOrderSupport.py.

00180 
00181     def testIgnoreNonObjects(self):
00182         #Fix for (http://dev.plone.org/plone/ticket/3959) non contentish objects
00183         #cause errors, we should just ignore them
00184         self.folder.moveObjectsByDelta(['bar','blah'], -1)
00185         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00186         self.assertEqual(self.folder.getObjectPosition('foo'), 1)
00187         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

Definition at line 188 of file testOrderSupport.py.

00188 
00189     def testMoveCMFObjectsOnly(self):
00190         # Plone speciality
00191         self.folder.manage_addProduct['OFSP'].manage_addDTMLMethod('wilma', file='')
00192         self.folder.moveObject('wilma', 2)
00193         # Non-CMF object should keep position
00194         self.folder.moveObjectToPosition('foo', 2)
00195         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00196         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00197         self.assertEqual(self.folder.getObjectPosition('wilma'), 2) # Did not move
00198         self.assertEqual(self.folder.getObjectPosition('foo'), 3)

Definition at line 24 of file testOrderSupport.py.

00024 
00025     def testMoveObject(self):
00026         self.folder.moveObjectToPosition('foo', 1)
00027         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00028         self.assertEqual(self.folder.getObjectPosition('foo'), 1)
00029         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

Definition at line 48 of file testOrderSupport.py.

00048 
00049     def testMoveObjectOutLowerBounds(self):
00050         # Pos will be normalized to 0
00051         self.folder.moveObjectToPosition('bar', -1)
00052         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00053         self.assertEqual(self.folder.getObjectPosition('foo'), 1)
00054         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

Definition at line 55 of file testOrderSupport.py.

00055 
00056     def testMoveObjectOutUpperBounds(self):
00057         # Pos will be normalized to 2
00058         self.folder.moveObjectToPosition('bar', 3)
00059         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00060         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00061         self.assertEqual(self.folder.getObjectPosition('bar'), 2)

Definition at line 68 of file testOrderSupport.py.

00068 
00069     def testMoveObjectsDown(self):
00070         self.folder.moveObjectsDown(['bar'])
00071         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00072         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00073         self.assertEqual(self.folder.getObjectPosition('bar'), 2)

Definition at line 80 of file testOrderSupport.py.

00080 
00081     def testMoveObjectsToBottom(self):
00082         self.folder.moveObjectsToBottom(['bar'])
00083         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00084         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00085         self.assertEqual(self.folder.getObjectPosition('bar'), 2)

Definition at line 74 of file testOrderSupport.py.

00074 
00075     def testMoveObjectsToTop(self):
00076         self.folder.moveObjectsToTop(['bar'])
00077         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00078         self.assertEqual(self.folder.getObjectPosition('foo'), 1)
00079         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

Definition at line 62 of file testOrderSupport.py.

00062 
00063     def testMoveObjectsUp(self):
00064         self.folder.moveObjectsUp(['bar'])
00065         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00066         self.assertEqual(self.folder.getObjectPosition('foo'), 1)
00067         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

Definition at line 36 of file testOrderSupport.py.

00036 
00037     def testMoveObjectToFirstPos(self):
00038         self.folder.moveObjectToPosition('bar', 0)
00039         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00040         self.assertEqual(self.folder.getObjectPosition('foo'), 1)
00041         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

Definition at line 42 of file testOrderSupport.py.

00042 
00043     def testMoveObjectToLastPos(self):
00044         self.folder.moveObjectToPosition('bar', 2)
00045         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00046         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00047         self.assertEqual(self.folder.getObjectPosition('bar'), 2)

Definition at line 30 of file testOrderSupport.py.

00030 
00031     def testMoveObjectToSamePos(self):
00032         self.folder.moveObjectToPosition('bar', 1)
00033         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00034         self.assertEqual(self.folder.getObjectPosition('bar'), 1)
00035         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

Definition at line 92 of file testOrderSupport.py.

00092 
00093     def testMoveTwoObjectsDown(self):
00094         self.folder.moveObjectsDown(['foo', 'bar'])
00095         self.assertEqual(self.folder.getObjectPosition('baz'), 0)
00096         self.assertEqual(self.folder.getObjectPosition('foo'), 1)
00097         self.assertEqual(self.folder.getObjectPosition('bar'), 2)

Definition at line 104 of file testOrderSupport.py.

00104 
00105     def testMoveTwoObjectsToBottom(self):
00106         self.folder.moveObjectsToBottom(['foo', 'bar'])
00107         self.assertEqual(self.folder.getObjectPosition('baz'), 0)
00108         self.assertEqual(self.folder.getObjectPosition('foo'), 1)
00109         self.assertEqual(self.folder.getObjectPosition('bar'), 2)

Definition at line 98 of file testOrderSupport.py.

00098 
00099     def testMoveTwoObjectsToTop(self):
00100         self.folder.moveObjectsToTop(['bar', 'baz'])
00101         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00102         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00103         self.assertEqual(self.folder.getObjectPosition('foo'), 2)

Definition at line 86 of file testOrderSupport.py.

00086 
00087     def testMoveTwoObjectsUp(self):
00088         self.folder.moveObjectsUp(['bar', 'baz'])
00089         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00090         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00091         self.assertEqual(self.folder.getObjectPosition('foo'), 2)

Definition at line 199 of file testOrderSupport.py.

00199 
00200     def testMoveUpCMFObjectsOnly(self):
00201         # Plone speciality
00202         self.folder.manage_addProduct['OFSP'].manage_addDTMLMethod('wilma', file='')
00203         self.folder.moveObject('wilma', 2)
00204         # Non-CMF object should keep position
00205         self.folder.moveObjectsUp(['baz'])
00206         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00207         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00208         self.assertEqual(self.folder.getObjectPosition('wilma'), 2) # Did not move
00209         self.assertEqual(self.folder.getObjectPosition('bar'), 3)
00210 

Definition at line 134 of file testOrderSupport.py.

00134 
00135     def testOrderObjects(self):
00136         self.folder.orderObjects('id')
00137         self.assertEqual(self.folder.getObjectPosition('bar'), 0)
00138         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00139         self.assertEqual(self.folder.getObjectPosition('foo'), 2)

Definition at line 118 of file testOrderSupport.py.

00118 
00119     def testRenameFirstObject(self):
00120         # Renaming should not change position
00121         transaction.savepoint(optimistic=True) # make rename work
00122         self.folder.manage_renameObjects(['foo'], ['flintstone'])
00123         self.assertEqual(self.folder.getObjectPosition('flintstone'), 0)
00124         self.assertEqual(self.folder.getObjectPosition('bar'), 1)
00125         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

Definition at line 126 of file testOrderSupport.py.

00126 
00127     def testRenameLastObject(self):
00128         # Renaming should not change position
00129         transaction.savepoint(optimistic=True) # make rename work
00130         self.folder.manage_renameObjects(['baz'], ['bedrock'])
00131         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00132         self.assertEqual(self.folder.getObjectPosition('bar'), 1)
00133         self.assertEqual(self.folder.getObjectPosition('bedrock'), 2)

Definition at line 110 of file testOrderSupport.py.

00110 
00111     def testRenameObject(self):
00112         # Renaming should not change position
00113         transaction.savepoint(optimistic=True) # make rename work
00114         self.folder.manage_renameObjects(['bar'], ['barney'])
00115         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00116         self.assertEqual(self.folder.getObjectPosition('barney'), 1)
00117         self.assertEqual(self.folder.getObjectPosition('baz'), 2)

Definition at line 174 of file testOrderSupport.py.

00174 
00175     def testSkipObjectsNotInSubsetIds(self):
00176         self.folder.moveObjectsByDelta(['baz'], -1, ['foo', 'baz'])
00177         self.assertEqual(self.folder.getObjectPosition('baz'), 0)
00178         self.assertEqual(self.folder.getObjectPosition('bar'), 1) # Did not move
00179         self.assertEqual(self.folder.getObjectPosition('foo'), 2)

Definition at line 168 of file testOrderSupport.py.

00168 
00169     def testSubsetIds(self):
00170         self.folder.moveObjectsByDelta(['baz'], -1, ['foo', 'bar', 'baz'])
00171         self.assertEqual(self.folder.getObjectPosition('foo'), 0)
00172         self.assertEqual(self.folder.getObjectPosition('baz'), 1)
00173         self.assertEqual(self.folder.getObjectPosition('bar'), 2)


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