From 2ae6e4cb0a5b8ca8d50eb8eed8428f74535be46d Mon Sep 17 00:00:00 2001 From: mike Date: Fri, 04 Dec 2009 02:03:00 +0000 Subject: Creator : Fixing probe tests after creator updates --- (limited to 'tests') diff --git a/tests/probetests.py b/tests/probetests.py index 37748d8..17c6afc 100644 --- a/tests/probetests.py +++ b/tests/probetests.py @@ -96,11 +96,13 @@ class MockProbeProxy(object): def isAlive(self): return self.MockAlive - def install(self, action, action_installed_cb, error_cb): + def install(self, action, action_installed_cb, error_cb, is_editing=False, editing_cb=None): self.MockAction = action self.MockAddressCallback_install = action_installed_cb self.MockInstallErrorCallback = error_cb self.MockActionUpdate = None + self.MockIsEditing = is_editing + self.MockEditCb = editing_cb return None def update(self, action_address, newaction, block=False): @@ -108,9 +110,10 @@ class MockProbeProxy(object): self.MockActionUpdate = newaction return None - def uninstall(self, action_address): + def uninstall(self, action_address, is_editing=False): self.MockAction = None self.MockActionUpdate = None + self.MockIsEditing = None return None def subscribe(self, event, notif_cb, subscribe_cb, error_cb): @@ -223,35 +226,35 @@ class ProbeTest(unittest.TestCase): assert message_box is None, "Message box should still be empty" #install 1 - address = self.probe.install(pickle.dumps(action)) + address = self.probe.install(pickle.dumps(action), False) assert type(address) == str, "install should return a string" assert message_box == (5, "woot"), "message box should have (i, s)" #install 2 action.i, action.s = (10, "ahhah!") - address2 = self.probe.install(pickle.dumps(action)) + address2 = self.probe.install(pickle.dumps(action), False) assert message_box == (10, "ahhah!"), "message box should have changed" assert address != address2, "action addresses should be different" #uninstall 2 - self.probe.uninstall(address2) + self.probe.uninstall(address2, False) assert message_box is None, "undo should clear the message box" #update action 1 with action 2 props - self.probe.update(address, pickle.dumps(action._props)) + self.probe.update(address, pickle.dumps(action._props), False) assert message_box == (10, "ahhah!"), "message box should have changed(i, s)" #ErrorCase: Update with bad address #try to update 2, should fail - self.assertRaises(KeyError, self.probe.update, address2, pickle.dumps(action._props)) + self.assertRaises(KeyError, self.probe.update, address2, pickle.dumps(action._props), False) - self.probe.uninstall(address) + self.probe.uninstall(address, False) assert message_box is None, "undo should clear the message box" message_box = "Test" #ErrorCase: Uninstall bad address (currently silent fail) #Uninstall twice should do nothing - self.probe.uninstall(address) + self.probe.uninstall(address, False) assert message_box == "Test", "undo should not have happened again" def test_events(self): @@ -458,10 +461,10 @@ class ProbeProxyTest(unittest.TestCase): #ErrorCase: Uninstall on not installed action (silent fail) #Test the uninstall - self.probeProxy.uninstall(action2_address) + self.probeProxy.uninstall(action2_address, False) assert not "uninstall" in self.mockObj.MockCall, "Uninstall should not be called if action is not installed" - self.probeProxy.uninstall(address) + self.probeProxy.uninstall(address, False) assert self.mockObj.MockCall["uninstall"]["args"][0] == address, "1 argument, the action address" def test_events(self): -- cgit v0.9.1