Commit 8988ebb0 authored by Vincent Pelletier's avatar Vincent Pelletier

Check reception of partial packet behaves as expected.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2011 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 3d348a6b
......@@ -400,7 +400,17 @@ class ConnectionTests(NeoTestBase):
(("127.0.0.1", 2132), self.getNewUUID()))
p = Packets.AnswerPrimary(self.getNewUUID(), master_list)
p.setId(1)
self._appendPacketToReadBuf(bc, p)
p_data = ''.join(p.encode())
data_edge = len(p_data) - 1
p_data_1, p_data_2 = p_data[:data_edge], p_data[data_edge:]
# append an incomplete packet, nothing is done
bc.read_buf.append(p_data_1)
bc.analyse()
self._checkPacketReceived(0)
self.assertNotEqual(len(bc.read_buf), 0)
self.assertNotEqual(len(bc.read_buf), len(p_data))
# append the rest of the packet
bc.read_buf.append(p_data_2)
bc.analyse()
# check packet decoded
self.assertEquals(len(bc._queue.mockGetNamedCalls("append")), 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