Commit 935c7f76 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Fix tests altered by commits #563, #565 and #566


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@569 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f64b7c46
......@@ -343,6 +343,7 @@ class PrimaryEventHandler(BaseClientEventHandler):
if uuid != app.uuid:
node.setState(TEMPORARILY_DOWN_STATE)
nm.add(node)
# FIXME: Why FEEDING_STATE cells are kept in the PT ?
if state == DISCARDED_STATE:
pt.removeCell(offset, node)
else:
......
......@@ -835,17 +835,17 @@ class ClientEventHandlerTest(NeoTestBase):
self.assertEquals(calls[2].getParam(0).getUUID(), uuid4)
self.assertEquals(calls[0].getParam(0).getState(), TEMPORARILY_DOWN_STATE)
self.assertEquals(calls[1].getParam(0).getState(), TEMPORARILY_DOWN_STATE)
# check two are dropped from the pt
calls = app.pt.mockGetNamedCalls('dropNode')
self.assertEquals(len(calls), 2)
self.assertEquals(calls[0].getParam(0).getUUID(), uuid2)
self.assertEquals(calls[1].getParam(0).getUUID(), uuid3)
# check the discarded cell is removed from the pt
calls = app.pt.mockGetNamedCalls('removeCell')
self.assertEquals(len(calls), 1)
self.assertEquals(calls[0].getParam(1).getUUID(), uuid2)
# and the others are updated
self.assertEqual(app.ptid, test_ptid + 1)
calls = app.pt.mockGetNamedCalls('setCell')
self.assertEqual(len(calls), 2)
self.assertEqual(len(calls), 3)
self.assertEquals(calls[0].getParam(1).getUUID(), uuid1)
self.assertEquals(calls[1].getParam(1).getUUID(), uuid4)
self.assertEquals(calls[1].getParam(1).getUUID(), uuid3)
self.assertEquals(calls[2].getParam(1).getUUID(), uuid4)
def test_AnswerNewTID(self):
app = Mock({'setTID': None})
......
......@@ -535,10 +535,9 @@ server: 127.0.0.1:10020
self.assertEquals(app.nm.getNodeByUUID(uuid).getState(), TEMPORARILY_DOWN_STATE)
# pt calls
calls = self.app.pt.mockGetNamedCalls('setCell')
self.assertEquals(len(calls), 3)
self.assertEquals(len(calls), 2)
calls[0].checkArgs(0, app.nm.getNodeByUUID(uuid), UP_TO_DATE_STATE)
calls[1].checkArgs(1, app.nm.getNodeByUUID(app.uuid), DISCARDED_STATE)
calls[2].checkArgs(2, app.nm.getNodeByUUID(app.uuid), OUT_OF_DATE_STATE)
calls[1].checkArgs(2, app.nm.getNodeByUUID(app.uuid), OUT_OF_DATE_STATE)
# replicator calls
calls = self.app.replicator.mockGetNamedCalls('removePartition')
self.assertEquals(len(calls), 1)
......
......@@ -395,7 +395,8 @@ class testConnection(unittest.TestCase):
call = connector.mockGetNamedCalls("send")[0]
data = call.getParam(0)
self.assertEquals(data, "testdatasecondthird")
self.assertEqual(bc.write_buf, "testdata" + "second" + "third")
# connection closed -> buffers flushed
self.assertEqual(bc.write_buf, "")
self.assertEquals(len(handler.mockGetNamedCalls("connectionClosed")), 1)
self.assertEquals(len(em.mockGetNamedCalls("removeReader")), 1)
self.assertEquals(len(em.mockGetNamedCalls("unregister")), 1)
......@@ -928,7 +929,7 @@ class testConnection(unittest.TestCase):
self.assertTrue(bc.connecting)
self.assertFalse(bc.pending())
self.assertFalse(bc.aborted)
self.assertEqual(bc.write_buf, "testdata")
self.assertEqual(bc.write_buf, "") # buffer flushed at closure
self.assertEquals(len(handler.mockGetNamedCalls("connectionClosed")), 0)
self.assertEquals(len(handler.mockGetNamedCalls("connectionCompleted")), 1)
self.assertEquals(len(handler.mockGetNamedCalls("connectionFailed")), 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