[Zope-Checkins] CVS: StandaloneZODB/ZODB/tests - ReadOnlyStorage.py:1.1.2.1 testFileStorage.py:1.13.24.3

Jeremy Hylton jeremy@zope.com
Mon, 7 Jan 2002 18:06:04 -0500


Update of /cvs-repository/StandaloneZODB/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv8431/ZODB/tests

Modified Files:
      Tag: Standby-branch
	testFileStorage.py 
Added Files:
      Tag: Standby-branch
	ReadOnlyStorage.py 
Log Message:
Add a trivial test of ReadOnlyStorage and mix it in to
testFileStorage.

XXX Need more tests here.


=== Added File StandaloneZODB/ZODB/tests/ReadOnlyStorage.py ===
from ZODB.POSException import ReadOnlyError

class ReadOnlyStorage:

    def _create_data(self):
        # test a read-only storage that already has some data
        self.oids = []
        for i in range(10):
            oid = self._storage.new_oid()
            self._dostore(oid)
            self.oids.append(oid)

    def _make_readonly(self):
        self._storage.close()
        self.open(read_only=1)

    def checkNewOid(self):
        self._make_readonly()
        self.assertRaises(ReadOnlyError, self._storage.new_oid)
    



=== StandaloneZODB/ZODB/tests/testFileStorage.py 1.13.24.2 => 1.13.24.3 ===
      Synchronization, ConflictResolution, HistoryStorage, \
      IteratorStorage, Corruption, RevisionStorage, PersistentStorage, \
-     MTStorage
+     MTStorage, ReadOnlyStorage
 
 class FileStorageTests(
     StorageTestBase.StorageTestBase,
@@ -22,7 +22,8 @@
     IteratorStorage.IteratorStorage,
     IteratorStorage.ExtendedIteratorStorage,
     PersistentStorage.PersistentStorage,
-    MTStorage.MTStorage
+    MTStorage.MTStorage,
+    ReadOnlyStorage.ReadOnlyStorage
     ):
 
     def open(self, **kwargs):