[Zope-CVS] CVS: Products/FileCacheManager/tests -
testFileCacheManager.py:1.12
Chris McDonough
chrism at plope.com
Fri Nov 19 01:31:53 EST 2004
Update of /cvs-repository/Products/FileCacheManager/tests
In directory cvs.zope.org:/tmp/cvs-serv14131/tests
Modified Files:
testFileCacheManager.py
Log Message:
Add "entries_being_written" cache to prevent returning of stale data from ZCache_get after a ZCache_set of an already-cached object has been performed.
=== Products/FileCacheManager/tests/testFileCacheManager.py 1.11 => 1.12 ===
--- Products/FileCacheManager/tests/testFileCacheManager.py:1.11 Sun Aug 29 16:50:30 2004
+++ Products/FileCacheManager/tests/testFileCacheManager.py Fri Nov 19 01:31:52 2004
@@ -170,6 +170,31 @@
# the file should *still be there*
self.failUnless(os.path.exists(fpath))
+ def testWriteEntryInProgressReturnsTempfileData(self):
+ for ob in self.all_files:
+ self.FC.ZCache_set(ob)
+ self.assertEqual(self.FC.ZCache_get(ob).read(), ob.data)
+ ob.old_data = ob.data
+ ob.data = 'floogle'
+ self.FC.ZCache_set(ob)
+ self.failUnless(self.FC.get_entries_being_written())
+ self.assertEqual(self.FC.ZCache_get(ob).read(), 'floogle')
+ get_transaction().abort()
+ ob.data = ob.old_data
+ self.failIf(self.FC.get_entries_being_written())
+
+ for ob in self.all_files:
+ self.FC.ZCache_set(ob)
+ self.assertEqual(self.FC.ZCache_get(ob).read(), ob.data)
+ ob.old_data = ob.data
+ ob.data = 'floogle'
+ self.FC.ZCache_set(ob)
+ self.failUnless(self.FC.get_entries_being_written())
+ self.assertEqual(self.FC.ZCache_get(ob).read(), 'floogle')
+ get_transaction().commit()
+ ob.data = ob.old_data
+ self.failIf(self.FC.get_entries_being_written())
+
def test_values(self):
self.assertEqual(self.FC.entries, {})
for ob in self.all_files:
More information about the Zope-CVS
mailing list