Commit f655222c authored by Łukasz Nowak's avatar Łukasz Nowak

- add test for different bases


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25460 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 088463fd
...@@ -399,6 +399,38 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor): ...@@ -399,6 +399,38 @@ class TestFolderMigration(ERP5TypeTestCase, LogInterceptor):
self.assertEqual(len(self.folder.objectIds(base_id='BASE')), 1) self.assertEqual(len(self.folder.objectIds(base_id='BASE')), 1)
self.assertEqual(len(self.folder.objectValues(base_id='BASE')), 1) self.assertEqual(len(self.folder.objectValues(base_id='BASE')), 1)
def test_10_migrateFolderCreateMoreObjectAtOnceDifferentBase(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')
obj5 = self.newContent(id='BASE-BELONG-123')
self.assertEquals(obj4.getId(), 'BASE-123')
self.assertEquals(obj5.getId(), 'BASE-BELONG-123')
self.assertEqual(len(self.folder.objectIds(base_id=None)), 3)
self.assertEqual(len(self.folder.objectValues()), 5)
self.assertEqual(len(self.folder.objectValues(base_id=None)), 3)
self.assertEqual(len(self.folder.objectIds(base_id='BASE')), 2)
self.assertEqual(len(self.folder.objectValues(base_id='BASE')), 2)
self.assertEqual(len(self.folder.objectIds(base_id='BASE-BELONG')), 1)
self.assertEqual(len(self.folder.objectValues(base_id='BASE-BELONG')), 1)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestFolderMigration)) 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