From dbf88e0f12fe015467ecf89d95a2ba4303d9f73a Mon Sep 17 00:00:00 2001 From: erick Date: Sat, 05 Dec 2009 00:19:19 +0000 Subject: Merge branch 'master' into frame_integration --- (limited to 'tests/probetests.py') diff --git a/tests/probetests.py b/tests/probetests.py index 92d34a6..357d223 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): @@ -224,35 +227,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): @@ -459,10 +462,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