[Zope-CVS] CVS: Products/Ape/lib/apelib/tests - testzope2fs.py:1.8

Shane Hathaway shane at zope.com
Wed Mar 17 20:05:12 EST 2004


Update of /cvs-repository/Products/Ape/lib/apelib/tests
In directory cvs.zope.org:/tmp/cvs-serv8002/tests

Modified Files:
	testzope2fs.py 
Log Message:
Don't loop forever on unlinked OIDs, and start with an empty database.


=== Products/Ape/lib/apelib/tests/testzope2fs.py 1.7 => 1.8 ===
--- Products/Ape/lib/apelib/tests/testzope2fs.py:1.7	Sat Feb 28 15:06:28 2004
+++ Products/Ape/lib/apelib/tests/testzope2fs.py	Wed Mar 17 20:05:12 2004
@@ -716,6 +716,38 @@
         finally:
             conn.close()
 
+    def testStartWithEmptyDatabase(self):
+        # A new database should not have an Application.
+        # Destroy the _root and the annotations at the app root.
+        self.db.close()
+        self.db = None
+        basepath = self.conn.basepath
+        rmtree(basepath)
+        os.mkdir(basepath)
+        self.db, self.conn = self.openDatabase()
+        conn = self.db.open()
+        try:
+            root = conn.root()
+            self.assert_(not root.has_key('Application'))
+        finally:
+            conn.close()
+
+    def testStoreUnlinked(self):
+        # Storing an object not linked to any parents
+        # shouldn't cause problems.
+        conn = self.db.open()
+        try:
+            app = conn.root()['Application']
+            f = Folder()
+            f.id = 'bar'
+            app._setObject(f.id, f)
+            get_transaction().commit(1)
+            app._delObject(f.id)
+            get_transaction().commit()
+        finally:
+            conn.close()
+
+
 
 class Zope2FSUnderscoreTests (Zope2FSTests):
     annotation_prefix = '_'




More information about the Zope-CVS mailing list