Commit 4d395a45 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Remove checkCalledAbort method from tests since it's no more used because abort

is now mainly called from neo/handler.py


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@514 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 3b6b372b
......@@ -212,21 +212,6 @@ server: 127.0.0.1:10023
self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(),ASK_PRIMARY_MASTER)
def checkCalledAbort(self, conn, packet_number=0):
"""Check the abort method has been called and an error packet has been sent"""
# sometimes we answer an error, sometimes we just notify it
notify_calls_len = len(conn.mockGetNamedCalls("notify"))
answer_calls_len = len(conn.mockGetNamedCalls('answer'))
self.assertEquals(notify_calls_len + answer_calls_len, 1)
self.assertEquals(len(conn.mockGetNamedCalls("abort")), 1)
if notify_calls_len == 1:
call = conn.mockGetNamedCalls("notify")[packet_number]
else:
call = conn.mockGetNamedCalls("answer")[packet_number]
packet = call.getParam(0)
self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(), ERROR)
def checkCalledAnswerPrimaryMaster(self, conn, packet_number=0):
""" Check Answer primaty master message has been send"""
call = conn.mockGetNamedCalls("answer")[packet_number]
......
......@@ -191,20 +191,6 @@ server: 127.0.0.1:10023
self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(),ASK_PRIMARY_MASTER)
def checkCalledAbort(self, conn, packet_number=0):
"""Check the abort method has been called and an error packet has been sent"""
notify_calls_len = len(conn.mockGetNamedCalls("notify"))
answer_calls_len = len(conn.mockGetNamedCalls('answer'))
self.assertEquals(notify_calls_len + answer_calls_len, 1)
self.assertEquals(len(conn.mockGetNamedCalls("abort")), 1)
if notify_calls_len == 1:
call = conn.mockGetNamedCalls("notify")[packet_number]
else:
call = conn.mockGetNamedCalls("answer")[packet_number]
packet = call.getParam(0)
self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(), ERROR)
def checkCalledNotifyNodeInformation(self, conn, packet_number=0):
""" Check Notify Node Information message has been send"""
call = conn.mockGetNamedCalls("notify")[packet_number]
......
......@@ -133,20 +133,6 @@ server: 127.0.0.1:10023
self.assertRaises(protocol.BrokenNodeDisallowedError, method, *args, **kwargs)
# Method to test the kind of packet returned in answer
def checkCalledAbort(self, conn, packet_number=0):
"""Check the abort method has been called and an error packet has been sent"""
# sometimes we answer an error, sometimes we just notify it
notify_calls_len = len(conn.mockGetNamedCalls("notify"))
answer_calls_len = len(conn.mockGetNamedCalls('answer'))
self.assertEquals(len(conn.mockGetNamedCalls("abort")), 1)
if notify_calls_len == 1:
call = conn.mockGetNamedCalls("notify")[packet_number]
else:
call = conn.mockGetNamedCalls("answer")[packet_number]
packet = call.getParam(0)
self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(), ERROR)
def checkCalledAcceptNodeIdentification(self, conn, packet_number=0):
""" Check Accept Node Identification has been send"""
self.assertEquals(len(conn.mockGetNamedCalls("answer")), 1)
......
......@@ -195,21 +195,6 @@ server: 127.0.0.1:10023
self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(),ASK_PRIMARY_MASTER)
def checkCalledAbort(self, conn, packet_number=0):
"""Check the abort method has been called and an error packet has been sent"""
# sometimes we answer an error, sometimes we just send it
notify_calls_len = len(conn.mockGetNamedCalls("notify"))
answer_calls_len = len(conn.mockGetNamedCalls('answer'))
self.assertEquals(notify_calls_len + answer_calls_len, 1)
self.assertEquals(len(conn.mockGetNamedCalls("abort")), 1)
if notify_calls_len == 1:
call = conn.mockGetNamedCalls("notify")[packet_number]
else:
call = conn.mockGetNamedCalls("answer")[packet_number]
packet = call.getParam(0)
self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(), ERROR)
def checkCalledNotifyNodeInformation(self, conn, packet_number=0):
""" Check Notify Node Information message has been send"""
call = conn.mockGetNamedCalls("notify")[packet_number]
......
......@@ -140,22 +140,6 @@ server: 127.0.0.1:10020
self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(), REQUEST_NODE_IDENTIFICATION)
def checkCalledAbort(self, conn, packet_number=0):
"""Check the abort method has been called and an error packet has been sent"""
# sometimes we answer an error, sometimes we just notify it
notify_calls_len = len(conn.mockGetNamedCalls("notify"))
answer_calls_len = len(conn.mockGetNamedCalls('answer'))
self.assertEquals(notify_calls_len + answer_calls_len, 1)
self.assertEquals(len(conn.mockGetNamedCalls("abort")), 1)
self.assertEquals(len(conn.mockGetNamedCalls("expectMessage")), 0)
if notify_calls_len == 1:
call = conn.mockGetNamedCalls("notify")[packet_number]
else:
call = conn.mockGetNamedCalls("answer")[packet_number]
packet = call.getParam(0)
self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(), ERROR)
def checkNoPacketSent(self, conn):
# no packet should be sent
self.assertEquals(len(conn.mockGetNamedCalls('addPacket')), 0)
......@@ -369,6 +353,7 @@ server: 127.0.0.1:10020
self.assertEquals(len(conn.mockGetNamedCalls("setUUID")), 1)
call = conn.mockGetNamedCalls("setUUID")[0]
self.assertEquals(call.getParam(0), uuid)
self.assertEquals(len(conn.mockGetNamedCalls("abort")), 1)
def test_08_handleRequestNodeIdentification5(self):
# broken node -> rejected
......
......@@ -71,22 +71,6 @@ class StorageOperationTests(unittest.TestCase):
""" Check if the NotReadyError exception wxas raised """
self.assertRaises(protocol.NotReadyError, method, *args, **kwargs)
def checkCalledAbort(self, conn, packet_number=0):
"""Check the abort method has been called and an error packet has been sent"""
# sometimes we answer an error, sometimes we just send it
notify_calls_len = len(conn.mockGetNamedCalls("notify"))
answer_calls_len = len(conn.mockGetNamedCalls('answer'))
self.assertEquals(notify_calls_len + answer_calls_len, 1)
self.assertEquals(len(conn.mockGetNamedCalls("abort")), 1)
self.assertEquals(len(conn.mockGetNamedCalls("expectMessage")), 0)
if notify_calls_len == 1:
call = conn.mockGetNamedCalls("notify")[packet_number]
else:
call = conn.mockGetNamedCalls("answer")[packet_number]
packet = call.getParam(0)
self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(), ERROR)
def checkPacket(self, conn, packet_type=ERROR):
self.assertEquals(len(conn.mockGetNamedCalls("answer")), 1)
call = conn.mockGetNamedCalls("answer")[0]
......
......@@ -147,22 +147,6 @@ server: 127.0.0.1:10020
""" Check if the NotReadyError exception wxas raised """
self.assertRaises(protocol.NotReadyError, method, *args, **kwargs)
def checkCalledAbort(self, conn, packet_number=0):
"""Check the abort method has been called and an error packet has been sent"""
# sometimes we answer an error, sometimes we just notify it
notify_calls_len = len(conn.mockGetNamedCalls("notify"))
answer_calls_len = len(conn.mockGetNamedCalls('answer'))
self.assertEquals(notify_calls_len + answer_calls_len, 1)
self.assertEquals(len(conn.mockGetNamedCalls("abort")), 1)
self.assertEquals(len(conn.mockGetNamedCalls("expectMessage")), 0)
if notify_calls_len == 1:
call = conn.mockGetNamedCalls("notify")[packet_number]
else:
call = conn.mockGetNamedCalls("answer")[packet_number]
packet = call.getParam(0)
self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(), ERROR)
# Tests
def test_01_connectionAccepted(self):
uuid = self.getNewUUID()
......
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