[Zope-CVS] CVS: Products/QueueCatalog/tests -
test_QueueCatalog.py:1.3
Christian Theune
ct at gocept.com
Fri Nov 19 05:34:11 EST 2004
Update of /cvs-repository/Products/QueueCatalog/tests
In directory cvs.zope.org:/tmp/cvs-serv6546/tests
Modified Files:
test_QueueCatalog.py
Log Message:
- A little refactoring that allows to have smaller updates when using
the immediate_removal feature. Size of the updates is determined by the
amount of buckets and the collision rate of the hash. Best case: You only
udpate the REMOVED event. At least you don't have to run through the complete queue
when deleting, renaming or adding AT objects.
=== Products/QueueCatalog/tests/test_QueueCatalog.py 1.2 => 1.3 ===
--- Products/QueueCatalog/tests/test_QueueCatalog.py:1.2 Thu Nov 6 17:11:52 2003
+++ Products/QueueCatalog/tests/test_QueueCatalog.py Fri Nov 19 05:34:10 2004
@@ -114,6 +114,26 @@
ZCatalog.uidForObject = stupidUidMaker # monkey patch
self.assertEqual(self.app.queue_cat.uidForObject(None), '/stupid/uid')
+ def testImmediateDeletion(self):
+ app = self.app
+ app.test_cat = QueueCatalog(1000) # 1000 buckets. I don't want collisions here.
+ app.test_cat.id = 'test_cat'
+ app.test_cat.manage_edit(location='/real_cat',
+ immediate_indexes=['id'], immediate_removal=1)
+ for n in range(20):
+ f = Folder()
+ f.id = 'f%d' % n
+ setattr(app, f.id, f)
+ f = getattr(app, f.id)
+ app.test_cat.catalog_object(f)
+ self.assertEqual(app.test_cat.manage_size(), 20)
+ # "Delete" one. This should be processed immediately (including the add-event)
+ app.test_cat.uncatalog_object(getattr(app, 'f1').getPhysicalPath())
+ self.assertEqual(app.test_cat.manage_size(), 19)
+ del app.test_cat
+
+
+
# Enable this test when DemoStorage supports conflict resolution.
## def testSimpleConflict(self):
More information about the Zope-CVS
mailing list