Commit 1f2d5546 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 f1ee7322
......@@ -26,14 +26,36 @@ class BasicStorage:
POSException.StorageTransactionError,
self._storage.store,
0, 0, 0, 0, Transaction())
self.assertRaises(
POSException.StorageTransactionError,
self._storage.abortVersion,
0, Transaction())
self.assertRaises(
POSException.StorageTransactionError,
self._storage.commitVersion,
0, 1, Transaction())
#JF# The following will fail two ways. UnitTest doesn't
#JF# help us here:
#JF# self.assertRaises(
#JF# POSException.StorageTransactionError,
#JF# self._storage.abortVersion,
#JF# 0, 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(
POSException.StorageTransactionError,
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