Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/tutorius/tests
diff options
context:
space:
mode:
authormike <michael.jmontcalm@gmail.com>2009-03-19 19:50:19 (GMT)
committer mike <michael.jmontcalm@gmail.com>2009-03-19 19:50:19 (GMT)
commit3d41146af5f136d156b5a1f0c65c553612fbd4b2 (patch)
treef0abdcf3d550263dd674ace83ec94b8312370db3 /src/sugar/tutorius/tests
parent55eb43ce0aef7de69da1f15eec3dfa31f5b8d8f0 (diff)
TutoriusV2 : Adding more tests on States (action management)
Diffstat (limited to 'src/sugar/tutorius/tests')
-rw-r--r--src/sugar/tutorius/tests/coretests.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/sugar/tutorius/tests/coretests.py b/src/sugar/tutorius/tests/coretests.py
index 6b86cb9..af3f02c 100644
--- a/src/sugar/tutorius/tests/coretests.py
+++ b/src/sugar/tutorius/tests/coretests.py
@@ -207,6 +207,38 @@ class StateTest(unittest.TestCase):
assert False, "No RuntimeWarning was raised on second set_tutorial"
except :
pass
+
+ def test_add_action(self):
+ """
+ Tests on manipulating the actions inside a state.
+ """
+ state = State("INIT")
+
+ act1 = CountAction()
+ act2 = CountAction()
+ act3 = CountAction()
+
+ # Try to add the actions
+ assert state.add_action(act1), "Could not add the first action"
+ assert state.add_action(act2), "Could not add the second action"
+ assert state.add_action(act3), "Could not add the third action"
+
+ # Try to add a second time an action that was already inserted
+ assert state.add_action(act1) == False, "Not supposed to insert an action twice"
+
+ # Fetch the associated actions
+ actions = state.get_action_list()
+
+ # Make sure all the actions are present in the state
+ assert act1 in actions and act2 in actions and act3 in actions,\
+ "The actions were not properly inserted in the state"
+
+ # Clear the list
+ state.clear_actions()
+
+ # Make sure the list of actions is empty now
+ assert len(state.get_action_list()) == 0, "Clearing of actions failed"
+
class FSMTest(unittest.TestCase):
"""