Commit 98fff341 authored by Vincent Pelletier's avatar Vincent Pelletier

Fix and extend askStoreObject tests.

tm.storeObject is not supposed to return a callable.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2269 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f5ea66c0
...@@ -219,7 +219,11 @@ class StorageClientHandlerTests(NeoTestBase): ...@@ -219,7 +219,11 @@ class StorageClientHandlerTests(NeoTestBase):
data, tid) data, tid)
self._checkStoreObjectCalled(tid, serial, oid, comp, self._checkStoreObjectCalled(tid, serial, oid, comp,
checksum, data, None) checksum, data, None)
self.checkAnswerStoreObject(conn) pconflicting, poid, pserial = self.checkAnswerStoreObject(conn,
decode=True)
self.assertEqual(pconflicting, 0)
self.assertEqual(poid, oid)
self.assertEqual(pserial, serial)
def test_askStoreObject2(self): def test_askStoreObject2(self):
# conflict error # conflict error
...@@ -229,11 +233,15 @@ class StorageClientHandlerTests(NeoTestBase): ...@@ -229,11 +233,15 @@ class StorageClientHandlerTests(NeoTestBase):
locking_tid = self.getNextTID(tid) locking_tid = self.getNextTID(tid)
def fakeStoreObject(*args): def fakeStoreObject(*args):
raise ConflictError(locking_tid) raise ConflictError(locking_tid)
self.app.tm.storeObject = lambda *kw: fakeStoreObject self.app.tm.storeObject = fakeStoreObject
oid, serial, comp, checksum, data = self._getObject() oid, serial, comp, checksum, data = self._getObject()
self.operation.askStoreObject(conn, oid, serial, comp, checksum, self.operation.askStoreObject(conn, oid, serial, comp, checksum,
data, tid) data, tid)
self.checkAnswerStoreObject(conn) pconflicting, poid, pserial = self.checkAnswerStoreObject(conn,
decode=True)
self.assertEqual(pconflicting, 1)
self.assertEqual(poid, oid)
self.assertEqual(pserial, locking_tid)
def test_abortTransaction(self): def test_abortTransaction(self):
conn = self._getConnection() conn = self._getConnection()
......
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