Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests/actiontests.py
diff options
context:
space:
mode:
authorVincent Vinet <vince.vinet@gmail.com>2009-12-07 20:50:52 (GMT)
committer Vincent Vinet <vince.vinet@gmail.com>2009-12-07 20:52:25 (GMT)
commit034e36d4983da0c2d44c56d4efd9af922b2cab4e (patch)
tree8fc4726e09ac60cbfd64b0ee068f451144cecf3b /tests/actiontests.py
parent7e65bdb14c2b3a9e04762755a19fcdc9922291fc (diff)
pass the overlayer as a keyword argument for do, enter_editmode and subscribe, remove object store references
Diffstat (limited to 'tests/actiontests.py')
-rw-r--r--tests/actiontests.py24
1 files changed, 9 insertions, 15 deletions
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"