[Neo-report] r2522 vincent - in /trunk/neo: client/handlers/ tests/client/
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Dec 13 14:21:25 CET 2010
Author: vincent
Date: Mon Dec 13 14:21:25 2010
New Revision: 2522
Log:
Do not raise ProtocolError, so error reaches app.
Also, don't expect setTransactionFinished/setTransactionVoted to be called.
Modified:
trunk/neo/client/handlers/master.py
trunk/neo/client/handlers/storage.py
trunk/neo/tests/client/testMasterHandler.py
trunk/neo/tests/client/testStorageHandler.py
Modified: trunk/neo/client/handlers/master.py
==============================================================================
--- trunk/neo/client/handlers/master.py [iso-8859-1] (original)
+++ trunk/neo/client/handlers/master.py [iso-8859-1] Mon Dec 13 14:21:25 2010
@@ -168,7 +168,7 @@ class PrimaryAnswersHandler(AnswerBaseHa
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:
Modified: trunk/neo/client/handlers/storage.py
==============================================================================
--- trunk/neo/client/handlers/storage.py [iso-8859-1] (original)
+++ trunk/neo/client/handlers/storage.py [iso-8859-1] Mon Dec 13 14:21:25 2010
@@ -93,7 +93,7 @@ class StorageAnswersHandler(AnswerBaseHa
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):
Modified: trunk/neo/tests/client/testMasterHandler.py
==============================================================================
--- trunk/neo/tests/client/testMasterHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/client/testMasterHandler.py [iso-8859-1] Mon Dec 13 14:21:25 2010
@@ -247,14 +247,13 @@ class MasterAnswersHandlerTests(MasterHa
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)
Modified: trunk/neo/tests/client/testStorageHandler.py
==============================================================================
--- trunk/neo/tests/client/testStorageHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/client/testStorageHandler.py [iso-8859-1] Mon Dec 13 14:21:25 2010
@@ -182,14 +182,13 @@ class StorageAnswerHandlerTests(NeoUnitT
# 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()
More information about the Neo-report
mailing list