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/enginetests.py') diff --git a/tests/enginetests.py b/tests/enginetests.py index 2d1e723..f24aedb 100644 --- a/tests/enginetests.py +++ b/tests/enginetests.py @@ -49,60 +49,6 @@ class MockProbeMgrMultiAddons(object): currentActivity = property(fget=lambda s:s, fset=lambda s, v: v) def run_install_cb(self, action_number, action): - self._action_installed_cb_list[action_number](action, str(uuid1())) - - def run_install_error_cb(self, action_number): - self._install_error_cb_list[action_number](Exception("Could not install action...")) - - def run_subscribe_cb(self, event_number): - self._event_subscribed_cb_list[event_number](str(uuid1())) - - def run_subscribe_error(self, event_number): - self._subscribe_error_cb_list[event_number](str(uuid1())) - - def install(self, action, action_installed_cb, error_cb): - action_address = str(uuid1()) - self.action_dict[action_address] = action - self._action_installed_cb_list.append(action_installed_cb) - self._install_error_cb_list.append(error_cb) - - def update(self, action_address, new_action): - self.action_dict[action_address] = new_action - - def uninstall(self, action_address): - del self.action_dict[action_address] - - def subscribe(self, event_name, 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_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] - break - -class MockProbeMgrMultiAddons(object): - """ - Mock probe manager that supports installing more than one action - at the time. - """ - def __init__(self): - self.action_dict = {} - self.event_dict = {} - self.event_cb_dict = {} - - self._action_installed_cb_list = [] - self._install_error_cb_list = [] - self._event_subscribed_cb_list = [] - self._subscribe_error_cb_list = [] - - currentActivity = property(fget=lambda s:s, fset=lambda s, v: v) - - def run_install_cb(self, action_number, action): self._action_installed_cb_list[action_number](str(uuid1())) def run_install_error_cb(self, action_number): @@ -112,7 +58,7 @@ class MockProbeMgrMultiAddons(object): self._event_subscribed_cb_list[event_number](str(uuid1())) def run_subscribe_error(self, event_number): - self._subscribe_error_cb_list[event_number](str(uuid1())) + self._subscribe_error_cb_list[event_number](Exception("Could not subscribe to event")) def install(self, action, action_installed_cb, error_cb): action_address = str(uuid1()) @@ -248,7 +194,6 @@ class TestInstallationStates(unittest.TestCase): self.state_name = self.tutorial.add_state() self.tutorial.update_transition(Tutorial.INITIAL_TRANSITION_NAME, None, self.state_name) - #import rpdb2; rpdb2.start_embedded_debugger('pass') self.action1 = CountAction() self.tutorial.add_action(self.state_name, self.action1) self.action2 = CountAction() -- cgit v0.9.1