Commit 82149414 authored by Julien Muchembled's avatar Julien Muchembled

tests: assertEquals -> assertEqual

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2695 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 8b7702b7
...@@ -267,23 +267,23 @@ class NeoUnitTestBase(NeoTestBase): ...@@ -267,23 +267,23 @@ class NeoUnitTestBase(NeoTestBase):
def checkAborted(self, conn): def checkAborted(self, conn):
""" Ensure the connection was aborted """ """ Ensure the connection was aborted """
self.assertEquals(len(conn.mockGetNamedCalls('abort')), 1) self.assertEqual(len(conn.mockGetNamedCalls('abort')), 1)
def checkNotAborted(self, conn): def checkNotAborted(self, conn):
""" Ensure the connection was not aborted """ """ Ensure the connection was not aborted """
self.assertEquals(len(conn.mockGetNamedCalls('abort')), 0) self.assertEqual(len(conn.mockGetNamedCalls('abort')), 0)
def checkClosed(self, conn): def checkClosed(self, conn):
""" Ensure the connection was closed """ """ Ensure the connection was closed """
self.assertEquals(len(conn.mockGetNamedCalls('close')), 1) self.assertEqual(len(conn.mockGetNamedCalls('close')), 1)
def checkNotClosed(self, conn): def checkNotClosed(self, conn):
""" Ensure the connection was not closed """ """ Ensure the connection was not closed """
self.assertEquals(len(conn.mockGetNamedCalls('close')), 0) self.assertEqual(len(conn.mockGetNamedCalls('close')), 0)
def _checkNoPacketSend(self, conn, method_id): def _checkNoPacketSend(self, conn, method_id):
call_list = conn.mockGetNamedCalls(method_id) call_list = conn.mockGetNamedCalls(method_id)
self.assertEquals(len(call_list), 0, call_list) self.assertEqual(len(call_list), 0, call_list)
def checkNoPacketSent(self, conn, check_notify=True, check_answer=True, def checkNoPacketSent(self, conn, check_notify=True, check_answer=True,
check_ask=True): check_ask=True):
...@@ -297,14 +297,14 @@ class NeoUnitTestBase(NeoTestBase): ...@@ -297,14 +297,14 @@ class NeoUnitTestBase(NeoTestBase):
def checkNoUUIDSet(self, conn): def checkNoUUIDSet(self, conn):
""" ensure no UUID was set on the connection """ """ ensure no UUID was set on the connection """
self.assertEquals(len(conn.mockGetNamedCalls('setUUID')), 0) self.assertEqual(len(conn.mockGetNamedCalls('setUUID')), 0)
def checkUUIDSet(self, conn, uuid=None): def checkUUIDSet(self, conn, uuid=None):
""" ensure no UUID was set on the connection """ """ ensure no UUID was set on the connection """
calls = conn.mockGetNamedCalls('setUUID') calls = conn.mockGetNamedCalls('setUUID')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
if uuid is not None: if uuid is not None:
self.assertEquals(calls[0].getParam(0), uuid) self.assertEqual(calls[0].getParam(0), uuid)
# in check(Ask|Answer|Notify)Packet we return the packet so it can be used # in check(Ask|Answer|Notify)Packet we return the packet so it can be used
# in tests if more accurates checks are required # in tests if more accurates checks are required
...@@ -312,10 +312,10 @@ class NeoUnitTestBase(NeoTestBase): ...@@ -312,10 +312,10 @@ class NeoUnitTestBase(NeoTestBase):
def checkErrorPacket(self, conn, decode=False): def checkErrorPacket(self, conn, decode=False):
""" Check if an error packet was answered """ """ Check if an error packet was answered """
calls = conn.mockGetNamedCalls("answer") calls = conn.mockGetNamedCalls("answer")
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
packet = calls[0].getParam(0) packet = calls[0].getParam(0)
self.assertTrue(isinstance(packet, protocol.Packet)) self.assertTrue(isinstance(packet, protocol.Packet))
self.assertEquals(packet.getType(), Packets.Error) self.assertEqual(packet.getType(), Packets.Error)
if decode: if decode:
return packet.decode() return packet.decode()
return protocol.decode_table[packet.getType()](packet._body) return protocol.decode_table[packet.getType()](packet._body)
...@@ -324,10 +324,10 @@ class NeoUnitTestBase(NeoTestBase): ...@@ -324,10 +324,10 @@ class NeoUnitTestBase(NeoTestBase):
def checkAskPacket(self, conn, packet_type, decode=False): def checkAskPacket(self, conn, packet_type, decode=False):
""" Check if an ask-packet with the right type is sent """ """ Check if an ask-packet with the right type is sent """
calls = conn.mockGetNamedCalls('ask') calls = conn.mockGetNamedCalls('ask')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
packet = calls[0].getParam(0) packet = calls[0].getParam(0)
self.assertTrue(isinstance(packet, protocol.Packet)) self.assertTrue(isinstance(packet, protocol.Packet))
self.assertEquals(packet.getType(), packet_type) self.assertEqual(packet.getType(), packet_type)
if decode: if decode:
return packet.decode() return packet.decode()
return packet return packet
...@@ -335,10 +335,10 @@ class NeoUnitTestBase(NeoTestBase): ...@@ -335,10 +335,10 @@ class NeoUnitTestBase(NeoTestBase):
def checkAnswerPacket(self, conn, packet_type, decode=False): def checkAnswerPacket(self, conn, packet_type, decode=False):
""" Check if an answer-packet with the right type is sent """ """ Check if an answer-packet with the right type is sent """
calls = conn.mockGetNamedCalls('answer') calls = conn.mockGetNamedCalls('answer')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
packet = calls[0].getParam(0) packet = calls[0].getParam(0)
self.assertTrue(isinstance(packet, protocol.Packet)) self.assertTrue(isinstance(packet, protocol.Packet))
self.assertEquals(packet.getType(), packet_type) self.assertEqual(packet.getType(), packet_type)
if decode: if decode:
return packet.decode() return packet.decode()
return packet return packet
...@@ -349,7 +349,7 @@ class NeoUnitTestBase(NeoTestBase): ...@@ -349,7 +349,7 @@ class NeoUnitTestBase(NeoTestBase):
self.assertTrue(len(calls) > packet_number, (len(calls), packet_number)) self.assertTrue(len(calls) > packet_number, (len(calls), packet_number))
packet = calls[packet_number].getParam(0) packet = calls[packet_number].getParam(0)
self.assertTrue(isinstance(packet, protocol.Packet)) self.assertTrue(isinstance(packet, protocol.Packet))
self.assertEquals(packet.getType(), packet_type) self.assertEqual(packet.getType(), packet_type)
if decode: if decode:
return packet.decode() return packet.decode()
return packet return packet
......
...@@ -94,11 +94,11 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -94,11 +94,11 @@ class ClientApplicationTests(NeoUnitTestBase):
def checkAskPacket(self, conn, packet_type, decode=False): def checkAskPacket(self, conn, packet_type, decode=False):
calls = conn.mockGetNamedCalls('ask') calls = conn.mockGetNamedCalls('ask')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
# client connection got queue as first parameter # client connection got queue as first parameter
packet = calls[0].getParam(0) packet = calls[0].getParam(0)
self.assertTrue(isinstance(packet, Packet)) self.assertTrue(isinstance(packet, Packet))
self.assertEquals(packet.getType(), packet_type) self.assertEqual(packet.getType(), packet_type)
if decode: if decode:
return packet.decode() return packet.decode()
return packet return packet
...@@ -163,8 +163,8 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -163,8 +163,8 @@ class ClientApplicationTests(NeoUnitTestBase):
def checkDispatcherRegisterCalled(self, app, conn): def checkDispatcherRegisterCalled(self, app, conn):
calls = app.dispatcher.mockGetNamedCalls('register') calls = app.dispatcher.mockGetNamedCalls('register')
#self.assertEquals(len(calls), 1) #self.assertEqual(len(calls), 1)
#self.assertEquals(calls[0].getParam(0), conn) #self.assertEqual(calls[0].getParam(0), conn)
#self.assertTrue(isinstance(calls[0].getParam(2), Queue)) #self.assertTrue(isinstance(calls[0].getParam(2), Queue))
def test_registerDB(self): def test_registerDB(self):
...@@ -247,7 +247,7 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -247,7 +247,7 @@ class ClientApplicationTests(NeoUnitTestBase):
'fakeReceived': answer_barrier, 'fakeReceived': answer_barrier,
}) })
result = app.load(snapshot_tid, oid)[:2] result = app.load(snapshot_tid, oid)[:2]
self.assertEquals(result, ('OBJ', tid1)) self.assertEqual(result, ('OBJ', tid1))
self.checkAskObject(conn) self.checkAskObject(conn)
self.assertTrue((oid, tid1) in mq) self.assertTrue((oid, tid1) in mq)
# object is now cached, try to reload it # object is now cached, try to reload it
...@@ -256,7 +256,7 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -256,7 +256,7 @@ class ClientApplicationTests(NeoUnitTestBase):
}) })
app.cp = Mock({ 'getConnForCell' : conn}) app.cp = Mock({ 'getConnForCell' : conn})
result = app.load(snapshot_tid, oid)[:2] result = app.load(snapshot_tid, oid)[:2]
self.assertEquals(result, ('OBJ', tid1)) self.assertEqual(result, ('OBJ', tid1))
self.checkNoPacketSent(conn) self.checkNoPacketSent(conn)
def test_loadSerial(self): def test_loadSerial(self):
...@@ -296,7 +296,7 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -296,7 +296,7 @@ class ClientApplicationTests(NeoUnitTestBase):
}) })
app.cp = self.getConnectionPool([(Mock(), conn)]) app.cp = self.getConnectionPool([(Mock(), conn)])
result = loadSerial(oid, tid1) result = loadSerial(oid, tid1)
self.assertEquals(result, 'RIGHT') self.assertEqual(result, 'RIGHT')
self.checkAskObject(conn) self.checkAskObject(conn)
self.assertTrue((oid, tid2) in mq) self.assertTrue((oid, tid2) in mq)
...@@ -350,7 +350,7 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -350,7 +350,7 @@ class ClientApplicationTests(NeoUnitTestBase):
}) })
app.cp = self.getConnectionPool([(Mock(), conn)]) app.cp = self.getConnectionPool([(Mock(), conn)])
result = loadBefore(oid, tid3) result = loadBefore(oid, tid3)
self.assertEquals(result, ('RIGHT', tid2, tid3)) self.assertEqual(result, ('RIGHT', tid2, tid3))
self.checkAskObject(conn) self.checkAskObject(conn)
self.assertTrue((oid, tid1) in mq) self.assertTrue((oid, tid1) in mq)
...@@ -369,13 +369,13 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -369,13 +369,13 @@ class ClientApplicationTests(NeoUnitTestBase):
app.tpc_begin(transaction=txn, tid=tid) app.tpc_begin(transaction=txn, tid=tid)
txn_context = app._txn_container.get(txn) txn_context = app._txn_container.get(txn)
self.assertTrue(txn_context['txn'] is txn) self.assertTrue(txn_context['txn'] is txn)
self.assertEquals(txn_context['ttid'], tid) self.assertEqual(txn_context['ttid'], tid)
# next, the transaction already begin -> raise # next, the transaction already begin -> raise
self.assertRaises(StorageTransactionError, app.tpc_begin, self.assertRaises(StorageTransactionError, app.tpc_begin,
transaction=txn, tid=None) transaction=txn, tid=None)
txn_context = app._txn_container.get(txn) txn_context = app._txn_container.get(txn)
self.assertTrue(txn_context['txn'] is txn) self.assertTrue(txn_context['txn'] is txn)
self.assertEquals(txn_context['ttid'], tid) self.assertEqual(txn_context['ttid'], tid)
# start a transaction without tid # start a transaction without tid
txn = Mock() txn = Mock()
# no connection -> NEOStorageError (wait until connected to primary) # no connection -> NEOStorageError (wait until connected to primary)
...@@ -393,7 +393,7 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -393,7 +393,7 @@ class ClientApplicationTests(NeoUnitTestBase):
# check attributes # check attributes
txn_context = app._txn_container.get(txn) txn_context = app._txn_container.get(txn)
self.assertTrue(txn_context['txn'] is txn) self.assertTrue(txn_context['txn'] is txn)
self.assertEquals(txn_context['ttid'], tid) self.assertEqual(txn_context['ttid'], tid)
def test_store1(self): def test_store1(self):
app = self.getApp() app = self.getApp()
...@@ -410,8 +410,8 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -410,8 +410,8 @@ class ClientApplicationTests(NeoUnitTestBase):
self.assertRaises(NEOStorageError, app.store, oid, tid, '', None, self.assertRaises(NEOStorageError, app.store, oid, tid, '', None,
txn) txn)
calls = app.pt.mockGetNamedCalls('getCellListForOID') calls = app.pt.mockGetNamedCalls('getCellListForOID')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
self.assertEquals(calls[0].getParam(0), oid) # oid=11 self.assertEqual(calls[0].getParam(0), oid) # oid=11
def test_store2(self): def test_store2(self):
app = self.getApp() app = self.getApp()
...@@ -439,7 +439,7 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -439,7 +439,7 @@ class ClientApplicationTests(NeoUnitTestBase):
self.assertRaises(ConflictError, app.waitStoreResponses, txn_context, self.assertRaises(ConflictError, app.waitStoreResponses, txn_context,
failing_tryToResolveConflict) failing_tryToResolveConflict)
self.assertTrue(oid not in data_dict) self.assertTrue(oid not in data_dict)
self.assertEquals(txn_context['object_stored_counter_dict'][oid], {}) self.assertEqual(txn_context['object_stored_counter_dict'][oid], {})
self.checkAskStoreObject(conn) self.checkAskStoreObject(conn)
def test_store3(self): def test_store3(self):
...@@ -466,9 +466,9 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -466,9 +466,9 @@ class ClientApplicationTests(NeoUnitTestBase):
self.checkAskStoreObject(conn) self.checkAskStoreObject(conn)
txn_context['queue'].put((conn, packet)) txn_context['queue'].put((conn, packet))
app.waitStoreResponses(txn_context, resolving_tryToResolveConflict) app.waitStoreResponses(txn_context, resolving_tryToResolveConflict)
self.assertEquals(txn_context['object_stored_counter_dict'][oid], self.assertEqual(txn_context['object_stored_counter_dict'][oid],
{tid: set([uuid])}) {tid: set([uuid])})
self.assertEquals(txn_context['data_dict'].get(oid, None), 'DATA') self.assertEqual(txn_context['data_dict'].get(oid, None), 'DATA')
self.assertFalse(oid in txn_context['conflict_serial_dict']) self.assertFalse(oid in txn_context['conflict_serial_dict'])
def test_tpc_vote1(self): def test_tpc_vote1(self):
...@@ -517,7 +517,7 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -517,7 +517,7 @@ class ClientApplicationTests(NeoUnitTestBase):
self.checkNoPacketSent(app.master_conn) self.checkNoPacketSent(app.master_conn)
txn_context = app._txn_container.get(old_txn) txn_context = app._txn_container.get(old_txn)
self.assertTrue(txn_context['txn'] is old_txn) self.assertTrue(txn_context['txn'] is old_txn)
self.assertEquals(txn_context['ttid'], tid) self.assertEqual(txn_context['ttid'], tid)
def test_tpc_abort2(self): def test_tpc_abort2(self):
# 2 nodes : 1 transaction in the first, 2 objects in the second # 2 nodes : 1 transaction in the first, 2 objects in the second
...@@ -641,7 +641,7 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -641,7 +641,7 @@ class ClientApplicationTests(NeoUnitTestBase):
txn_context['txn_voted'] = True txn_context['txn_voted'] = True
app.tpc_finish(txn, None, hook) app.tpc_finish(txn, None, hook)
self.assertTrue(self.f_called) self.assertTrue(self.f_called)
self.assertEquals(self.f_called_with_tid, tid) self.assertEqual(self.f_called_with_tid, tid)
self.checkAskFinishTransaction(app.master_conn) self.checkAskFinishTransaction(app.master_conn)
#self.checkDispatcherRegisterCalled(app, app.master_conn) #self.checkDispatcherRegisterCalled(app, app.master_conn)
self.assertEqual(app._txn_container.get(txn), None) self.assertEqual(app._txn_container.get(txn), None)
...@@ -894,8 +894,8 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -894,8 +894,8 @@ class ClientApplicationTests(NeoUnitTestBase):
self.assertEqual(pfirst, first) self.assertEqual(pfirst, first)
self.assertEqual(plast, last) self.assertEqual(plast, last)
self.assertEqual(ppartition, INVALID_PARTITION) self.assertEqual(ppartition, INVALID_PARTITION)
self.assertEquals(result[0]['id'], tid1) self.assertEqual(result[0]['id'], tid1)
self.assertEquals(result[1]['id'], tid2) self.assertEqual(result[1]['id'], tid2)
def test_history(self): def test_history(self):
app = self.getApp() app = self.getApp()
...@@ -935,11 +935,11 @@ class ClientApplicationTests(NeoUnitTestBase): ...@@ -935,11 +935,11 @@ class ClientApplicationTests(NeoUnitTestBase):
app.waitResponses = waitResponses app.waitResponses = waitResponses
# start test here # start test here
result = app.history(oid) result = app.history(oid)
self.assertEquals(len(result), 2) self.assertEqual(len(result), 2)
self.assertEquals(result[0]['tid'], tid2) self.assertEqual(result[0]['tid'], tid2)
self.assertEquals(result[1]['tid'], tid1) self.assertEqual(result[1]['tid'], tid1)
self.assertEquals(result[0]['size'], 42) self.assertEqual(result[0]['size'], 42)
self.assertEquals(result[1]['size'], 42) self.assertEqual(result[1]['size'], 42)
def test_connectToPrimaryNode(self): def test_connectToPrimaryNode(self):
# here we have three master nodes : # here we have three master nodes :
......
...@@ -105,7 +105,7 @@ class MasterClientHandlerTests(NeoUnitTestBase): ...@@ -105,7 +105,7 @@ class MasterClientHandlerTests(NeoUnitTestBase):
self.assertTrue(self.app.tm.getLastOID() > oid1) self.assertTrue(self.app.tm.getLastOID() > oid1)
for node in self.app.nm.getStorageList(): for node in self.app.nm.getStorageList():
conn = node.getConnection() conn = node.getConnection()
self.assertEquals(self.checkNotifyLastOID(conn, decode=True), (oid2,)) self.assertEqual(self.checkNotifyLastOID(conn, decode=True), (oid2,))
def test_09_askFinishTransaction(self): def test_09_askFinishTransaction(self):
service = self.service service = self.service
...@@ -143,12 +143,12 @@ class MasterClientHandlerTests(NeoUnitTestBase): ...@@ -143,12 +143,12 @@ class MasterClientHandlerTests(NeoUnitTestBase):
self.assertTrue(self.app.isStorageReady(storage_uuid)) self.assertTrue(self.app.isStorageReady(storage_uuid))
service.askFinishTransaction(conn, ttid, oid_list) service.askFinishTransaction(conn, ttid, oid_list)
self.checkAskLockInformation(storage_conn) self.checkAskLockInformation(storage_conn)
self.assertEquals(len(self.app.tm.registerForNotification(storage_uuid)), 1) self.assertEqual(len(self.app.tm.registerForNotification(storage_uuid)), 1)
txn = self.app.tm[ttid] txn = self.app.tm[ttid]
pending_ttid = list(self.app.tm.registerForNotification(storage_uuid))[0] pending_ttid = list(self.app.tm.registerForNotification(storage_uuid))[0]
self.assertEquals(ttid, pending_ttid) self.assertEqual(ttid, pending_ttid)
self.assertEquals(len(txn.getOIDList()), 0) self.assertEqual(len(txn.getOIDList()), 0)
self.assertEquals(len(txn.getUUIDList()), 1) self.assertEqual(len(txn.getUUIDList()), 1)
def test_askNodeInformations(self): def test_askNodeInformations(self):
# check that only informations about master and storages nodes are # check that only informations about master and storages nodes are
...@@ -168,12 +168,12 @@ class MasterClientHandlerTests(NeoUnitTestBase): ...@@ -168,12 +168,12 @@ class MasterClientHandlerTests(NeoUnitTestBase):
port = self.client_port) port = self.client_port)
conn = self.getFakeConnection(client_uuid, self.client_address) conn = self.getFakeConnection(client_uuid, self.client_address)
lptid = self.app.pt.getID() lptid = self.app.pt.getID()
self.assertEquals(self.app.nm.getByUUID(client_uuid).getState(), self.assertEqual(self.app.nm.getByUUID(client_uuid).getState(),
NodeStates.RUNNING) NodeStates.RUNNING)
method(conn) method(conn)
# node must be have been remove, and no more transaction must remains # node must be have been remove, and no more transaction must remains
self.assertEquals(self.app.nm.getByUUID(client_uuid), None) self.assertEqual(self.app.nm.getByUUID(client_uuid), None)
self.assertEquals(lptid, self.app.pt.getID()) self.assertEqual(lptid, self.app.pt.getID())
def test_15_peerBroken(self): def test_15_peerBroken(self):
self.__testWithMethod(self.service.peerBroken, NodeStates.BROKEN) self.__testWithMethod(self.service.peerBroken, NodeStates.BROKEN)
......
...@@ -106,9 +106,9 @@ class MasterRecoveryTests(NeoUnitTestBase): ...@@ -106,9 +106,9 @@ class MasterRecoveryTests(NeoUnitTestBase):
self.assertTrue(oid2 > self.app.tm.getLastOID()) self.assertTrue(oid2 > self.app.tm.getLastOID())
self.assertTrue(tid2 > self.app.tm.getLastTID()) self.assertTrue(tid2 > self.app.tm.getLastTID())
recovery.answerLastIDs(conn, oid2, tid2, ptid2) recovery.answerLastIDs(conn, oid2, tid2, ptid2)
self.assertEquals(oid2, self.app.tm.getLastOID()) self.assertEqual(oid2, self.app.tm.getLastOID())
self.assertEquals(tid2, self.app.tm.getLastTID()) self.assertEqual(tid2, self.app.tm.getLastTID())
self.assertEquals(ptid2, recovery.target_ptid) self.assertEqual(ptid2, recovery.target_ptid)
def test_10_answerPartitionTable(self): def test_10_answerPartitionTable(self):
...@@ -121,23 +121,23 @@ class MasterRecoveryTests(NeoUnitTestBase): ...@@ -121,23 +121,23 @@ class MasterRecoveryTests(NeoUnitTestBase):
cell_list = [(offset, uuid, CellStates.UP_TO_DATE)] cell_list = [(offset, uuid, CellStates.UP_TO_DATE)]
cells = self.app.pt.getRow(offset) cells = self.app.pt.getRow(offset)
for cell, state in cells: for cell, state in cells:
self.assertEquals(state, CellStates.OUT_OF_DATE) self.assertEqual(state, CellStates.OUT_OF_DATE)
recovery.target_ptid = 2 recovery.target_ptid = 2
recovery.answerPartitionTable(conn, 1, cell_list) recovery.answerPartitionTable(conn, 1, cell_list)
cells = self.app.pt.getRow(offset) cells = self.app.pt.getRow(offset)
for cell, state in cells: for cell, state in cells:
self.assertEquals(state, CellStates.OUT_OF_DATE) self.assertEqual(state, CellStates.OUT_OF_DATE)
# from target node, taken into account # from target node, taken into account
conn = self.getFakeConnection(uuid, self.storage_port) conn = self.getFakeConnection(uuid, self.storage_port)
offset = 1 offset = 1
cell_list = [(offset, ((uuid, CellStates.UP_TO_DATE,),),)] cell_list = [(offset, ((uuid, CellStates.UP_TO_DATE,),),)]
cells = self.app.pt.getRow(offset) cells = self.app.pt.getRow(offset)
for cell, state in cells: for cell, state in cells:
self.assertEquals(state, CellStates.OUT_OF_DATE) self.assertEqual(state, CellStates.OUT_OF_DATE)
recovery.answerPartitionTable(conn, None, cell_list) recovery.answerPartitionTable(conn, None, cell_list)
cells = self.app.pt.getRow(offset) cells = self.app.pt.getRow(offset)
for cell, state in cells: for cell, state in cells:
self.assertEquals(state, CellStates.UP_TO_DATE) self.assertEqual(state, CellStates.UP_TO_DATE)
# give a bad offset, must send error # give a bad offset, must send error
self.recovery.target_uuid = uuid self.recovery.target_uuid = uuid
conn = self.getFakeConnection(uuid, self.storage_port) conn = self.getFakeConnection(uuid, self.storage_port)
......
...@@ -160,8 +160,8 @@ class MasterStorageHandlerTests(NeoUnitTestBase): ...@@ -160,8 +160,8 @@ class MasterStorageHandlerTests(NeoUnitTestBase):
node2, conn2 = self.identifyToMasterNode() node2, conn2 = self.identifyToMasterNode()
node1.setRunning() node1.setRunning()
node2.setRunning() node2.setRunning()
self.assertEquals(node1.getState(), NodeStates.RUNNING) self.assertEqual(node1.getState(), NodeStates.RUNNING)
self.assertEquals(node2.getState(), NodeStates.RUNNING) self.assertEqual(node2.getState(), NodeStates.RUNNING)
# filled the pt # filled the pt
self.app.pt.make(self.app.nm.getStorageList()) self.app.pt.make(self.app.nm.getStorageList())
self.assertTrue(self.app.pt.filled()) self.assertTrue(self.app.pt.filled())
...@@ -169,14 +169,14 @@ class MasterStorageHandlerTests(NeoUnitTestBase): ...@@ -169,14 +169,14 @@ class MasterStorageHandlerTests(NeoUnitTestBase):
# drop one node # drop one node
lptid = self.app.pt.getID() lptid = self.app.pt.getID()
method(conn1) method(conn1)
self.assertEquals(node1.getState(), state) self.assertEqual(node1.getState(), state)
self.assertTrue(lptid < self.app.pt.getID()) self.assertTrue(lptid < self.app.pt.getID())
# drop the second, no storage node left # drop the second, no storage node left
lptid = self.app.pt.getID() lptid = self.app.pt.getID()
self.assertEquals(node2.getState(), NodeStates.RUNNING) self.assertEqual(node2.getState(), NodeStates.RUNNING)
self.assertRaises(OperationFailure, method, conn2) self.assertRaises(OperationFailure, method, conn2)
self.assertEquals(node2.getState(), state) self.assertEqual(node2.getState(), state)
self.assertEquals(lptid, self.app.pt.getID()) self.assertEqual(lptid, self.app.pt.getID())
def test_15_peerBroken(self): def test_15_peerBroken(self):
self._testWithMethod(self.service.peerBroken, NodeStates.BROKEN) self._testWithMethod(self.service.peerBroken, NodeStates.BROKEN)
......
...@@ -121,19 +121,19 @@ class MasterVerificationTests(NeoUnitTestBase): ...@@ -121,19 +121,19 @@ class MasterVerificationTests(NeoUnitTestBase):
uuid = self.identifyToMasterNode() uuid = self.identifyToMasterNode()
# do nothing # do nothing
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_set), 0) self.assertEqual(len(self.verification._uuid_set), 0)
self.assertEquals(len(self.verification._tid_set), 0) self.assertEqual(len(self.verification._tid_set), 0)
new_tid = self.getNextTID() new_tid = self.getNextTID()
verification.answerUnfinishedTransactions(conn, new_tid, [new_tid]) verification.answerUnfinishedTransactions(conn, new_tid, [new_tid])
self.assertEquals(len(self.verification._tid_set), 0) self.assertEqual(len(self.verification._tid_set), 0)
# update dict # update dict
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.verification._uuid_set.add(uuid) self.verification._uuid_set.add(uuid)
self.assertEquals(len(self.verification._tid_set), 0) self.assertEqual(len(self.verification._tid_set), 0)
new_tid = self.getNextTID(new_tid) new_tid = self.getNextTID(new_tid)
verification.answerUnfinishedTransactions(conn, new_tid, [new_tid]) verification.answerUnfinishedTransactions(conn, new_tid, [new_tid])
self.assertTrue(uuid not in self.verification._uuid_set) self.assertTrue(uuid not in self.verification._uuid_set)
self.assertEquals(len(self.verification._tid_set), 1) self.assertEqual(len(self.verification._tid_set), 1)
self.assertTrue(new_tid in self.verification._tid_set) self.assertTrue(new_tid in self.verification._tid_set)
def test_12_answerTransactionInformation(self): def test_12_answerTransactionInformation(self):
...@@ -141,36 +141,36 @@ class MasterVerificationTests(NeoUnitTestBase): ...@@ -141,36 +141,36 @@ class MasterVerificationTests(NeoUnitTestBase):
uuid = self.identifyToMasterNode() uuid = self.identifyToMasterNode()
# do nothing, as unfinished_oid_set is None # do nothing, as unfinished_oid_set is None
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_set), 0) self.assertEqual(len(self.verification._uuid_set), 0)
self.verification._uuid_set.add(uuid) self.verification._uuid_set.add(uuid)
self.verification._oid_set = None self.verification._oid_set = None
new_tid = self.getNextTID() new_tid = self.getNextTID()
new_oid = self.getOID(1) new_oid = self.getOID(1)
verification.answerTransactionInformation(conn, new_tid, verification.answerTransactionInformation(conn, new_tid,
"user", "desc", "ext", False, [new_oid,]) "user", "desc", "ext", False, [new_oid,])
self.assertEquals(self.verification._oid_set, None) self.assertEqual(self.verification._oid_set, None)
# do nothing as asking_uuid_dict is True # do nothing as asking_uuid_dict is True
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_set), 0) self.assertEqual(len(self.verification._uuid_set), 0)
self.verification._oid_set = set() self.verification._oid_set = set()
self.assertEquals(len(self.verification._oid_set), 0) self.assertEqual(len(self.verification._oid_set), 0)
verification.answerTransactionInformation(conn, new_tid, verification.answerTransactionInformation(conn, new_tid,
"user", "desc", "ext", False, [new_oid,]) "user", "desc", "ext", False, [new_oid,])
self.assertEquals(len(self.verification._oid_set), 0) self.assertEqual(len(self.verification._oid_set), 0)
# do work # do work
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_set), 0) self.assertEqual(len(self.verification._uuid_set), 0)
self.verification._uuid_set.add(uuid) self.verification._uuid_set.add(uuid)
self.assertEquals(len(self.verification._oid_set), 0) self.assertEqual(len(self.verification._oid_set), 0)
verification.answerTransactionInformation(conn, new_tid, verification.answerTransactionInformation(conn, new_tid,
"user", "desc", "ext", False, [new_oid,]) "user", "desc", "ext", False, [new_oid,])
self.assertEquals(len(self.verification._oid_set), 1) self.assertEqual(len(self.verification._oid_set), 1)
self.assertTrue(new_oid in self.verification._oid_set) self.assertTrue(new_oid in self.verification._oid_set)
# do not work as oid is diff # do not work as oid is diff
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_set), 0) self.assertEqual(len(self.verification._uuid_set), 0)
self.verification._uuid_set.add(uuid) self.verification._uuid_set.add(uuid)
self.assertEquals(len(self.verification._oid_set), 1) self.assertEqual(len(self.verification._oid_set), 1)
new_oid = self.getOID(2) new_oid = self.getOID(2)
self.assertRaises(ValueError, verification.answerTransactionInformation, self.assertRaises(ValueError, verification.answerTransactionInformation,
conn, new_tid, "user", "desc", "ext", False, [new_oid,]) conn, new_tid, "user", "desc", "ext", False, [new_oid,])
...@@ -180,13 +180,13 @@ class MasterVerificationTests(NeoUnitTestBase): ...@@ -180,13 +180,13 @@ class MasterVerificationTests(NeoUnitTestBase):
uuid = self.identifyToMasterNode() uuid = self.identifyToMasterNode()
# do nothing as asking_uuid_dict is True # do nothing as asking_uuid_dict is True
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_set), 0) self.assertEqual(len(self.verification._uuid_set), 0)
self.verification._oid_set = [] self.verification._oid_set = []
verification.tidNotFound(conn, "msg") verification.tidNotFound(conn, "msg")
self.assertNotEqual(self.verification._oid_set, None) self.assertNotEqual(self.verification._oid_set, None)
# do work as asking_uuid_dict is False # do work as asking_uuid_dict is False
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_set), 0) self.assertEqual(len(self.verification._uuid_set), 0)
self.verification._uuid_set.add(uuid) self.verification._uuid_set.add(uuid)
self.verification._oid_set = [] self.verification._oid_set = []
verification.tidNotFound(conn, "msg") verification.tidNotFound(conn, "msg")
...@@ -199,11 +199,11 @@ class MasterVerificationTests(NeoUnitTestBase): ...@@ -199,11 +199,11 @@ class MasterVerificationTests(NeoUnitTestBase):
new_tid = self.getNextTID() new_tid = self.getNextTID()
new_oid = self.getOID(1) new_oid = self.getOID(1)
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_set), 0) self.assertEqual(len(self.verification._uuid_set), 0)
verification.answerObjectPresent(conn, new_oid, new_tid) verification.answerObjectPresent(conn, new_oid, new_tid)
# do work # do work
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_set), 0) self.assertEqual(len(self.verification._uuid_set), 0)
self.verification._uuid_set.add(uuid) self.verification._uuid_set.add(uuid)
verification.answerObjectPresent(conn, new_oid, new_tid) verification.answerObjectPresent(conn, new_oid, new_tid)
self.assertTrue(uuid not in self.verification._uuid_set) self.assertTrue(uuid not in self.verification._uuid_set)
...@@ -213,14 +213,14 @@ class MasterVerificationTests(NeoUnitTestBase): ...@@ -213,14 +213,14 @@ class MasterVerificationTests(NeoUnitTestBase):
uuid = self.identifyToMasterNode() uuid = self.identifyToMasterNode()
# do nothing as asking_uuid_dict is True # do nothing as asking_uuid_dict is True
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_set), 0) self.assertEqual(len(self.verification._uuid_set), 0)
self.app._object_present = True self.app._object_present = True
self.assertTrue(self.app._object_present) self.assertTrue(self.app._object_present)
verification.oidNotFound(conn, "msg") verification.oidNotFound(conn, "msg")
self.assertTrue(self.app._object_present) self.assertTrue(self.app._object_present)
# do work as asking_uuid_dict is False # do work as asking_uuid_dict is False
conn = self.getFakeConnection(uuid, self.storage_address) conn = self.getFakeConnection(uuid, self.storage_address)
self.assertEquals(len(self.verification._uuid_set), 0) self.assertEqual(len(self.verification._uuid_set), 0)
self.verification._uuid_set.add(uuid) self.verification._uuid_set.add(uuid)
self.assertTrue(self.app._object_present) self.assertTrue(self.app._object_present)
verification.oidNotFound(conn, "msg") verification.oidNotFound(conn, "msg")
......
...@@ -92,23 +92,23 @@ class StorageClientHandlerTests(NeoUnitTestBase): ...@@ -92,23 +92,23 @@ class StorageClientHandlerTests(NeoUnitTestBase):
self.app.dm = Mock() self.app.dm = Mock()
self.app.tm = Mock({'loadLocked': True}) self.app.tm = Mock({'loadLocked': True})
self.app.load_lock_dict[INVALID_OID] = object() self.app.load_lock_dict[INVALID_OID] = object()
self.assertEquals(len(self.app.event_queue), 0) self.assertEqual(len(self.app.event_queue), 0)
self.operation.askObject(conn, oid=INVALID_OID, self.operation.askObject(conn, oid=INVALID_OID,
serial=INVALID_TID, tid=INVALID_TID) serial=INVALID_TID, tid=INVALID_TID)
self.assertEquals(len(self.app.event_queue), 1) self.assertEqual(len(self.app.event_queue), 1)
self.checkNoPacketSent(conn) self.checkNoPacketSent(conn)
self.assertEquals(len(self.app.dm.mockGetNamedCalls('getObject')), 0) self.assertEqual(len(self.app.dm.mockGetNamedCalls('getObject')), 0)
def test_24_askObject2(self): def test_24_askObject2(self):
# invalid serial / tid / packet not found # invalid serial / tid / packet not found
self.app.dm = Mock({'getObject': None}) self.app.dm = Mock({'getObject': None})
conn = self._getConnection() conn = self._getConnection()
self.assertEquals(len(self.app.event_queue), 0) self.assertEqual(len(self.app.event_queue), 0)
self.operation.askObject(conn, oid=INVALID_OID, self.operation.askObject(conn, oid=INVALID_OID,
serial=INVALID_TID, tid=INVALID_TID) serial=INVALID_TID, tid=INVALID_TID)
calls = self.app.dm.mockGetNamedCalls('getObject') calls = self.app.dm.mockGetNamedCalls('getObject')
self.assertEquals(len(self.app.event_queue), 0) self.assertEqual(len(self.app.event_queue), 0)
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
calls[0].checkArgs(INVALID_OID, INVALID_TID, INVALID_TID) calls[0].checkArgs(INVALID_OID, INVALID_TID, INVALID_TID)
self.checkErrorPacket(conn) self.checkErrorPacket(conn)
...@@ -120,9 +120,9 @@ class StorageClientHandlerTests(NeoUnitTestBase): ...@@ -120,9 +120,9 @@ class StorageClientHandlerTests(NeoUnitTestBase):
tid = self.getNextTID() tid = self.getNextTID()
self.app.dm = Mock({'getObject': (serial, next_serial, 0, 0, '', None)}) self.app.dm = Mock({'getObject': (serial, next_serial, 0, 0, '', None)})
conn = self._getConnection() conn = self._getConnection()
self.assertEquals(len(self.app.event_queue), 0) self.assertEqual(len(self.app.event_queue), 0)
self.operation.askObject(conn, oid=oid, serial=serial, tid=tid) self.operation.askObject(conn, oid=oid, serial=serial, tid=tid)
self.assertEquals(len(self.app.event_queue), 0) self.assertEqual(len(self.app.event_queue), 0)
self.checkAnswerObject(conn) self.checkAnswerObject(conn)
def test_25_askTIDs1(self): def test_25_askTIDs1(self):
...@@ -132,8 +132,8 @@ class StorageClientHandlerTests(NeoUnitTestBase): ...@@ -132,8 +132,8 @@ class StorageClientHandlerTests(NeoUnitTestBase):
app.dm = Mock() app.dm = Mock()
conn = self._getConnection() conn = self._getConnection()
self.checkProtocolErrorRaised(self.operation.askTIDs, conn, 1, 1, None) self.checkProtocolErrorRaised(self.operation.askTIDs, conn, 1, 1, None)
self.assertEquals(len(app.pt.mockGetNamedCalls('getCellList')), 0) self.assertEqual(len(app.pt.mockGetNamedCalls('getCellList')), 0)
self.assertEquals(len(app.dm.mockGetNamedCalls('getTIDList')), 0) self.assertEqual(len(app.dm.mockGetNamedCalls('getTIDList')), 0)
def test_25_askTIDs2(self): def test_25_askTIDs2(self):
# well case => answer # well case => answer
...@@ -142,7 +142,7 @@ class StorageClientHandlerTests(NeoUnitTestBase): ...@@ -142,7 +142,7 @@ class StorageClientHandlerTests(NeoUnitTestBase):
self.app.dm = Mock({'getTIDList': (INVALID_TID, )}) self.app.dm = Mock({'getTIDList': (INVALID_TID, )})
self.operation.askTIDs(conn, 1, 2, 1) self.operation.askTIDs(conn, 1, 2, 1)
calls = self.app.dm.mockGetNamedCalls('getTIDList') calls = self.app.dm.mockGetNamedCalls('getTIDList')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
calls[0].checkArgs(1, 1, 1, [1, ]) calls[0].checkArgs(1, 1, 1, [1, ])
self.checkAnswerTids(conn) self.checkAnswerTids(conn)
...@@ -157,9 +157,9 @@ class StorageClientHandlerTests(NeoUnitTestBase): ...@@ -157,9 +157,9 @@ class StorageClientHandlerTests(NeoUnitTestBase):
'getAssignedPartitionList': [0], 'getAssignedPartitionList': [0],
}) })
self.operation.askTIDs(conn, 1, 2, INVALID_PARTITION) self.operation.askTIDs(conn, 1, 2, INVALID_PARTITION)
self.assertEquals(len(self.app.pt.mockGetNamedCalls('getAssignedPartitionList')), 1) self.assertEqual(len(self.app.pt.mockGetNamedCalls('getAssignedPartitionList')), 1)
calls = self.app.dm.mockGetNamedCalls('getTIDList') calls = self.app.dm.mockGetNamedCalls('getTIDList')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
calls[0].checkArgs(1, 1, 1, [0]) calls[0].checkArgs(1, 1, 1, [0])
self.checkAnswerTids(conn) self.checkAnswerTids(conn)
...@@ -170,7 +170,7 @@ class StorageClientHandlerTests(NeoUnitTestBase): ...@@ -170,7 +170,7 @@ class StorageClientHandlerTests(NeoUnitTestBase):
conn = self._getConnection() conn = self._getConnection()
self.checkProtocolErrorRaised(self.operation.askObjectHistory, conn, self.checkProtocolErrorRaised(self.operation.askObjectHistory, conn,
1, 1, None) 1, 1, None)
self.assertEquals(len(app.dm.mockGetNamedCalls('getObjectHistory')), 0) self.assertEqual(len(app.dm.mockGetNamedCalls('getObjectHistory')), 0)
def test_26_askObjectHistory2(self): def test_26_askObjectHistory2(self):
oid1, oid2 = self.getOID(1), self.getOID(2) oid1, oid2 = self.getOID(1), self.getOID(2)
......
...@@ -83,12 +83,12 @@ class StorageMasterHandlerTests(NeoUnitTestBase): ...@@ -83,12 +83,12 @@ class StorageMasterHandlerTests(NeoUnitTestBase):
self.app.pt = Mock({'getID': 1}) self.app.pt = Mock({'getID': 1})
count = len(self.app.nm.getList()) count = len(self.app.nm.getList())
self.operation.notifyPartitionChanges(conn, 0, ()) self.operation.notifyPartitionChanges(conn, 0, ())
self.assertEquals(self.app.pt.getID(), 1) self.assertEqual(self.app.pt.getID(), 1)
self.assertEquals(len(self.app.nm.getList()), count) self.assertEqual(len(self.app.nm.getList()), count)
calls = self.app.replicator.mockGetNamedCalls('removePartition') calls = self.app.replicator.mockGetNamedCalls('removePartition')
self.assertEquals(len(calls), 0) self.assertEqual(len(calls), 0)
calls = self.app.replicator.mockGetNamedCalls('addPartition') calls = self.app.replicator.mockGetNamedCalls('addPartition')
self.assertEquals(len(calls), 0) self.assertEqual(len(calls), 0)
def test_14_notifyPartitionChanges2(self): def test_14_notifyPartitionChanges2(self):
# cases : # cases :
...@@ -112,10 +112,10 @@ class StorageMasterHandlerTests(NeoUnitTestBase): ...@@ -112,10 +112,10 @@ class StorageMasterHandlerTests(NeoUnitTestBase):
app.replicator = Mock({}) app.replicator = Mock({})
self.operation.notifyPartitionChanges(conn, ptid2, cells) self.operation.notifyPartitionChanges(conn, ptid2, cells)
# ptid set # ptid set
self.assertEquals(app.pt.getID(), ptid2) self.assertEqual(app.pt.getID(), ptid2)
# dm call # dm call
calls = self.app.dm.mockGetNamedCalls('changePartitionTable') calls = self.app.dm.mockGetNamedCalls('changePartitionTable')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
calls[0].checkArgs(ptid2, cells) calls[0].checkArgs(ptid2, cells)
def test_16_stopOperation1(self): def test_16_stopOperation1(self):
...@@ -181,7 +181,7 @@ class StorageMasterHandlerTests(NeoUnitTestBase): ...@@ -181,7 +181,7 @@ class StorageMasterHandlerTests(NeoUnitTestBase):
lptid=INVALID_TID, lptid=INVALID_TID,
) )
calls = self.app.replicator.mockGetNamedCalls('setCriticalTID') calls = self.app.replicator.mockGetNamedCalls('setCriticalTID')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
calls[0].checkArgs(INVALID_TID) calls[0].checkArgs(INVALID_TID)
def test_31_answerUnfinishedTransactions(self): def test_31_answerUnfinishedTransactions(self):
...@@ -194,7 +194,7 @@ class StorageMasterHandlerTests(NeoUnitTestBase): ...@@ -194,7 +194,7 @@ class StorageMasterHandlerTests(NeoUnitTestBase):
ttid_list=(INVALID_TID, ), ttid_list=(INVALID_TID, ),
) )
calls = self.app.replicator.mockGetNamedCalls('setUnfinishedTIDList') calls = self.app.replicator.mockGetNamedCalls('setUnfinishedTIDList')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
calls[0].checkArgs(INVALID_TID, (INVALID_TID, )) calls[0].checkArgs(INVALID_TID, (INVALID_TID, ))
def test_askPack(self): def test_askPack(self):
......
...@@ -146,7 +146,7 @@ class StorageAppTests(NeoUnitTestBase): ...@@ -146,7 +146,7 @@ class StorageAppTests(NeoUnitTestBase):
conn = Mock({'__repr__': 'conn', 'getPeerId': ReturnValues(msg_id, msg_id_2)}) conn = Mock({'__repr__': 'conn', 'getPeerId': ReturnValues(msg_id, msg_id_2)})
self.app.queueEvent(event, conn, ("test", )) self.app.queueEvent(event, conn, ("test", ))
self.app.executeQueuedEvents() self.app.executeQueuedEvents()
self.assertEquals(len(event.mockGetNamedCalls("__call__")), 1) self.assertEqual(len(event.mockGetNamedCalls("__call__")), 1)
call = event.mockGetNamedCalls("__call__")[0] call = event.mockGetNamedCalls("__call__")[0]
params = call.getParam(1) params = call.getParam(1)
self.assertEqual(params, "test") self.assertEqual(params, "test")
......
...@@ -45,15 +45,15 @@ class StorageDBTests(NeoUnitTestBase): ...@@ -45,15 +45,15 @@ class StorageDBTests(NeoUnitTestBase):
# check if a configuration entry is well written # check if a configuration entry is well written
self.db.setConfiguration('a', 'c') self.db.setConfiguration('a', 'c')
result = self.db.getConfiguration('a') result = self.db.getConfiguration('a')
self.assertEquals(result, 'c') self.assertEqual(result, 'c')
def checkConfigEntry(self, get_call, set_call, value): def checkConfigEntry(self, get_call, set_call, value):
# generic test for all configuration entries accessors # generic test for all configuration entries accessors
self.assertRaises(KeyError, get_call) self.assertRaises(KeyError, get_call)
set_call(value) set_call(value)
self.assertEquals(get_call(), value) self.assertEqual(get_call(), value)
set_call(value * 2) set_call(value * 2)
self.assertEquals(get_call(), value * 2) self.assertEqual(get_call(), value * 2)
def test_UUID(self): def test_UUID(self):
self.checkConfigEntry(self.db.getUUID, self.db.setUUID, 'TEST_VALUE') self.checkConfigEntry(self.db.getUUID, self.db.setUUID, 'TEST_VALUE')
...@@ -85,7 +85,7 @@ class StorageDBTests(NeoUnitTestBase): ...@@ -85,7 +85,7 @@ class StorageDBTests(NeoUnitTestBase):
oid1 = self.getOID(1) oid1 = self.getOID(1)
self.db.setLastOID(oid1) self.db.setLastOID(oid1)
result1 = self.db.getLastOID() result1 = self.db.getLastOID()
self.assertEquals(result1, oid1) self.assertEqual(result1, oid1)
def getOIDs(self, count): def getOIDs(self, count):
return [self.getOID(i) for i in xrange(count)] return [self.getOID(i) for i in xrange(count)]
......
...@@ -79,11 +79,11 @@ class StorageStorageHandlerTests(NeoUnitTestBase): ...@@ -79,11 +79,11 @@ class StorageStorageHandlerTests(NeoUnitTestBase):
self.app.dm = Mock() self.app.dm = Mock()
self.app.tm = Mock({'loadLocked': True}) self.app.tm = Mock({'loadLocked': True})
self.app.load_lock_dict[oid] = object() self.app.load_lock_dict[oid] = object()
self.assertEquals(len(self.app.event_queue), 0) self.assertEqual(len(self.app.event_queue), 0)
self.operation.askObject(conn, oid=oid, serial=serial, tid=tid) self.operation.askObject(conn, oid=oid, serial=serial, tid=tid)
self.assertEquals(len(self.app.event_queue), 1) self.assertEqual(len(self.app.event_queue), 1)
self.checkNoPacketSent(conn) self.checkNoPacketSent(conn)
self.assertEquals(len(self.app.dm.mockGetNamedCalls('getObject')), 0) self.assertEqual(len(self.app.dm.mockGetNamedCalls('getObject')), 0)
def test_24_askObject2(self): def test_24_askObject2(self):
# invalid serial / tid / packet not found # invalid serial / tid / packet not found
...@@ -92,11 +92,11 @@ class StorageStorageHandlerTests(NeoUnitTestBase): ...@@ -92,11 +92,11 @@ class StorageStorageHandlerTests(NeoUnitTestBase):
oid = self.getOID(1) oid = self.getOID(1)
tid = self.getNextTID() tid = self.getNextTID()
serial = self.getNextTID() serial = self.getNextTID()
self.assertEquals(len(self.app.event_queue), 0) self.assertEqual(len(self.app.event_queue), 0)
self.operation.askObject(conn, oid=oid, serial=serial, tid=tid) self.operation.askObject(conn, oid=oid, serial=serial, tid=tid)
calls = self.app.dm.mockGetNamedCalls('getObject') calls = self.app.dm.mockGetNamedCalls('getObject')
self.assertEquals(len(self.app.event_queue), 0) self.assertEqual(len(self.app.event_queue), 0)
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
calls[0].checkArgs(oid, serial, tid, resolve_data=False) calls[0].checkArgs(oid, serial, tid, resolve_data=False)
self.checkErrorPacket(conn) self.checkErrorPacket(conn)
...@@ -108,9 +108,9 @@ class StorageStorageHandlerTests(NeoUnitTestBase): ...@@ -108,9 +108,9 @@ class StorageStorageHandlerTests(NeoUnitTestBase):
# object found => answer # object found => answer
self.app.dm = Mock({'getObject': (serial, next_serial, 0, 0, '', None)}) self.app.dm = Mock({'getObject': (serial, next_serial, 0, 0, '', None)})
conn = self.getFakeConnection() conn = self.getFakeConnection()
self.assertEquals(len(self.app.event_queue), 0) self.assertEqual(len(self.app.event_queue), 0)
self.operation.askObject(conn, oid=oid, serial=serial, tid=tid) self.operation.askObject(conn, oid=oid, serial=serial, tid=tid)
self.assertEquals(len(self.app.event_queue), 0) self.assertEqual(len(self.app.event_queue), 0)
self.checkAnswerObject(conn) self.checkAnswerObject(conn)
def test_25_askTIDsFrom(self): def test_25_askTIDsFrom(self):
...@@ -122,7 +122,7 @@ class StorageStorageHandlerTests(NeoUnitTestBase): ...@@ -122,7 +122,7 @@ class StorageStorageHandlerTests(NeoUnitTestBase):
tid2 = self.getNextTID() tid2 = self.getNextTID()
self.operation.askTIDsFrom(conn, tid, tid2, 2, [1]) self.operation.askTIDsFrom(conn, tid, tid2, 2, [1])
calls = self.app.dm.mockGetNamedCalls('getReplicationTIDList') calls = self.app.dm.mockGetNamedCalls('getReplicationTIDList')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
calls[0].checkArgs(tid, tid2, 2, 1, 1) calls[0].checkArgs(tid, tid2, 2, 1, 1)
self.checkAnswerTidsFrom(conn) self.checkAnswerTidsFrom(conn)
...@@ -143,7 +143,7 @@ class StorageStorageHandlerTests(NeoUnitTestBase): ...@@ -143,7 +143,7 @@ class StorageStorageHandlerTests(NeoUnitTestBase):
max_serial, length, partition) max_serial, length, partition)
self.checkAnswerObjectHistoryFrom(conn) self.checkAnswerObjectHistoryFrom(conn)
calls = self.app.dm.mockGetNamedCalls('getObjectHistoryFrom') calls = self.app.dm.mockGetNamedCalls('getObjectHistoryFrom')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
calls[0].checkArgs(min_oid, min_serial, max_serial, length, calls[0].checkArgs(min_oid, min_serial, max_serial, length,
num_partitions, partition) num_partitions, partition)
......
...@@ -47,8 +47,8 @@ class StorageMySQSLdbTests(StorageDBTests): ...@@ -47,8 +47,8 @@ class StorageMySQSLdbTests(StorageDBTests):
def test_MySQLDatabaseManagerInit(self): def test_MySQLDatabaseManagerInit(self):
db = MySQLDatabaseManager('%s@%s' % (NEO_SQL_USER, NEO_SQL_DATABASE)) db = MySQLDatabaseManager('%s@%s' % (NEO_SQL_USER, NEO_SQL_DATABASE))
# init # init
self.assertEquals(db.db, NEO_SQL_DATABASE) self.assertEqual(db.db, NEO_SQL_DATABASE)
self.assertEquals(db.user, NEO_SQL_USER) self.assertEqual(db.user, NEO_SQL_USER)
# & connect # & connect
self.assertTrue(isinstance(db.conn, MySQLdb.connection)) self.assertTrue(isinstance(db.conn, MySQLdb.connection))
self.assertFalse(db.isUnderTransaction()) self.assertFalse(db.isUnderTransaction())
...@@ -65,7 +65,7 @@ class StorageMySQSLdbTests(StorageDBTests): ...@@ -65,7 +65,7 @@ class StorageMySQSLdbTests(StorageDBTests):
self.db.conn = Mock() self.db.conn = Mock()
self.db.begin() self.db.begin()
self.db.commit() self.db.commit()
self.assertEquals(len(self.db.conn.mockGetNamedCalls('commit')), 1) self.assertEqual(len(self.db.conn.mockGetNamedCalls('commit')), 1)
self.assertFalse(self.db.isUnderTransaction()) self.assertFalse(self.db.isUnderTransaction())
def test_rollback(self): def test_rollback(self):
...@@ -73,7 +73,7 @@ class StorageMySQSLdbTests(StorageDBTests): ...@@ -73,7 +73,7 @@ class StorageMySQSLdbTests(StorageDBTests):
self.db.conn = Mock({ }) self.db.conn = Mock({ })
self.db.under_transaction = True self.db.under_transaction = True
self.db.rollback() self.db.rollback()
self.assertEquals(len(self.db.conn.mockGetNamedCalls('rollback')), 1) self.assertEqual(len(self.db.conn.mockGetNamedCalls('rollback')), 1)
self.assertFalse(self.db.isUnderTransaction()) self.assertFalse(self.db.isUnderTransaction())
def test_query1(self): def test_query1(self):
...@@ -89,9 +89,9 @@ class StorageMySQSLdbTests(StorageDBTests): ...@@ -89,9 +89,9 @@ class StorageMySQSLdbTests(StorageDBTests):
) )
self.db.conn = Mock({ 'store_result': result_object }) self.db.conn = Mock({ 'store_result': result_object })
result = self.db.query('QUERY') result = self.db.query('QUERY')
self.assertEquals(result, expected_result) self.assertEqual(result, expected_result)
calls = self.db.conn.mockGetNamedCalls('query') calls = self.db.conn.mockGetNamedCalls('query')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
calls[0].checkArgs('QUERY') calls[0].checkArgs('QUERY')
def test_query2(self): def test_query2(self):
...@@ -126,8 +126,8 @@ class StorageMySQSLdbTests(StorageDBTests): ...@@ -126,8 +126,8 @@ class StorageMySQSLdbTests(StorageDBTests):
self.assertRaises(DatabaseFailure, self.db.query, 'QUERY') self.assertRaises(DatabaseFailure, self.db.query, 'QUERY')
def test_escape(self): def test_escape(self):
self.assertEquals(self.db.escape('a"b'), 'a\\"b') self.assertEqual(self.db.escape('a"b'), 'a\\"b')
self.assertEquals(self.db.escape("a'b"), "a\\'b") self.assertEqual(self.db.escape("a'b"), "a\\'b")
def test_setup(self): def test_setup(self):
# XXX: this test verifies irrelevant symptoms. It should instead check that # XXX: this test verifies irrelevant symptoms. It should instead check that
...@@ -139,12 +139,12 @@ class StorageMySQSLdbTests(StorageDBTests): ...@@ -139,12 +139,12 @@ class StorageMySQSLdbTests(StorageDBTests):
self.db.conn = Mock() self.db.conn = Mock()
self.db.setup() self.db.setup()
calls = self.db.conn.mockGetNamedCalls('query') calls = self.db.conn.mockGetNamedCalls('query')
self.assertEquals(len(calls), 7) self.assertEqual(len(calls), 7)
# create all tables but drop them first # create all tables but drop them first
self.db.conn = Mock() self.db.conn = Mock()
self.db.setup(reset=True) self.db.setup(reset=True)
calls = self.db.conn.mockGetNamedCalls('query') calls = self.db.conn.mockGetNamedCalls('query')
self.assertEquals(len(calls), 8) self.assertEqual(len(calls), 8)
del StorageDBTests del StorageDBTests
......
...@@ -140,9 +140,9 @@ class StorageVerificationHandlerTests(NeoUnitTestBase): ...@@ -140,9 +140,9 @@ class StorageVerificationHandlerTests(NeoUnitTestBase):
self.verification.notifyPartitionChanges(conn, ptid, (cell, )) self.verification.notifyPartitionChanges(conn, ptid, (cell, ))
# check db update # check db update
calls = self.app.dm.mockGetNamedCalls('changePartitionTable') calls = self.app.dm.mockGetNamedCalls('changePartitionTable')
self.assertEquals(len(calls), 1) self.assertEqual(len(calls), 1)
self.assertEquals(calls[0].getParam(0), ptid) self.assertEqual(calls[0].getParam(0), ptid)
self.assertEquals(calls[0].getParam(1), (cell, )) self.assertEqual(calls[0].getParam(1), (cell, ))
def test_11_startOperation(self): def test_11_startOperation(self):
conn = self.getMasterConnection() conn = self.getMasterConnection()
......
...@@ -78,10 +78,10 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -78,10 +78,10 @@ class ConnectionTests(NeoUnitTestBase):
self.assertEqual(len(self.em.mockGetNamedCalls("removeWriter")), n) self.assertEqual(len(self.em.mockGetNamedCalls("removeWriter")), n)
def _checkShutdown(self, n=1): def _checkShutdown(self, n=1):
self.assertEquals(len(self.connector.mockGetNamedCalls("shutdown")), n) self.assertEqual(len(self.connector.mockGetNamedCalls("shutdown")), n)
def _checkClose(self, n=1): def _checkClose(self, n=1):
self.assertEquals(len(self.connector.mockGetNamedCalls("close")), n) self.assertEqual(len(self.connector.mockGetNamedCalls("close")), n)
def _checkGetNewConnection(self, n=1): def _checkGetNewConnection(self, n=1):
calls = self.connector.mockGetNamedCalls('getNewConnection') calls = self.connector.mockGetNamedCalls('getNewConnection')
...@@ -92,7 +92,7 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -92,7 +92,7 @@ class ConnectionTests(NeoUnitTestBase):
self.assertEqual(len(calls), n) self.assertEqual(len(calls), n)
if n > 1 and data is not None: if n > 1 and data is not None:
data = calls[n-1].getParam(0) data = calls[n-1].getParam(0)
self.assertEquals(data, "testdata") self.assertEqual(data, "testdata")
def _checkConnectionAccepted(self, n=1): def _checkConnectionAccepted(self, n=1):
calls = self.handler.mockGetNamedCalls('connectionAccepted') calls = self.handler.mockGetNamedCalls('connectionAccepted')
...@@ -125,7 +125,7 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -125,7 +125,7 @@ class ConnectionTests(NeoUnitTestBase):
def _checkPacketReceived(self, n=1): def _checkPacketReceived(self, n=1):
calls = self.handler.mockGetNamedCalls('packetReceived') calls = self.handler.mockGetNamedCalls('packetReceived')
self.assertEquals(len(calls), n) self.assertEqual(len(calls), n)
def _checkReadBuf(self, bc, data): def _checkReadBuf(self, bc, data):
content = bc.read_buf.read(len(bc.read_buf)) content = bc.read_buf.read(len(bc.read_buf))
...@@ -414,7 +414,7 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -414,7 +414,7 @@ class ConnectionTests(NeoUnitTestBase):
bc.read_buf.append(p_data_2) bc.read_buf.append(p_data_2)
bc.analyse() bc.analyse()
# check packet decoded # check packet decoded
self.assertEquals(len(bc._queue.mockGetNamedCalls("append")), 1) self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 1)
call = bc._queue.mockGetNamedCalls("append")[0] call = bc._queue.mockGetNamedCalls("append")[0]
data = call.getParam(0) data = call.getParam(0)
self.assertEqual(data.getType(), p.getType()) self.assertEqual(data.getType(), p.getType())
...@@ -455,7 +455,7 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -455,7 +455,7 @@ class ConnectionTests(NeoUnitTestBase):
self.assertEqual(len(bc.read_buf), len(p1) + len(p2)) self.assertEqual(len(bc.read_buf), len(p1) + len(p2))
bc.analyse() bc.analyse()
# check two packets decoded # check two packets decoded
self.assertEquals(len(bc._queue.mockGetNamedCalls("append")), 2) self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 2)
# packet 1 # packet 1
call = bc._queue.mockGetNamedCalls("append")[0] call = bc._queue.mockGetNamedCalls("append")[0]
data = call.getParam(0) data = call.getParam(0)
...@@ -476,8 +476,8 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -476,8 +476,8 @@ class ConnectionTests(NeoUnitTestBase):
bc._queue = Mock() bc._queue = Mock()
self._appendToReadBuf(bc, 'datadatadatadata') self._appendToReadBuf(bc, 'datadatadatadata')
bc.analyse() bc.analyse()
self.assertEquals(len(bc._queue.mockGetNamedCalls("append")), 0) self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 0)
self.assertEquals( self.assertEqual(
len(self.handler.mockGetNamedCalls("_packetMalformed")), 1) len(self.handler.mockGetNamedCalls("_packetMalformed")), 1)
def test_Connection_analyse4(self): def test_Connection_analyse4(self):
...@@ -498,7 +498,7 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -498,7 +498,7 @@ class ConnectionTests(NeoUnitTestBase):
self._appendPacketToReadBuf(bc, p) self._appendPacketToReadBuf(bc, p)
bc.analyse() bc.analyse()
# check packet decoded # check packet decoded
self.assertEquals(len(bc._queue.mockGetNamedCalls("append")), 1) self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 1)
call = bc._queue.mockGetNamedCalls("append")[0] call = bc._queue.mockGetNamedCalls("append")[0]
data = call.getParam(0) data = call.getParam(0)
self.assertEqual(data.getType(), p.getType()) self.assertEqual(data.getType(), p.getType())
...@@ -515,7 +515,7 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -515,7 +515,7 @@ class ConnectionTests(NeoUnitTestBase):
self._appendPacketToReadBuf(bc, p) self._appendPacketToReadBuf(bc, p)
bc.analyse() bc.analyse()
# check no packet was queued # check no packet was queued
self.assertEquals(len(bc._queue.mockGetNamedCalls("append")), 0) self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 0)
# check pong answered # check pong answered
parser_state = ParserState() parser_state = ParserState()
buffer = ReadBuffer() buffer = ReadBuffer()
...@@ -536,9 +536,9 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -536,9 +536,9 @@ class ConnectionTests(NeoUnitTestBase):
self._appendPacketToReadBuf(bc, p) self._appendPacketToReadBuf(bc, p)
bc.analyse() bc.analyse()
# check no packet was queued # check no packet was queued
self.assertEquals(len(bc._queue.mockGetNamedCalls("append")), 0) self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 0)
# check timeout has been refreshed # check timeout has been refreshed
self.assertEquals(len(bc._timeout.mockGetNamedCalls("refresh")), 1) self.assertEqual(len(bc._timeout.mockGetNamedCalls("refresh")), 1)
def test_Connection_writable1(self): def test_Connection_writable1(self):
# with pending operation after send # with pending operation after send
...@@ -637,7 +637,7 @@ class ConnectionTests(NeoUnitTestBase): ...@@ -637,7 +637,7 @@ class ConnectionTests(NeoUnitTestBase):
bc.readable() bc.readable()
# check packet decoded # check packet decoded
self._checkReadBuf(bc, '') self._checkReadBuf(bc, '')
self.assertEquals(len(bc._queue.mockGetNamedCalls("append")), 1) self.assertEqual(len(bc._queue.mockGetNamedCalls("append")), 1)
call = bc._queue.mockGetNamedCalls("append")[0] call = bc._queue.mockGetNamedCalls("append")[0]
data = call.getParam(0) data = call.getParam(0)
self.assertEqual(data.getType(), Packets.AnswerPrimary) self.assertEqual(data.getType(), Packets.AnswerPrimary)
......
...@@ -39,8 +39,8 @@ class EventTests(NeoUnitTestBase): ...@@ -39,8 +39,8 @@ class EventTests(NeoUnitTestBase):
# test register/unregister # test register/unregister
em.register(conn) em.register(conn)
self.assertEquals(len(connector.mockGetNamedCalls("getDescriptor")), 1) self.assertEqual(len(connector.mockGetNamedCalls("getDescriptor")), 1)
self.assertEquals(len(em.epoll.mockGetNamedCalls("register")), 1) self.assertEqual(len(em.epoll.mockGetNamedCalls("register")), 1)
call = em.epoll.mockGetNamedCalls("register")[0] call = em.epoll.mockGetNamedCalls("register")[0]
data = call.getParam(0) data = call.getParam(0)
self.assertEqual(data, 1014) self.assertEqual(data, 1014)
...@@ -49,8 +49,8 @@ class EventTests(NeoUnitTestBase): ...@@ -49,8 +49,8 @@ class EventTests(NeoUnitTestBase):
connector = self.getFakeConnector(descriptor=1014) connector = self.getFakeConnector(descriptor=1014)
conn = self.getFakeConnection(connector=connector) conn = self.getFakeConnection(connector=connector)
em.unregister(conn) em.unregister(conn)
self.assertEquals(len(connector.mockGetNamedCalls("getDescriptor")), 1) self.assertEqual(len(connector.mockGetNamedCalls("getDescriptor")), 1)
self.assertEquals(len(em.epoll.mockGetNamedCalls("unregister")), 1) self.assertEqual(len(em.epoll.mockGetNamedCalls("unregister")), 1)
call = em.epoll.mockGetNamedCalls("unregister")[0] call = em.epoll.mockGetNamedCalls("unregister")[0]
data = call.getParam(0) data = call.getParam(0)
self.assertEqual(data, 1014) self.assertEqual(data, 1014)
...@@ -61,32 +61,32 @@ class EventTests(NeoUnitTestBase): ...@@ -61,32 +61,32 @@ class EventTests(NeoUnitTestBase):
self.assertEqual(len(em.reader_set), 0) self.assertEqual(len(em.reader_set), 0)
em.addReader(conn) em.addReader(conn)
self.assertEqual(len(em.reader_set), 1) self.assertEqual(len(em.reader_set), 1)
self.assertEquals(len(em.epoll.mockGetNamedCalls("modify")), 1) self.assertEqual(len(em.epoll.mockGetNamedCalls("modify")), 1)
em.addReader(conn) # do not add if already present em.addReader(conn) # do not add if already present
self.assertEqual(len(em.reader_set), 1) self.assertEqual(len(em.reader_set), 1)
self.assertEquals(len(em.epoll.mockGetNamedCalls("modify")), 1) self.assertEqual(len(em.epoll.mockGetNamedCalls("modify")), 1)
em.removeReader(conn) em.removeReader(conn)
self.assertEqual(len(em.reader_set), 0) self.assertEqual(len(em.reader_set), 0)
self.assertEquals(len(em.epoll.mockGetNamedCalls("modify")), 2) self.assertEqual(len(em.epoll.mockGetNamedCalls("modify")), 2)
em.removeReader(conn) em.removeReader(conn)
self.assertEqual(len(em.reader_set), 0) self.assertEqual(len(em.reader_set), 0)
self.assertEquals(len(em.epoll.mockGetNamedCalls("modify")), 2) self.assertEqual(len(em.epoll.mockGetNamedCalls("modify")), 2)
# add/removeWriter # add/removeWriter
conn = self.getFakeConnection() conn = self.getFakeConnection()
self.assertEqual(len(em.writer_set), 0) self.assertEqual(len(em.writer_set), 0)
em.addWriter(conn) em.addWriter(conn)
self.assertEqual(len(em.writer_set), 1) self.assertEqual(len(em.writer_set), 1)
self.assertEquals(len(em.epoll.mockGetNamedCalls("modify")), 3) self.assertEqual(len(em.epoll.mockGetNamedCalls("modify")), 3)
em.addWriter(conn) # do not add if already present em.addWriter(conn) # do not add if already present
self.assertEqual(len(em.writer_set), 1) self.assertEqual(len(em.writer_set), 1)
self.assertEquals(len(em.epoll.mockGetNamedCalls("modify")), 3) self.assertEqual(len(em.epoll.mockGetNamedCalls("modify")), 3)
em.removeWriter(conn) em.removeWriter(conn)
self.assertEqual(len(em.writer_set), 0) self.assertEqual(len(em.writer_set), 0)
self.assertEquals(len(em.epoll.mockGetNamedCalls("modify")), 4) self.assertEqual(len(em.epoll.mockGetNamedCalls("modify")), 4)
em.removeWriter(conn) em.removeWriter(conn)
self.assertEqual(len(em.writer_set), 0) self.assertEqual(len(em.writer_set), 0)
self.assertEquals(len(em.epoll.mockGetNamedCalls("modify")), 4) self.assertEqual(len(em.epoll.mockGetNamedCalls("modify")), 4)
# poll # poll
r_connector = self.getFakeConnector(descriptor=14515) r_connector = self.getFakeConnector(descriptor=14515)
...@@ -102,21 +102,21 @@ class EventTests(NeoUnitTestBase): ...@@ -102,21 +102,21 @@ class EventTests(NeoUnitTestBase):
)}) )})
em.poll(timeout=10) em.poll(timeout=10)
# check it called poll on epoll # check it called poll on epoll
self.assertEquals(len(em.epoll.mockGetNamedCalls("poll")), 1) self.assertEqual(len(em.epoll.mockGetNamedCalls("poll")), 1)
call = em.epoll.mockGetNamedCalls("poll")[0] call = em.epoll.mockGetNamedCalls("poll")[0]
data = call.getParam(0) data = call.getParam(0)
self.assertEqual(data, 10) self.assertEqual(data, 10)
# need to rebuild completely this test and the the packet queue # need to rebuild completely this test and the the packet queue
# check readable conn # check readable conn
#self.assertEquals(len(r_conn.mockGetNamedCalls("lock")), 1) #self.assertEqual(len(r_conn.mockGetNamedCalls("lock")), 1)
#self.assertEquals(len(r_conn.mockGetNamedCalls("unlock")), 1) #self.assertEqual(len(r_conn.mockGetNamedCalls("unlock")), 1)
#self.assertEquals(len(r_conn.mockGetNamedCalls("readable")), 1) #self.assertEqual(len(r_conn.mockGetNamedCalls("readable")), 1)
#self.assertEquals(len(r_conn.mockGetNamedCalls("writable")), 0) #self.assertEqual(len(r_conn.mockGetNamedCalls("writable")), 0)
# check writable conn # check writable conn
#self.assertEquals(len(w_conn.mockGetNamedCalls("lock")), 1) #self.assertEqual(len(w_conn.mockGetNamedCalls("lock")), 1)
#self.assertEquals(len(w_conn.mockGetNamedCalls("unlock")), 1) #self.assertEqual(len(w_conn.mockGetNamedCalls("unlock")), 1)
#self.assertEquals(len(w_conn.mockGetNamedCalls("readable")), 0) #self.assertEqual(len(w_conn.mockGetNamedCalls("readable")), 0)
#self.assertEquals(len(w_conn.mockGetNamedCalls("writable")), 1) #self.assertEqual(len(w_conn.mockGetNamedCalls("writable")), 1)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -29,20 +29,20 @@ class PartitionTableTests(NeoUnitTestBase): ...@@ -29,20 +29,20 @@ class PartitionTableTests(NeoUnitTestBase):
server = ("127.0.0.1", 19001) server = ("127.0.0.1", 19001)
sn = StorageNode(Mock(), server, uuid) sn = StorageNode(Mock(), server, uuid)
cell = Cell(sn) cell = Cell(sn)
self.assertEquals(cell.node, sn) self.assertEqual(cell.node, sn)
self.assertEquals(cell.state, CellStates.UP_TO_DATE) self.assertEqual(cell.state, CellStates.UP_TO_DATE)
cell = Cell(sn, CellStates.OUT_OF_DATE) cell = Cell(sn, CellStates.OUT_OF_DATE)
self.assertEquals(cell.node, sn) self.assertEqual(cell.node, sn)
self.assertEquals(cell.state, CellStates.OUT_OF_DATE) self.assertEqual(cell.state, CellStates.OUT_OF_DATE)
# check getter # check getter
self.assertEquals(cell.getNode(), sn) self.assertEqual(cell.getNode(), sn)
self.assertEquals(cell.getState(), CellStates.OUT_OF_DATE) self.assertEqual(cell.getState(), CellStates.OUT_OF_DATE)
self.assertEquals(cell.getNodeState(), NodeStates.UNKNOWN) self.assertEqual(cell.getNodeState(), NodeStates.UNKNOWN)
self.assertEquals(cell.getUUID(), uuid) self.assertEqual(cell.getUUID(), uuid)
self.assertEquals(cell.getAddress(), server) self.assertEqual(cell.getAddress(), server)
# check state setter # check state setter
cell.setState(CellStates.FEEDING) cell.setState(CellStates.FEEDING)
self.assertEquals(cell.getState(), CellStates.FEEDING) self.assertEqual(cell.getState(), CellStates.FEEDING)
def test_03_setCell(self): def test_03_setCell(self):
......
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