Commit 9a7c7629 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Add a test for uid duplication by newUid.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4434 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a59f2a6f
...@@ -493,10 +493,19 @@ class TestERP5Catalog(ERP5TypeTestCase): ...@@ -493,10 +493,19 @@ class TestERP5Catalog(ERP5TypeTestCase):
# portal_catalog.getObject should return None if the UID parameters # portal_catalog.getObject should return None if the UID parameters
# is a string # is a string
portal_catalog = self.getCatalogTool() portal_catalog = self.getCatalogTool()
try: self.assertRaises(ValueError, portal_catalog.getObject, "StringUID")
result_object = portal_catalog.getObject("StringUID")
except ValueError: def test_16_newUid(self, quiet=0, run=run_all_test):
# This is the expected result if not run: return
pass if not quiet:
else: message = 'newUid'
self.failUnless(0) ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
# newUid should not assign the same uid
portal_catalog = self.getCatalogTool()
from Products.ZSQLCatalog.SQLCatalog import UID_BUFFER_SIZE
uid_dict = {}
for i in xrange(UID_BUFFER_SIZE * 3):
uid = portal_catalog.newUid()
self.assertFalse(uid in uid_dict)
uid_dict[uid] = None
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