Commit 088463fd authored by Łukasz Nowak's avatar Łukasz Nowak

- allow passing args and kwargs to local newContent

 - add test which is not setting _tree_list on folder by sideeffect of invoking getTreeIdList


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25459 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ef014a5d
......@@ -67,11 +67,11 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor):
self.tic()
def newContent(self):
def newContent(self, *args, **kwargs):
"""
Create an object in self.folder and return it.
"""
return self.folder.newContent(portal_type='Folder')
return self.folder.newContent(portal_type='Folder', *args, **kwargs)
def test_01_folderIsBtree(self, quiet=0, run=1):
"""
......@@ -371,6 +371,34 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor):
obj4 = self.newContent()
self.assertEquals(obj4.getId().split('-')[0], date)
def test_09_migrateFolderCreateNewObjectAtOnce(self, quiet=0, run=1):
"""
migrate folder from btree to hbtree, do not touch ids
"""
if not run : return
# Create some objects
self.assertEquals(self.folder.getIdGenerator(), '')
self.assertEquals(len(self.folder), 0)
obj1 = self.newContent()
self.assertEquals(obj1.getId(), '1')
obj2 = self.newContent()
self.assertEquals(obj2.getId(), '2')
obj3 = self.newContent()
self.assertEquals(obj3.getId(), '3')
get_transaction().commit()
self.tic()
# call migration script
self.folder.migrateToHBTree()
get_transaction().commit()
self.tic()
obj4 = self.newContent(id='BASE-123')
self.assertEquals(obj4.getId(), 'BASE-123')
self.assertEqual(len(self.folder.objectIds(base_id=None)), 3)
self.assertEqual(len(self.folder.objectValues()), 4)
self.assertEqual(len(self.folder.objectValues(base_id=None)), 3)
self.assertEqual(len(self.folder.objectIds(base_id='BASE')), 1)
self.assertEqual(len(self.folder.objectValues(base_id='BASE')), 1)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestFolderMigration))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment