Commit e62c31b4 authored by Vincent Pelletier's avatar Vincent Pelletier

Do not raise ProtocolError, so error reaches app.

Also, don't expect setTransactionFinished/setTransactionVoted to be called.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2522 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent be9fdaa2
......@@ -168,7 +168,7 @@ class PrimaryAnswersHandler(AnswerBaseHandler):
def answerTransactionFinished(self, conn, tid):
if tid != self.app.getTID():
raise ProtocolError('Wrong TID, transaction not started')
raise NEOStorageError('Wrong TID, transaction not started')
def answerPack(self, conn, status):
if not status:
......
......@@ -93,7 +93,7 @@ class StorageAnswersHandler(AnswerBaseHandler):
def answerStoreTransaction(self, conn, tid):
if tid != self.app.getTID():
raise ProtocolError('Wrong TID, transaction not started')
raise NEOStorageError('Wrong TID, transaction not started')
def answerTransactionInformation(self, conn, tid,
user, desc, ext, packed, oid_list):
......
......@@ -247,14 +247,13 @@ class MasterAnswersHandlerTests(MasterHandlerTests):
tid2 = self.getNextTID(tid1)
# wrong TID
self.app = Mock({'getTID': tid1})
self.checkProtocolErrorRaised(self.handler.answerTransactionFinished,
self.assertRaises(NEOStorageError,
self.handler.answerTransactionFinished,
conn, tid2)
# matching TID
app = Mock({'getTID': tid2})
handler = PrimaryAnswersHandler(app=app)
handler.answerTransactionFinished(conn, tid2)
calls = app.mockGetNamedCalls('setTransactionFinished')
self.assertEqual(len(calls), 1)
def test_answerPack(self):
self.assertRaises(NEOStorageError, self.handler.answerPack, None, False)
......
......@@ -182,14 +182,13 @@ class StorageAnswerHandlerTests(NeoUnitTestBase):
# wrong tid
app = Mock({'getTID': tid1})
handler = StorageAnswersHandler(app=app)
self.checkProtocolErrorRaised(handler.answerStoreTransaction, conn,
self.assertRaises(NEOStorageError,
handler.answerStoreTransaction, conn,
tid2)
# good tid
app = Mock({'getTID': tid2})
handler = StorageAnswersHandler(app=app)
handler.answerStoreTransaction(conn, tid2)
calls = app.mockGetNamedCalls('setTransactionVoted')
self.assertEqual(len(calls), 1)
def test_answerTransactionInformation(self):
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