[Zodb-checkins] CVS: ZODB3/ZODB/tests - testFileStorage.py:1.29

Jeremy Hylton jeremy@zope.com
Mon, 17 Mar 2003 14:26:10 -0500


Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv16239/tests

Modified Files:
	testFileStorage.py 
Log Message:
Fix use of RecordIterator() in fsrecover and add trivial test case.


=== ZODB3/ZODB/tests/testFileStorage.py 1.28 => 1.29 ===
--- ZODB3/ZODB/tests/testFileStorage.py:1.28	Mon Mar 17 13:59:02 2003
+++ ZODB3/ZODB/tests/testFileStorage.py	Mon Mar 17 14:26:09 2003
@@ -16,8 +16,11 @@
 import ZODB.FileStorage
 import sys, os, unittest
 import errno
+import filecmp
+import StringIO
 from ZODB.Transaction import Transaction
 from ZODB import POSException
+from ZODB.fsrecover import recover
 
 from ZODB.tests import StorageTestBase, BasicStorage, \
      TransactionalUndoStorage, VersionStorage, \
@@ -166,6 +169,25 @@
             self._dostore()
 
         self.failUnless(self._storage._records_before_save > 20)
+
+    def checkfsrecover(self):
+        # an absolutely minimal test of fsrecover
+        # Verify that calling recover on a small, correct storage
+        # produces a duplicate of the original.
+        for i in range(5):
+            oid = self._storage.new_oid()
+            revid = None
+            for j in range(5):
+                revid = self._dostore(oid, revid=revid)
+        
+        temp = sys.stdout
+        sys.stdout = StringIO.StringIO()
+        try:
+            recover(["", "FileStorageTests.fs", "fsrecover.fs"])
+        finally:
+            sys.stdout = temp
+        self.assert_(filecmp.cmp("FileStorageTests.fs", "fsrecover.fs"))
+        StorageTestBase.removefs("fsrecover.fs")
 
     def checkPackVersionsInPast(self):
         # FileStorage can't cope with backpointers to objects