diff options
author | mike <michael.jmontcalm@gmail.com> | 2009-04-22 19:01:01 (GMT) |
---|---|---|
committer | mike <michael.jmontcalm@gmail.com> | 2009-04-22 19:01:01 (GMT) |
commit | dba2da918dda60778a35e992ffc8f94989272977 (patch) | |
tree | 375739a725161fe81b032bb430cd30e70539943b /src/sugar/tutorius/tests | |
parent | aa5cba82a4ae34f60bb6a5f1c585c6c13759d312 (diff) | |
parent | fc97ecd62b0a28079c91178f5257ce9d14a97a98 (diff) |
Merge branch 'jc' of ssh://mike@bobthebuilder.mine.nu:8080/home/git into jc_support
Conflicts:
source/external/source/sugar-toolkit/src/sugar/tutorius/bundler.py
source/external/source/sugar-toolkit/src/sugar/tutorius/tests/serializertests.py
Diffstat (limited to 'src/sugar/tutorius/tests')
-rwxr-xr-x | src/sugar/tutorius/tests/run-tests.py | 1 | ||||
-rw-r--r-- | src/sugar/tutorius/tests/serializertests.py | 23 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/sugar/tutorius/tests/run-tests.py b/src/sugar/tutorius/tests/run-tests.py index 0c9219b..6f22fee 100755 --- a/src/sugar/tutorius/tests/run-tests.py +++ b/src/sugar/tutorius/tests/run-tests.py @@ -48,5 +48,6 @@ if __name__=='__main__': from servicestests import * from gtkutilstests import * from overlaytests import * + from serializertests import * unittest.main() diff --git a/src/sugar/tutorius/tests/serializertests.py b/src/sugar/tutorius/tests/serializertests.py index 9a21d08..0b7fabd 100644 --- a/src/sugar/tutorius/tests/serializertests.py +++ b/src/sugar/tutorius/tests/serializertests.py @@ -67,15 +67,24 @@ class XMLSerializerTest(unittest.TestCase): def test_save(self): """ Writes an FSM to disk, then compares the file to the expected results. - """ + """ + # Make the serializer believe the test is in a activity path + testpath = "/tmp/testdata/" + os.environ["SUGAR_BUNDLE_PATH"] = testpath + os.environ["SUGAR_PREFIX"] = testpath +## os.mkdir(sugar.tutorius.bundler._get_store_root()) xml_ser = XMLSerializer() - os.mkdir(os.path.join(sugar.tutorius.bundler._get_store_root(), str(self.uuid))) + os.makedirs(os.path.join(sugar.tutorius.bundler._get_store_root(), str(self.uuid))) #rpdb2.start_embedded_debugger('flakyPass') xml_ser.save_fsm(self.fsm, "fsm.xml", os.path.join(sugar.tutorius.bundler._get_store_root(), str(self.uuid))) # Compare the two files - + + #Remove test file and path (commented for testing, to uncomment) +## os.remove(testpath + os.path.join(sugar.tutorius.bundler._get_store_root(), str(self.uuid)) + "/fsm.xml") +## os.removedirs(testpath) + def test_save_and_load(self): """ Load up the written FSM and compare it with the object representation. @@ -85,13 +94,15 @@ class XMLSerializerTest(unittest.TestCase): #rpdb2.start_embedded_debugger('flakyPass') xml_ser = XMLSerializer() - rpdb2.start_embedded_debugger('pass') # This interface needs to be redone... It's not clean because there is # a responsibility mixup between the XML reader and the bundler. loaded_fsm = xml_ser.load_fsm(str(self.uuid)) # Compare the two FSMs - + assert loaded_fsm._states.get("INIT").name == self.fsm._states.get("INIT").name, \ + 'FSM underlying dictionary differ from original to pickled/reformed one' + assert loaded_fsm._states.get("LOST").name == self.fsm._states.get("Second").name, \ + 'FSM underlying dictionary differ from original to pickled/reformed one' # Helper classes to help testing class SerializerTest(unittest.TestCase): @@ -172,4 +183,4 @@ class SerializerTest(unittest.TestCase): if __name__ == "__main__": - unittest.main()
\ No newline at end of file + unittest.main() |