From b290d0384ea13319026ddcaeca5d567a2556f0e3 Mon Sep 17 00:00:00 2001 From: mike Date: Thu, 26 Nov 2009 23:03:38 +0000 Subject: LP 448319 : Code review changes 2 --- (limited to 'tests/probetests.py') diff --git a/tests/probetests.py b/tests/probetests.py index d43da8e..8dbac29 100644 --- a/tests/probetests.py +++ b/tests/probetests.py @@ -113,9 +113,8 @@ class MockProbeProxy(object): self.MockActionUpdate = None return None - def subscribe(self, event_name, event, notif_cb, subscribe_cb, error_cb): + def subscribe(self, event, notif_cb, subscribe_cb, error_cb): #Do like the current Probe - self.MockEventName = event_name self.MockEvent = event self.MockCB = notif_cb self.MockSubscribeCB = subscribe_cb @@ -383,8 +382,6 @@ class ProbeManagerTest(unittest.TestCase): act1 = self.probeManager.get_registered_probes_list("act1")[0][1] act2 = self.probeManager.get_registered_probes_list("act2")[0][1] - event_name1 = 'State0/event0' - event_name2 = 'State0/event1' ad1 = MockAddon() ad2 = MockAddon() ad2.i, ad2.s = (2, "test2") @@ -396,13 +393,13 @@ class ProbeManagerTest(unittest.TestCase): #ErrorCase: unsubscribe and subscribe without current activity #Event functions should do a warning if there is no activity - self.assertRaises(RuntimeWarning, self.probeManager.subscribe, event_name1, ad1, cb1, install_cb1, error_cb1) + self.assertRaises(RuntimeWarning, self.probeManager.subscribe, ad1, cb1, install_cb1, error_cb1) self.assertRaises(RuntimeWarning, self.probeManager.unsubscribe, None) assert act1.MockEvent is None, "No event should be on act1" assert act2.MockEvent is None, "No event should be on act2" self.probeManager.currentActivity = "act1" - self.probeManager.subscribe(event_name1, ad1, cb1, install_cb1, error_cb1) + self.probeManager.subscribe(ad1, cb1, install_cb1, error_cb1) assert act1.MockEvent == ad1, "Event should have been installed" assert act1.MockCB == cb1, "Callback should have been set" assert act2.MockEvent is None, "No event should be on act2" @@ -484,13 +481,12 @@ class ProbeProxyTest(unittest.TestCase): address = "Addr1" #Set the return value of probe subscribe self.mockObj.MockRet["subscribe"] = address - self.probeProxy.subscribe('State0/event0', event, callback, subs_cb, error_cb) - self.probeProxy._ProbeProxy__update_event('State0/event0', event, callback, subs_cb, event_address) + self.probeProxy.subscribe(event, callback, subs_cb, error_cb) + self.probeProxy._ProbeProxy__update_event(event, callback, subs_cb, event_address) assert pickle.loads(self.mockObj.MockCall["subscribe"]["args"][0]) == event, "1 argument, the event" #Call the callback with the event global message_box - #import rpdb2; rpdb2.start_embedded_debugger('pass') self.mockObj.MockCB["eventOccured"]["handler_function"](pickle.dumps(event)) assert message_box == event, "callback should have been called with event" message_box = None -- cgit v0.9.1