Commit 421586d8 authored by Jim Fulton's avatar Jim Fulton

There were some tests that tested for failure, but that didn't

recognize other valid failure modes.
parent 80051d9e
...@@ -26,14 +26,36 @@ class BasicStorage: ...@@ -26,14 +26,36 @@ class BasicStorage:
POSException.StorageTransactionError, POSException.StorageTransactionError,
self._storage.store, self._storage.store,
0, 0, 0, 0, Transaction()) 0, 0, 0, 0, Transaction())
self.assertRaises(
POSException.StorageTransactionError, #JF# The following will fail two ways. UnitTest doesn't
self._storage.abortVersion, #JF# help us here:
0, Transaction()) #JF# self.assertRaises(
self.assertRaises( #JF# POSException.StorageTransactionError,
POSException.StorageTransactionError, #JF# self._storage.abortVersion,
self._storage.commitVersion, #JF# 0, Transaction())
0, 1, Transaction())
#JF# but we can do it another way:
try:
self._storage.abortVersion('dummy', Transaction())
except (POSException.StorageTransactionError,
POSException.VersionCommitError):
pass # test passed ;)
else:
assert 0, "Should have failed, invalid transaction."
#JF# ditto
#JF# self.assertRaises(
#JF# POSException.StorageTransactionError,
#JF# self._storage.commitVersion,
#JF# 0, 1, Transaction())
try:
self._storage.commitVersion('dummy', 'dummer', Transaction())
except (POSException.StorageTransactionError,
POSException.VersionCommitError):
pass # test passed ;)
else:
assert 0, "Should have failed, invalid transaction."
self.assertRaises( self.assertRaises(
POSException.StorageTransactionError, POSException.StorageTransactionError,
self._storage.store, self._storage.store,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment