diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-07-25 15:44:10 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-07-25 15:44:10 -0300 |
commit | 70a3fc2dfab89066d673af53a212ae7a49ef824f (patch) | |
tree | 05ee9c11cbfff8f7e8b1426a71c8e21c10640e56 /src | |
parent | 09eb321e6040555f93ace9966da56435ff70b30a (diff) | |
parent | dcb71ea078a7f56f76bf84b352656cdfa252d677 (diff) |
Merge remote-tracking branch 'drebs/bug/3261-fix-events-doc-about-reqcbk' into develop
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/common/events/__init__.py | 8 | ||||
-rw-r--r-- | src/leap/common/events/client.py | 8 | ||||
-rw-r--r-- | src/leap/common/events/server.py | 2 | ||||
-rw-r--r-- | src/leap/common/tests/test_events.py | 20 |
4 files changed, 19 insertions, 19 deletions
diff --git a/src/leap/common/events/__init__.py b/src/leap/common/events/__init__.py index a6fe7c3..6eaf3d4 100644 --- a/src/leap/common/events/__init__.py +++ b/src/leap/common/events/__init__.py @@ -130,7 +130,7 @@ def unregister(signal, uid=None, reqcbk=None, timeout=1000): :type uid: int :param reqcbk: a callback to be called when a response from server is received - :type reqcbk: function(leap.common.events.events_pb2.EventResponse) + :type reqcbk: function(proto.UnregisterRequest, proto.EventResponse) :param timeout: the timeout for synch calls :type timeout: int @@ -162,7 +162,7 @@ def signal(signal, content="", mac_method="", mac="", reqcbk=None, :type mac: str :param reqcbk: a callback to be called when a response from server is received - :type reqcbk: function(leap.common.events.events_pb2.EventResponse) + :type reqcbk: function(proto.SignalRequest, proto.EventResponse) :param timeout: the timeout for synch calls :type timeout: int @@ -180,7 +180,7 @@ def ping_client(port, reqcbk=None, timeout=1000): :type port: int :param reqcbk: a callback to be called when a response from client is received - :type reqcbk: function(leap.common.events.events_pb2.EventResponse) + :type reqcbk: function(proto.PingRequest, proto.EventResponse) :param timeout: the timeout for synch calls :type timeout: int """ @@ -195,7 +195,7 @@ def ping_server(port=server.SERVER_PORT, reqcbk=None, timeout=1000): :type port: int :param reqcbk: a callback to be called when a response from server is received - :type reqcbk: function(leap.common.events.events_pb2.EventResponse) + :type reqcbk: function(proto.PingRequest, proto.EventResponse) :param timeout: the timeout for synch calls :type timeout: int """ diff --git a/src/leap/common/events/client.py b/src/leap/common/events/client.py index 55f14ab..4ae9bff 100644 --- a/src/leap/common/events/client.py +++ b/src/leap/common/events/client.py @@ -102,7 +102,7 @@ def register(signal, callback, uid=None, replace=False, reqcbk=None, :type replace: bool :param reqcbk: a callback to be called when a response from server is received - :type reqcbk: function(leap.common.events.events_pb2.EventResponse) + :type reqcbk: function(proto.RegisterRequest, proto.EventResponse) :param timeout: the timeout for synch calls :type timeout: int @@ -152,7 +152,7 @@ def unregister(signal, uid=None, reqcbk=None, timeout=1000): :type uid: int :param reqcbk: a callback to be called when a response from server is received - :type reqcbk: function(leap.common.events.events_pb2.EventResponse) + :type reqcbk: function(proto.UnregisterRequest, proto.EventResponse) :param timeout: the timeout for synch calls :type timeout: int @@ -211,7 +211,7 @@ def signal(signal, content="", mac_method="", mac="", reqcbk=None, :type mac: str :param reqcbk: a callback to be called when a response from server is received - :type reqcbk: function(leap.common.events.events_pb2.EventResponse) + :type reqcbk: function(proto.SignalRequest, proto.EventResponse) :param timeout: the timeout for synch calls :type timeout: int @@ -238,7 +238,7 @@ def ping(port, reqcbk=None, timeout=1000): :type port: int :param reqcbk: a callback to be called when a response from client is received - :type reqcbk: function(leap.common.events.events_pb2.EventResponse) + :type reqcbk: function(proto.PingRequest, proto.EventResponse) :param timeout: the timeout for synch calls :type timeout: int diff --git a/src/leap/common/events/server.py b/src/leap/common/events/server.py index a7d4da9..59f3454 100644 --- a/src/leap/common/events/server.py +++ b/src/leap/common/events/server.py @@ -98,7 +98,7 @@ def ping(port=SERVER_PORT, reqcbk=None, timeout=1000): :type port: int :param reqcbk: a callback to be called when a response from server is received - :type reqcbk: function(leap.common.events.events_pb2.EventResponse) + :type reqcbk: function(proto.PingRequest, proto.EventResponse) :param timeout: the timeout for synch calls :type timeout: int diff --git a/src/leap/common/tests/test_events.py b/src/leap/common/tests/test_events.py index bc04dd6..0779b2e 100644 --- a/src/leap/common/tests/test_events.py +++ b/src/leap/common/tests/test_events.py @@ -346,7 +346,7 @@ class EventsTestCase(unittest.TestCase): # executed after async register, when response is received from server def reqcbk(request, response): - flag(request.event) + flag(request.event, response.status) # callback registered by application def callback(request): @@ -357,7 +357,7 @@ class EventsTestCase(unittest.TestCase): self.assertIsNone(result) events.signal(CLIENT_UID) time.sleep(1) # wait for signal to arrive from server - flag.assert_called_once_with(CLIENT_UID) + flag.assert_called_once_with(CLIENT_UID, EventResponse.OK) def test_async_signal(self): """ @@ -367,13 +367,13 @@ class EventsTestCase(unittest.TestCase): # executed after async signal, when response is received from server def reqcbk(request, response): - flag(request.event) + flag(request.event, response.status) # passing a callback as reqcbk param makes the call asynchronous result = events.signal(CLIENT_UID, reqcbk=reqcbk) self.assertIsNone(result) time.sleep(1) # wait for signal to arrive from server - flag.assert_called_once_with(CLIENT_UID) + flag.assert_called_once_with(CLIENT_UID, EventResponse.OK) def test_async_unregister(self): """ @@ -383,7 +383,7 @@ class EventsTestCase(unittest.TestCase): # executed after async signal, when response is received from server def reqcbk(request, response): - flag(request.event) + flag(request.event, response.status) # callback registered by application def callback(request): @@ -394,7 +394,7 @@ class EventsTestCase(unittest.TestCase): result = events.unregister(CLIENT_UID, reqcbk=reqcbk) self.assertIsNone(result) time.sleep(1) # wait for signal to arrive from server - flag.assert_called_once_with(CLIENT_UID) + flag.assert_called_once_with(CLIENT_UID, EventResponse.OK) def test_async_ping_server(self): """ @@ -404,12 +404,12 @@ class EventsTestCase(unittest.TestCase): # executed after async signal, when response is received from server def reqcbk(request, response): - flag() + flag(response.status) result = events.ping_server(reqcbk=reqcbk) self.assertIsNone(result) time.sleep(1) # wait for response to arrive from server. - flag.assert_called_once_with() + flag.assert_called_once_with(EventResponse.OK) def test_async_ping_client(self): """ @@ -419,10 +419,10 @@ class EventsTestCase(unittest.TestCase): # executed after async signal, when response is received from server def reqcbk(request, response): - flag() + flag(response.status) daemon = client.ensure_client_daemon() result = events.ping_client(daemon.get_port(), reqcbk=reqcbk) self.assertIsNone(result) time.sleep(1) # wait for response to arrive from server. - flag.assert_called_once_with() + flag.assert_called_once_with(EventResponse.OK) |