Commit 859c642e authored by Romain Courteaud's avatar Romain Courteaud

getLastLengthGeneratedId always returns the value stored in ZODB if it exists....

getLastLengthGeneratedId always returns the value stored in ZODB if it exists. This prevent to change the usage of generateNewLengthId without data migration currently.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34163 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1e996746
...@@ -80,6 +80,17 @@ class TestIdTool(ERP5TypeTestCase): ...@@ -80,6 +80,17 @@ class TestIdTool(ERP5TypeTestCase):
self.assertEqual(None, last_id) self.assertEqual(None, last_id)
last_id = idtool.getLastLengthGeneratedId(id_group=8,default=99) last_id = idtool.getLastLengthGeneratedId(id_group=8,default=99)
self.assertEqual(99, last_id) self.assertEqual(99, last_id)
# test the store parameter with an existing value stored in the ZODB
new_id = idtool.generateNewLengthId(id_group=(9,), store=1)
transaction.commit()
self.tic()
last_id = idtool.getLastLengthGeneratedId(id_group=(9,),)
self.assertEqual(new_id, last_id)
new_id = idtool.generateNewLengthId(id_group=(9,), store=0)
transaction.commit()
self.tic()
last_id = idtool.getLastLengthGeneratedId(id_group=(9,),)
self.assertEqual(new_id, last_id)
def test_generateNewId(self, quiet=0, run=run_all_test): def test_generateNewId(self, quiet=0, run=run_all_test):
......
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