Commit 22f00fe1 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Fix tests with _addPacket instead of addPacket.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@516 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 421d5c65
......@@ -158,7 +158,7 @@ class ClientApplicationTest(unittest.TestCase):
self.assertTrue(calls[0].getParam(0) is conn)
self.assertEquals(calls[0].getParam(2), app.local_var.queue)
def checkPacketSent(self, conn, packet_type, method='addPacket'):
def checkPacketSent(self, conn, packet_type, method='_addPacket'):
calls = conn.mockGetNamedCalls(method)
self.assertEquals(len(calls), 1)
packet = calls[0].getParam(0)
......@@ -202,7 +202,7 @@ class ClientApplicationTest(unittest.TestCase):
test_msg_id = 50
test_oid_list = ['\x00\x00\x00\x00\x00\x00\x00\x01', '\x00\x00\x00\x00\x00\x00\x00\x02']
response_packet = protocol.answerNewOIDs(test_oid_list[:])
app.master_conn = Mock({'getNextId': test_msg_id, 'addPacket': None,
app.master_conn = Mock({'getNextId': test_msg_id, '_addPacket': None,
'expectMessage': None, 'lock': None,
'unlock': None,
# Test-specific method
......@@ -271,7 +271,7 @@ class ClientApplicationTest(unittest.TestCase):
app.cp = Mock({ 'getConnForNode' : conn})
result = app.load(oid)
self.assertEquals(result, ('', tid1))
self.assertEquals(len(conn.mockGetNamedCalls('addPacket')), 0)
self.assertEquals(len(conn.mockGetNamedCalls('_addPacket')), 0)
def test_loadSerial(self):
app = self.getApp()
......
......@@ -60,7 +60,7 @@ class BaseClientEventHandlerTest(unittest.TestCase):
def getConnection(self, uuid=None, port=10010, next_id=None, ip='127.0.0.1'):
if uuid is None:
uuid = self.getUUID()
return Mock({'addPacket': None,
return Mock({'_addPacket': None,
'getUUID': uuid,
'getAddress': (ip, port),
'getNextId': next_id,
......@@ -77,7 +77,7 @@ class ClientEventHandlerTest(unittest.TestCase):
def getConnection(self, uuid=None, port=10010, next_id=None, ip='127.0.0.1'):
if uuid is None:
uuid = self.getUUID()
return Mock({'addPacket': None,
return Mock({'_addPacket': None,
'getUUID': uuid,
'getAddress': (ip, port),
'getNextId': next_id,
......@@ -138,7 +138,7 @@ class ClientEventHandlerTest(unittest.TestCase):
nm = Mock({'getNodeByServer': fake_storage_node})
cp = Mock({'removeConnection': None})
master_conn = Mock({
'addPacket': None,
'_addPacket': None,
'getUUID': self.getUUID(),
'getAddress': ('127.0.0.1', 10010),
'getNextId': master_node_next_packet_id,
......
......@@ -160,7 +160,7 @@ server: 127.0.0.1:10023
c_node = ClientNode(uuid = self.getNewUUID())
self.app.broadcastNodeInformation(c_node)
# check conn
self.assertEquals(len(client_conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(client_conn.mockGetNamedCalls("_addPacket")), 0)
self.assertEquals(len(master_conn.mockGetNamedCalls("notify")), 1)
call = master_conn.mockGetNamedCalls("notify")[0]
packet = call.getParam(0)
......@@ -180,7 +180,7 @@ server: 127.0.0.1:10023
s_node = ClientNode(uuid = self.getNewUUID(), server=("127.1.0.1", 3361))
self.app.broadcastNodeInformation(c_node)
# check conn
self.assertEquals(len(client_conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(client_conn.mockGetNamedCalls("_addPacket")), 0)
self.assertEquals(len(master_conn.mockGetNamedCalls("notify")), 1)
call = master_conn.mockGetNamedCalls("notify")[0]
packet = call.getParam(0)
......
......@@ -496,7 +496,7 @@ server: 127.0.0.1:10020
num_replicas=self.app.num_replicas,
**args)
self.assertEquals(len(conn.mockGetNamedCalls("setUUID")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("expectMessage")), 0)
# create a new partition table
self.bootstrap.handleAcceptNodeIdentification(
......@@ -595,7 +595,7 @@ server: 127.0.0.1:10020
self.assertEquals(n.getUUID(), new_master[2])
self.assertEquals(len(conn.mockGetNamedCalls('setHandler')), 0)
self.assertEquals(len(conn.mockGetNamedCalls('close')), 0)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
def test_10_handleAnswerPrimaryMaster03(self):
# invalid primary master uuid -> close connection
......@@ -615,7 +615,7 @@ server: 127.0.0.1:10020
self.assertEquals(self.app.trying_master_node, None)
self.assertEquals(len(conn.mockGetNamedCalls('setHandler')), 0)
self.assertEquals(len(conn.mockGetNamedCalls('close')), 1)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
def test_10_handleAnswerPrimaryMaster04(self):
# trying_master_node is not pmn -> close connection
......@@ -637,7 +637,7 @@ server: 127.0.0.1:10020
self.assertEquals(len(conn.mockGetNamedCalls('setHandler')), 0)
self.assertEquals(len(conn.mockGetNamedCalls('close')), 1)
self.assertEquals(self.app.trying_master_node, None)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
def test_10_handleAnswerPrimaryMaster05(self):
# trying_master_node is pmn -> set verification handler
......@@ -661,7 +661,7 @@ server: 127.0.0.1:10020
self.assertTrue(isinstance(call.getParam(0), VerificationEventHandler))
self.assertEquals(len(conn.mockGetNamedCalls('close')), 0)
self.assertEquals(self.app.trying_master_node, pmn)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
def test_10_handleAnswerPrimaryMaster06(self):
# primary_uuid not known -> nothing happen
......@@ -681,7 +681,7 @@ server: 127.0.0.1:10020
self.assertEquals(self.app.trying_master_node, None)
self.assertEquals(len(conn.mockGetNamedCalls('setHandler')), 0)
self.assertEquals(len(conn.mockGetNamedCalls('close')), 0)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
if __name__ == "__main__":
unittest.main()
......
......@@ -752,7 +752,7 @@ server: 127.0.0.1:10020
serial=INVALID_SERIAL,
tid=INVALID_TID)
self.assertEquals(len(self.app.event_queue), 1)
self.assertEquals(len(conn.mockGetNamedCalls('addPacket')), 0)
self.assertEquals(len(conn.mockGetNamedCalls('_addPacket')), 0)
self.assertEquals(len(self.app.dm.mockGetNamedCalls('getObject')), 0)
def test_24_handleAskObject2(self):
......@@ -918,7 +918,7 @@ server: 127.0.0.1:10020
self.assertEquals(len(self.app.event_queue), 1)
t_after = self.app.transaction_dict.items()[:]
self.assertEquals(t_before, t_after)
self.assertEquals(len(conn.mockGetNamedCalls('addPacket')), 0)
self.assertEquals(len(conn.mockGetNamedCalls('_addPacket')), 0)
self.assertTrue(oid in self.app.store_lock_dict)
def test_28_handleAskStoreObject3(self):
......
......@@ -154,7 +154,7 @@ server: 127.0.0.1:10020
"getAddress" : ("127.0.0.1", self.client_port)})
self.verification.connectionAccepted(conn, None, ("127.0.0.1", self.client_port))
# nothing happens
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
def test_02_timeoutExpired(self):
# listening connection
......@@ -164,7 +164,7 @@ server: 127.0.0.1:10020
"isServerConnection" : True})
self.verification.timeoutExpired(conn)
# nothing happens
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
# client connection
uuid = self.getNewUUID()
......@@ -173,7 +173,7 @@ server: 127.0.0.1:10020
"isServerConnection" : False})
self.assertRaises(PrimaryFailure, self.verification.timeoutExpired, conn,)
# nothing happens
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
def test_03_connectionClosed(self):
# listening connection
......@@ -183,7 +183,7 @@ server: 127.0.0.1:10020
"isServerConnection" : True})
self.verification.connectionClosed(conn)
# nothing happens
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
# client connection
uuid = self.getNewUUID()
......@@ -192,7 +192,7 @@ server: 127.0.0.1:10020
"isServerConnection" : False})
self.assertRaises(PrimaryFailure, self.verification.connectionClosed, conn,)
# nothing happens
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
def test_04_peerBroken(self):
......@@ -203,7 +203,7 @@ server: 127.0.0.1:10020
"isServerConnection" : True})
self.verification.peerBroken(conn)
# nothing happens
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
# client connection
uuid = self.getNewUUID()
......@@ -212,7 +212,7 @@ server: 127.0.0.1:10020
"isServerConnection" : False})
self.assertRaises(PrimaryFailure, self.verification.peerBroken, conn,)
# nothing happens
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
def test_05_handleRequestNodeIdentification(self):
......
......@@ -445,7 +445,7 @@ class testConnection(unittest.TestCase):
# self.assertNotEqual(bc.getConnector(), None)
# import pdb
# pdb.set_trace()
# bc.addPacket(p)
# bc._addPacket(p)
# self.assertNotEqual(bc.write_buf, "testdata")
# self.assertRaises(ProtocolError, p.encode)
# self.assertEquals(len(em.mockGetNamedCalls("addWriter")), 2)
......
......@@ -148,7 +148,7 @@ class testEvent(unittest.TestCase):
self.assertEquals(len(conn.mockGetNamedCalls("close")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("unlock")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("expectMessage")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
self.assertEquals(len(handler.mockGetNamedCalls("timeoutExpired")), 0)
# call with time < t < critical_time
......@@ -204,7 +204,7 @@ class testEvent(unittest.TestCase):
self.assertEquals(len(conn.mockGetNamedCalls("close")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("unlock")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("expectMessage")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
self.assertEquals(len(handler.mockGetNamedCalls("timeoutExpired")), 0)
# call with time < t < critical_time
......@@ -217,7 +217,7 @@ class testEvent(unittest.TestCase):
self.assertEquals(len(conn.mockGetNamedCalls("close")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("unlock")), 1)
self.assertEquals(len(conn.mockGetNamedCalls("expectMessage")), 1)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
self.assertEquals(len(handler.mockGetNamedCalls("timeoutExpired")), 0)
# call with time < critical_time < t
......@@ -230,7 +230,7 @@ class testEvent(unittest.TestCase):
self.assertEquals(len(conn.mockGetNamedCalls("close")), 1)
self.assertEquals(len(conn.mockGetNamedCalls("unlock")), 2)
self.assertEquals(len(conn.mockGetNamedCalls("expectMessage")), 1)
self.assertEquals(len(conn.mockGetNamedCalls("addPacket")), 0)
self.assertEquals(len(conn.mockGetNamedCalls("_addPacket")), 0)
self.assertEquals(len(handler.mockGetNamedCalls("timeoutExpired")), 1)
......
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