[Zope3-checkins] CVS: Zope3/lib/python/ZODB/tests - testZODB.py:1.5

Jeremy Hylton jeremy@zope.com
Thu, 18 Jul 2002 17:44:10 -0400


Update of /cvs-repository/Zope3/lib/python/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv12519/tests

Modified Files:
	testZODB.py 
Log Message:
Add a test case that verifies the unghosting & modification works right.

Use ZODB.FileStorage.DB() to get a database.













=== Zope3/lib/python/ZODB/tests/testZODB.py 1.4 => 1.5 ===
             os.remove('ZODBTests.fs')
         except:
             pass
-        self._storage = ZODB.FileStorage.FileStorage(
-            'ZODBTests.fs', create=1)
-        self._db = ZODB.DB.DB(self._storage)
+        self._db = ZODB.FileStorage.DB("ZODBTest.fs", create=1)
         get_transaction().begin()
         conn = self._db.open()
         root = conn.root()
@@ -111,8 +109,19 @@
         get_transaction().commit()
         conn.close()
 
+    def checkModifyGhost(self):
+        root = self._db.open().root()
+        o = root["test"][5]
+        o._p_deactivate()
+        o.anattr = "anattr"
+        self.assert_(o._p_changed)
+        get_transaction().commit()
+        self.assert_(not o._p_changed)
+        del o._p_changed
+        self.assertEqual(o.anattr, "anattr")
+
     def tearDown(self):
-        self._storage.close()
+        self._db.close()
         for ext in '', '.old', '.tmp', '.lock', '.index':
             path = 'ZODBTests.fs' + ext
             if os.path.exists(path):