From 034e36d4983da0c2d44c56d4efd9af922b2cab4e Mon Sep 17 00:00:00 2001 From: Vincent Vinet Date: Mon, 07 Dec 2009 20:50:52 +0000 Subject: pass the overlayer as a keyword argument for do, enter_editmode and subscribe, remove object store references --- (limited to 'tests') diff --git a/tests/actiontests.py b/tests/actiontests.py index 80a10f8..932c2bb 100644 --- a/tests/actiontests.py +++ b/tests/actiontests.py @@ -27,7 +27,6 @@ import gtk from sugar.tutorius import addon from sugar.tutorius.addons.triggereventfilter import * from sugar.tutorius.actions import * -from sugar.tutorius.services import ObjectStore test_props = {"prop_a":8, "prop_b":3, "prop_c":"Hi"} @@ -190,14 +189,13 @@ class ChainActionTest(unittest.TestCase): class DisableWidgetActionTests(unittest.TestCase): def test_disable(self): btn = gtk.Button() - ObjectStore().activity = btn btn.set_sensitive(True) assert btn.props.sensitive is True, "Callback should have been called" act = addon.create('DisableWidgetAction', target="0") assert btn.props.sensitive is True, "Callback should have been called again" - act.do() + act.do(activity=btn) assert btn.props.sensitive is False, "Callback should not have been called again" act.undo() assert btn.props.sensitive is True, "Callback should have been called again" @@ -280,22 +278,21 @@ class TypeTextActionTests(unittest.TestCase): activity = FakeParentWidget() widget = FakeTextEntry() activity.add_child(widget) - ObjectStore().activity = activity test_text = "This is text" action = addon.create('TypeTextAction', widgetUAM="0.0", text=test_text) - assert widget == ObjectStore().activity.get_children()[0],\ + assert widget == activity.get_children()[0],\ "The clickable widget isn't reachable from the object store \ the test cannot pass" - action.do() + action.do(activity=activity) assert widget.last_entered_line == test_text, "insert_text() should have been called by do()" - action.do() + action.do(activity=activity) assert widget.last_entered_line == test_text, "insert_text() should have been called by do()" assert len(widget.text_lines) == 2, "insert_text() should have been called twice" @@ -304,14 +301,13 @@ class TypeTextActionTests(unittest.TestCase): activity = FakeParentWidget() widget = FakeTextEntry() activity.add_child(widget) - ObjectStore().activity = activity test_text = "This is text" action = addon.create('TypeTextAction', widgetUAM="0.0", text=test_text) - assert widget == ObjectStore().activity.get_children()[0],\ + assert widget == activity.get_children()[0],\ "The clickable widget isn't reachable from the object store \ the test cannot pass" @@ -328,19 +324,18 @@ class ClickActionTests(unittest.TestCase): activity = FakeParentWidget() widget = ClickableWidget() activity.add_child(widget) - ObjectStore().activity = activity action = addon.create('ClickAction', widget="0.0") - assert widget == ObjectStore().activity.get_children()[0],\ + assert widget == activity.get_children()[0],\ "The clickable widget isn't reachable from the object store \ the test cannot pass" - action.do() + action.do(activity=activity) assert widget.click_count == 1, "clicked() should have been called by do()" - action.do() + action.do(activity=activity) assert widget.click_count == 2, "clicked() should have been called by do()" @@ -348,11 +343,10 @@ class ClickActionTests(unittest.TestCase): activity = FakeParentWidget() widget = ClickableWidget() activity.add_child(widget) - ObjectStore().activity = activity action = addon.create('ClickAction', widget="0.0") - assert widget == ObjectStore().activity.get_children()[0],\ + assert widget == activity.get_children()[0],\ "The clickable widget isn't reachable from the object store \ the test cannot pass" diff --git a/tests/probetests.py b/tests/probetests.py index 481eae3..9785e81 100644 --- a/tests/probetests.py +++ b/tests/probetests.py @@ -234,13 +234,13 @@ class ProbeTest(unittest.TestCase): assert message_box is None, "Message box should still be empty" #install 1 - address = self.probe.install(pickle.dumps(action), False) + address, addprops = pickle.loads(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), False) + address2, addprops = pickle.loads(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" -- cgit v0.9.1