[Zodb-checkins] CVS: StandaloneZODB/ZODB/tests - testFileStorage.py:1.14.4.3

Jeremy Hylton jeremy@zope.com
Thu, 24 Jan 2002 18:39:13 -0500


Update of /cvs-repository/StandaloneZODB/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv14721/tests

Modified Files:
      Tag: Recovery
	testFileStorage.py 
Log Message:
More thorough test of storage results for recover() of abortVersion().

This test fails without the most recent checkin to FileStorage (rev 1.77.4.8).




=== StandaloneZODB/ZODB/tests/testFileStorage.py 1.14.4.2 => 1.14.4.3 ===
+
 import ZODB.FileStorage
 import sys, os, unittest
 import errno
@@ -99,11 +101,24 @@
         # Now abort the version and the creation
         t = Transaction()
         self._storage.tpc_begin(t)
-        self._storage.abortVersion('one', t)
+        oids = self._storage.abortVersion('one', t)
         self._storage.tpc_vote(t)
         self._storage.tpc_finish(t)
+        self.assertEqual(oids, [oid])
         self._dst.copyTransactionsFrom(self._storage)
         self.compare(self._storage, self._dst)
+        # Also make sure the the last transaction has a data record
+        # with None for its data attribute, because we've undone the
+        # object.
+        for s in self._storage, self._dst:
+            iter = s.iterator()
+            for trans in iter:
+                pass # iterate until we get the last one
+            data = trans[0]
+            self.assertRaises(IndexError, lambda i:trans[i], 1)
+            self.assertEqual(data.oid, oid)
+            self.assertEqual(data.data, None)
+                
 
 def test_suite():
     suite = unittest.makeSuite(FileStorageTests, 'check')