Commit d9f48651 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Fix base handler test:

* It now requires an app parameter
* KeyError and ValueError are no more catched  when looking for the handle
method.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1282 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 91fc9bb7
......@@ -27,7 +27,8 @@ from neo.protocol import PacketMalformedError, UnexpectedPacketError, \
class HandlerTests(NeoTestBase):
def setUp(self):
self.handler = EventHandler()
app = Mock()
self.handler = EventHandler(app)
self.fake_type = 'FAKE_PACKET_TYPE'
def setFakeMethod(self, method):
......@@ -47,17 +48,6 @@ class HandlerTests(NeoTestBase):
# all is ok
self.setFakeMethod(lambda c, p: None)
self.handler.dispatch(conn, packet)
# raise KeyError and ValueError
conn.mockCalledMethods = {}
def fake(c, p): raise KeyError
self.setFakeMethod(fake)
self.handler.dispatch(conn, packet)
self.checkErrorPacket(conn)
conn.mockCalledMethods = {}
def fake(c, p): raise ValueError
self.setFakeMethod(fake)
self.handler.dispatch(conn, packet)
self.checkErrorPacket(conn)
# raise UnexpectedPacketError
conn.mockCalledMethods = {}
def fake(c, p): raise UnexpectedPacketError('fake packet')
......
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