[Zope-Checkins] CVS: ZODB3/ZConfig/tests - testStorage.py:1.3

Barry Warsaw barry@wooz.org
Fri, 22 Nov 2002 15:08:31 -0500


Update of /cvs-repository/ZODB3/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv24010

Modified Files:
	testStorage.py 
Log Message:
testFullStorage(): test that StorageTypes supports Berkeley Full
storage.


=== ZODB3/ZConfig/tests/testStorage.py 1.2 => 1.3 ===
--- ZODB3/ZConfig/tests/testStorage.py:1.2	Fri Nov 22 13:03:40 2002
+++ ZODB3/ZConfig/tests/testStorage.py	Fri Nov 22 15:08:31 2002
@@ -96,6 +96,33 @@
         self.storage = Storage.createStorage(storageconf)
         self.assert_(isinstance(self.storage, DemoStorage))
 
+    def testFullStorage(self):
+        try:
+            from bsddb3Storage.Full import Full
+        except ImportError:
+            print 'ImportError'
+            return
+        sample = """
+        <Storage>
+        type       Full
+        name       %s
+        cachesize  1000
+        </Storage>
+        """ % self.tmpfn
+        os.mkdir(self.tmpfn)
+        io = StringIO(sample)
+        rootconf = ZConfig.loadfile(io)
+        storageconf = rootconf.getSection("Storage")
+        cls, args = Storage.getStorageInfo(storageconf)
+        self.assertEqual(cls, Full)
+        args = args.copy()
+        del args['config']
+        self.assertEqual(args, {"name": self.tmpfn})
+        self.storage = Storage.createStorage(storageconf)
+        self.assert_(isinstance(self.storage, Full))
+        # XXX _config isn't public
+        self.assert_(self.storage._config.cachesize, 1000)
+
 def test_suite():
     return unittest.makeSuite(StorageTestCase)