Exemplo n.º 1
0
 def testOrderIsUpdatedOnSimpleReverse(self):
     folder_position(self.folder, position='ordered', reverse=True)
     folder_docs = self.catalog(
                         portal_type='Document',
                         path='/'.join(self.folder.getPhysicalPath()),
                         sort_on='getObjPositionInParent')
     expected = ['doc4', 'doc3', 'doc2', 'doc1']
     self.assertEqual([b.getId for b in folder_docs], expected)
Exemplo n.º 2
0
 def testOrderIsUpdatedOnSimpleReverse(self):
     folder_position(self.folder, position='ordered', reverse=True)
     folder_docs = self.catalog(
         portal_type='Document',
         path='/'.join(self.folder.getPhysicalPath()),
         sort_on='getObjPositionInParent')
     expected = ['doc4', 'doc3', 'doc2', 'doc1']
     self.assertEqual([b.getId for b in folder_docs], expected)
Exemplo n.º 3
0
 def testOrderIsUpdatedOnMoveBottom(self):
     folder_position(self.folder, 'bottom', 'doc3')
     folder_docs = self.catalog(portal_type='Document',
                                path='/'.join(
                                    self.folder.getPhysicalPath()),
                                sort_on='getObjPositionInParent')
     expected = ['doc1', 'doc2', 'doc4', 'doc3']
     self.assertEqual([b.getId for b in folder_docs], expected)
Exemplo n.º 4
0
 def testOrderIsUpdatedOnMoveBottom(self):
     folder_position(self.folder, 'bottom', 'doc3')
     folder_docs = self.catalog(
         portal_type='Document',
         path='/'.join(self.folder.getPhysicalPath()),
         sort_on='getObjPositionInParent'
     )
     expected = ['doc1', 'doc2', 'doc4', 'doc3']
     self.assertEqual([b.getId for b in folder_docs], expected)
Exemplo n.º 5
0
 def testOrderIsUnchangedOnDefaultFolderPosition(self):
     # Calling the folder_position script with no arguments should
     # give no complaints and have no effect.
     folder_position(self.folder)
     folder_docs = self.catalog(
         portal_type='Document',
         path='/'.join(self.folder.getPhysicalPath()),
         sort_on='getObjPositionInParent')
     expected = ['doc1', 'doc2', 'doc3', 'doc4']
     self.assertEqual([b.getId for b in folder_docs], expected)
Exemplo n.º 6
0
 def testOrderIsUnchangedOnDefaultFolderPosition(self):
     # Calling the folder_position script with no arguments should
     # give no complaints and have no effect.
     folder_position(self.folder)
     folder_docs = self.catalog(
                         portal_type='Document',
                         path='/'.join(self.folder.getPhysicalPath()),
                         sort_on='getObjPositionInParent')
     expected = ['doc1', 'doc2', 'doc3', 'doc4']
     self.assertEqual([b.getId for b in folder_docs], expected)
 def testTabsRespectFolderOrder(self):
     # See if reordering causes a change in the tab order
     view = self.view_class(self.portal, self.request)
     tabs1 = view.topLevelTabs(actions=[])
     # Must be manager to change order on portal itself
     self.setRoles(['Manager', 'Member'])
     folder_position(self.portal, 'up', 'folder2')
     view = self.view_class(self.portal, self.request)
     tabs2 = view.topLevelTabs(actions=[])
     #Same number of objects
     self.assertEqual(len(tabs1), len(tabs2))
     #Different order
     self.assertTrue(tabs1 != tabs2)
 def testTabsRespectFolderOrder(self):
     # See if reordering causes a change in the tab order
     view = self.view_class(self.portal, self.request)
     tabs1 = view.topLevelTabs(actions=[])
     # Must be manager to change order on portal itself
     self.setRoles(['Manager', 'Member'])
     folder_position(self.portal, 'up', 'folder2')
     view = self.view_class(self.portal, self.request)
     tabs2 = view.topLevelTabs(actions=[])
     # Same number of objects
     self.assertEqual(len(tabs1), len(tabs2))
     # Different order
     self.assertTrue(tabs1 != tabs2)
Exemplo n.º 9
0
    def testOrderAfterALotOfChanges(self):
        # ['doc1','doc2','doc3','doc4']

        folder_position(self.folder, 'down', 'doc1')
        folder_position(self.folder, 'down', 'doc1')
        # ['doc2','doc3','doc1','doc4']

        folder_position(self.folder, 'top', 'doc3')
        # ['doc3','doc2','doc1','doc4']

        self.folder.invokeFactory('Document', id='doc5', text='blam')
        self.folder.invokeFactory('Document', id='doc6', text='blam')
        self.folder.invokeFactory('Document', id='doc7', text='blam')
        self.folder.invokeFactory('Document', id='doc8', text='blam')
        # ['doc3','doc2','doc1','doc4','doc5','doc6','doc7','doc8',]

        #self.folder.manage_renameObjects('Document', id='doc5', text='blam')

        self.folder.manage_delObjects(['doc3', 'doc4', 'doc5', 'doc7'])
        expected = ['doc2', 'doc1', 'doc6', 'doc8']

        folder_docs = self.catalog(
            portal_type='Document',
            path='/'.join(self.folder.getPhysicalPath()),
            sort_on='getObjPositionInParent',
        )
        self.assertEqual([b.getId for b in folder_docs], expected)
Exemplo n.º 10
0
    def testOrderAfterALotOfChanges(self):
        # ['doc1','doc2','doc3','doc4']

        folder_position(self.folder, 'down', 'doc1')
        folder_position(self.folder, 'down', 'doc1')
        # ['doc2','doc3','doc1','doc4']

        folder_position(self.folder, 'top', 'doc3')
        # ['doc3','doc2','doc1','doc4']

        self.folder.invokeFactory('Document', id='doc5', text='blam')
        self.folder.invokeFactory('Document', id='doc6', text='blam')
        self.folder.invokeFactory('Document', id='doc7', text='blam')
        self.folder.invokeFactory('Document', id='doc8', text='blam')
        # ['doc3','doc2','doc1','doc4','doc5','doc6','doc7','doc8',]

        #self.folder.manage_renameObjects('Document', id='doc5', text='blam')

        self.folder.manage_delObjects(['doc3', 'doc4', 'doc5', 'doc7'])
        expected = ['doc2', 'doc1', 'doc6', 'doc8']

        folder_docs = self.catalog(
            portal_type='Document',
            path='/'.join(self.folder.getPhysicalPath()),
            sort_on='getObjPositionInParent',
        )
        self.assertEqual([b.getId for b in folder_docs], expected)