[Zodb-checkins] CVS: Packages/bsddb3Storage - test_create.py:1.8

barry@digicool.com barry@digicool.com
Fri, 29 Jun 2001 03:18:57 -0400 (EDT)


Update of /cvs-repository/Packages/bsddb3Storage/bsddb3Storage/tests
In directory korak.digicool.com:/tmp/cvs-serv22695

Modified Files:
	test_create.py 
Log Message:
FullOpenExistingTest(): Two new tests to tickle a bug when opening a
database that had existing versions.  Bug (typo really) fixed in v1.28
of Full.py.



--- Updated File test_create.py in package Packages/bsddb3Storage --
--- test_create.py	2001/04/11 22:14:19	1.7
+++ test_create.py	2001/06/29 07:18:57	1.8
@@ -24,10 +24,43 @@
 
 
 
+class FullOpenExistingTest(BerkeleyTestBase.BerkeleyTestBase,
+                           BerkeleyTestBase.FullTestBase):
+    def checkOpenWithExistingVersions(self):
+        version = 'test-version'
+        oid = self._storage.new_oid()
+        revid = self._dostore(oid, data=7, version=version)
+        # Now close the current storage and re-open it
+        self._storage.close()
+        self._storage = self.ConcreteStorage(BerkeleyTestBase.DBHOME)
+        assert self._storage.modifiedInVersion(oid) == version
+
+    def checkOpenAddVersion(self):
+        version1 = 'test-version'
+        oid1 = self._storage.new_oid()
+        revid = self._dostore(oid1, data=7, version=version1)
+        # Now close the current storage and re-open it
+        self._storage.close()
+        self._storage = self.ConcreteStorage(BerkeleyTestBase.DBHOME)
+        assert self._storage.modifiedInVersion(oid1) == version1
+        # Now create a 2nd version string, then close/reopen
+        version2 = 'new-version'
+        oid2 = self._storage.new_oid()
+        revid = self._dostore(oid2, data=8, version=version2)
+        # Now close the current storage and re-open it
+        self._storage.close()
+        self._storage = self.ConcreteStorage(BerkeleyTestBase.DBHOME)
+        assert self._storage.modifiedInVersion(oid1) == version1
+        # Now create a 2nd version string, then close/reopen
+        assert self._storage.modifiedInVersion(oid2) == version2
+
+
+
 def suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(MinimalCreateTest, 'check'))
     suite.addTest(unittest.makeSuite(FullCreateTest, 'check'))
+    suite.addTest(unittest.makeSuite(FullOpenExistingTest, 'check'))
     return suite