Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/tutorius/tests/serializertests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/sugar/tutorius/tests/serializertests.py')
-rw-r--r--src/sugar/tutorius/tests/serializertests.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/sugar/tutorius/tests/serializertests.py b/src/sugar/tutorius/tests/serializertests.py
index 75fe8eb..2a743e1 100644
--- a/src/sugar/tutorius/tests/serializertests.py
+++ b/src/sugar/tutorius/tests/serializertests.py
@@ -39,6 +39,28 @@ from sugar.tutorius.bundler import *
from uuid import *
import rpdb2
+class SerializerInterfaceTest(unittest.TestCase):
+ """
+ For completeness' sake.
+ """
+ def test_save(self):
+ ser = Serializer()
+
+ try:
+ ser.save_fsm(None)
+ assert False, "save_fsm() should throw an unimplemented error"
+ except:
+ pass
+
+ def test_load(self):
+ ser = Serializer()
+
+ try:
+ ser.load_fsm(str(uuid.uuid1))
+ assert False, "load_fsm() should throw an unimplemented error"
+ except:
+ pass
+
class XMLSerializerTest(unittest.TestCase):
"""
Tests the transformation of XML to FSM, then back.
@@ -104,10 +126,11 @@ class XMLSerializerTest(unittest.TestCase):
'FSM underlying dictionary differ from original to pickled/reformed one'
assert loaded_fsm._states.get("Second").name == self.fsm._states.get("Second").name, \
'FSM underlying dictionary differ from original to pickled/reformed one'
- assert loaded_fsm._states.get("INIT").get_action_list()[0].get_message() == \
- self.fsm._states.get("INIT").get_action_list()[0].get_message(), \
+ assert loaded_fsm._states.get("INIT").get_action_list()[0].message.value == \
+ self.fsm._states.get("INIT").get_action_list()[0].message.value, \
'FSM underlying State underlying Action differ from original to reformed one'
-
+ assert len(loaded_fsm.get_action_list()) == 0, "FSM should not have any actions on itself"
+
os.remove(os.path.join(sugar.tutorius.bundler._get_store_root(), str(self.uuid)) + "/fsm.xml")
if os.path.isdir(testpath):
shutil.rmtree(testpath)