Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormike <michael.jmontcalm@gmail.com>2009-11-25 19:14:20 (GMT)
committer mike <michael.jmontcalm@gmail.com>2009-11-25 19:14:20 (GMT)
commit4f2d6d7e1820a3e5d6d60e3100993c5f1b6fb9ad (patch)
tree5bee9b4b4d8231f845fc271d97c3e422dc2c5d0d
parentebb94ef8194ec1e9d22b979e2f5a64a2b182102f (diff)
parentd029d1b6bb4d6c269db3d8a7825be239b82807fa (diff)
Merge branch 'noblock_engine' of git://git.sugarlabs.org/tutorius/mainline into noblock_engine
Conflicts: tests/enginetests.py tutorius/engine.py tutorius/properties.py
-rw-r--r--tests/enginetests.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/enginetests.py b/tests/enginetests.py
index 7fddd15..4a8a3ca 100644
--- a/tests/enginetests.py
+++ b/tests/enginetests.py
@@ -35,6 +35,55 @@ from sugar.tutorius.actions import Action
from sugar.tutorius.filters import EventFilter
from actiontests import CountAction
+class MockProbeMgrMultiAddons(object):
+ 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](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):
"""