def test_item_order_move_by_delta_in_plone_root(self): from plone.app.content.browser.contents.rearrange import ItemOrderActionView # noqa # first move the 'basefolder' to the top self.request.form.update({ 'id': 'basefolder', 'delta': 'top', }) view = ItemOrderActionView(self.portal, self.request) view() # move 'basefolder' two positions down self.request.form.update({ 'id': 'basefolder', 'delta': '2', 'subsetIds': '["basefolder", "page_0", "page_1", "page_2"]', }) view = ItemOrderActionView(self.portal, self.request) view() self.assertEqual([(c[0], c[1].Title()) for c in self.portal.contentItems()], [ ('page_0', 'Page 0'), ('page_1', 'Page 1'), ('basefolder', 'Folder Base'), ('page_2', 'Page 2'), ])
def test_item_order_move_by_delta(self): from plone.app.content.browser.contents.rearrange import ItemOrderActionView # noqa self.request.form.update({ 'id': 'f2', 'delta': '-1', }) view = ItemOrderActionView(self.bf, self.request) view() self.assertEqual([(c[0], c[1].Title()) for c in self.bf.contentItems()], [ ('f0', 'Folder 4'), ('f2', 'Folder 2'), ('f1', 'Folder 3'), ('f3', 'Folder 1'), ('f4', 'Folder 0'), ])