Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorerick <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)
commitdbf88e0f12fe015467ecf89d95a2ba4303d9f73a (patch)
tree875d5a0f321128db76de01faca006af84b72cbd4 /tests
parentcda15f1fffcca24286867a9064d30dec662e796b (diff)
parent9a44da4488a0ff00150eb5cb114f74ba560b96a6 (diff)
Merge branch 'master' into frame_integration
Diffstat (limited to 'tests')
-rw-r--r--tests/probetests.py25
-rw-r--r--tests/propertiestests.py12
2 files changed, 20 insertions, 17 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):
diff --git a/tests/propertiestests.py b/tests/propertiestests.py
index cb8e884..49d2312 100644
--- a/tests/propertiestests.py
+++ b/tests/propertiestests.py
@@ -29,28 +29,28 @@ def try_wrong_values(obj):
try:
obj.prop = 3
assert False, "Able to insert int value in property of type %s"%typ
- except:
+ except ValueError:
pass
if typ != "float":
try:
obj.prop = 1.1
assert False, "Able to insert float value in property of type %s"%typ
- except:
+ except ValueError:
pass
if typ != "string":
try:
obj.prop = "Fake string"
assert False, "Able to insert string value in property of type %s"%typ
- except:
+ except ValueError:
pass
if typ != "array":
try:
obj.prop = [1, 2000, 3, 400]
assert False, "Able to insert array value in property of type %s"%typ
- except:
+ except ValueError:
pass
if typ != "color":
@@ -58,7 +58,7 @@ def try_wrong_values(obj):
obj.prop = [1,2,3]
if typ != "array":
assert False, "Able to insert color value in property of type %s"%typ
- except:
+ except ValueError:
pass
if typ != "boolean":
@@ -66,7 +66,7 @@ def try_wrong_values(obj):
obj.prop = True
if typ != "boolean":
assert False, "Able to set boolean value in property of type %s"%typ
- except:
+ except ValueError:
pass
class BasePropertyTest(unittest.TestCase):