diff options
author | erick <erick@sugar-dev-erick.(none)> | 2009-12-05 00:19:19 (GMT) |
---|---|---|
committer | erick <erick@sugar-dev-erick.(none)> | 2009-12-05 00:19:19 (GMT) |
commit | dbf88e0f12fe015467ecf89d95a2ba4303d9f73a (patch) | |
tree | 875d5a0f321128db76de01faca006af84b72cbd4 /tests/probetests.py | |
parent | cda15f1fffcca24286867a9064d30dec662e796b (diff) | |
parent | 9a44da4488a0ff00150eb5cb114f74ba560b96a6 (diff) |
Merge branch 'master' into frame_integration
Diffstat (limited to 'tests/probetests.py')
-rw-r--r-- | tests/probetests.py | 25 |
1 files changed, 14 insertions, 11 deletions
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): |