From 6686a0f73d0eaa86221f40a7074e8f5b3aac7d63 Mon Sep 17 00:00:00 2001 From: mike Date: Fri, 27 Nov 2009 00:11:21 +0000 Subject: LP 448319 : Code review changes for Probe and ProbeMan --- (limited to 'tests') diff --git a/tests/enginetests.py b/tests/enginetests.py index f24aedb..1723954 100644 --- a/tests/enginetests.py +++ b/tests/enginetests.py @@ -72,17 +72,17 @@ class MockProbeMgrMultiAddons(object): def uninstall(self, action_address): del self.action_dict[action_address] - def subscribe(self, event_name, event, notif_cb, subscribe_cb, error_cb): + def subscribe(self, event, notif_cb, subscribe_cb, error_cb): event_address = str(uuid1()) - self.event_dict[event_name] = event_address - self.event_cb_dict[event_name] = notif_cb + self.event_dict[event_address] = event + self.event_cb_dict[event_address] = notif_cb self._event_subscribed_cb_list.append(subscribe_cb) self._subscribe_error_cb_list.append(error_cb) def unsubscribe(self, address): - for (event_name, other_event) in self.event_dict.values(): - if event == othet_event: - del self.event_dict[event_name] + for (event_address, other_event) in self.event_dict.values(): + if event == other_event: + del self.event_dict[address] break class MockProbeMgr(object): @@ -110,7 +110,7 @@ class MockProbeMgr(object): def uninstall(self, action_address): self.action = None - def subscribe(self, event_name, event, notif_cb, event_sub_cb, error_cb): + def subscribe(self, event, notif_cb, event_sub_cb, error_cb): self.event = event self.cB = notif_cb self.event.install_handlers(notif_cb) diff --git a/tests/probetests.py b/tests/probetests.py index 8dbac29..37748d8 100644 --- a/tests/probetests.py +++ b/tests/probetests.py @@ -470,6 +470,7 @@ class ProbeProxyTest(unittest.TestCase): event_address = 'event1' event2 = MockAddon() event2.i, event2.s = 10, "event2" + event_address2 = 'event2' def callback(event): global message_box @@ -499,7 +500,7 @@ class ProbeProxyTest(unittest.TestCase): #ErrorCase: unsubcribe for non subscribed event #Test the unsubscribe - self.probeProxy.unsubscribe("otheraddress") + self.probeProxy.unsubscribe(event_address2) assert not "unsubscribe" in self.mockObj.MockCall, "Unsubscribe should not be called if event is not subscribeed" self.probeProxy.unsubscribe(event_address) -- cgit v0.9.1