[Zope-Checkins] CVS: ZODB3/ZODB/tests - StorageTestBase.py:1.19
Barry Warsaw
barry@wooz.org
Fri, 15 Nov 2002 12:34:24 -0500
Update of /cvs-repository/ZODB3/ZODB/tests
In directory cvs.zope.org:/tmp/cvs-serv3716
Modified Files:
StorageTestBase.py
Log Message:
_undo(), _commitVersion(), _abortVersion(): Helpers ported from the
zodb3-release branch.
=== ZODB3/ZODB/tests/StorageTestBase.py 1.18 => 1.19 ===
--- ZODB3/ZODB/tests/StorageTestBase.py:1.18 Wed Oct 30 16:20:05 2002
+++ ZODB3/ZODB/tests/StorageTestBase.py Fri Nov 15 12:34:23 2002
@@ -180,3 +180,36 @@
def _dostoreNP(self, oid=None, revid=None, data=None, version=None,
user=None, description=None):
return self._dostore(oid, revid, data, version, already_pickled=1)
+
+ # The following methods depend on optional storage features.
+
+ def _undo(self, tid, oid):
+ # Undo a tid that affects a single object (oid).
+ # XXX This is very specialized
+ t = Transaction()
+ t.note("undo")
+ self._storage.tpc_begin(t)
+ oids = self._storage.transactionalUndo(tid, t)
+ self._storage.tpc_vote(t)
+ self._storage.tpc_finish(t)
+ self.assertEqual(len(oids), 1)
+ self.assertEqual(oids[0], oid)
+ return self._storage.lastTransaction()
+
+ def _commitVersion(self, src, dst):
+ t = Transaction()
+ t.note("commit %r to %r" % (src, dst))
+ self._storage.tpc_begin(t)
+ oids = self._storage.commitVersion(src, dst, t)
+ self._storage.tpc_vote(t)
+ self._storage.tpc_finish(t)
+ return oids
+
+ def _abortVersion(self, ver):
+ t = Transaction()
+ t.note("abort %r" % ver)
+ self._storage.tpc_begin(t)
+ oids = self._storage.abortVersion(ver, t)
+ self._storage.tpc_vote(t)
+ self._storage.tpc_finish(t)
+ return oids