From cf40c1951f4f0f26090226fb4969ca147341a031 Mon Sep 17 00:00:00 2001 From: mike Date: Fri, 02 Oct 2009 22:24:56 +0000 Subject: LP 439980 : Refactored the XMLSerializer to support complex components; Corrected specs for the addons properties and constructor parameters names; Moved all existing actions and events to components (except a few left in code for testing purposes) --- (limited to 'tests/bundlertests.py') diff --git a/tests/bundlertests.py b/tests/bundlertests.py index 8da2310..ad8d1bb 100644 --- a/tests/bundlertests.py +++ b/tests/bundlertests.py @@ -26,7 +26,76 @@ import unittest import os import uuid -from sugar.tutorius import bundler +from sugar.tutorius import bundler + +##class VaultTests(unittest.TestCase): +## def setUp(self): +## pass +## +## def tearDown(self): +## pass +## +## def test_basicQuery(self): +## vault = Vault() +## +## list_metadata = vault.query(keyword='tutorial', startIndex=2, numResults=5) +## +## assert len(list_metadata) <= 5 +## +## def test_advancedQuery(self): +## vault = Vault() +## +## list_metadata = vault.query(keyword='', category='Math', startIndex=10, numResults=10) +## +## assert len(list_metadata) <= 10 +## +## pass +## +## def test_installTutorial(self): +## # Create a new tutorial +## +## +## xml_serializer = XmlSerializer() +## +## +## xml_serializer.save_fsm() +## +## def test_deleteTutorial(self): +## pass +## +## def test_saveTutorial(self): +## pass +## +## def test_readTutorial(self): +## pass +## +## def _generateSampleTutorial(self): +## """ +## Creates a new tutorial and bundles it. +## +## @return The UUID for the new tutorial. +## """ +## self._fsm = FiniteStateMachine("Sample testing FSM") +## # Add a few states +## act1 = addon.create('BubbleMessage', message="Hi", pos=[300, 450]) +## ev1 = addon.create('GtkWidgetEventFilter', "0.12.31.2.2", "clicked", "FINAL") +## act2 = addon.create('BubbleMessage', message="Second message", pos=[250, 150], tailpos=[1,2]) +## +## st1 = State("INIT") +## st1.add_action(act1) +## st1.add_event_filter(ev1) +## +## st2 = State("FINAL") +## st2.add_action(act2) +## +## self._fsm.add_state(st1) +## self._fsm.add_state(st2) +## +## xml_ser = XmlSerializer() +## +## os.makedirs(os.path.join(sugar.tutorius.bundler._get_store_root(), str(self.uuid))) +## +## # xml_ser.save_fsm(self._fsm, TUTORIAL_FILENAME, class TutorialBundlerTests(unittest.TestCase): @@ -51,15 +120,15 @@ class TutorialBundlerTests(unittest.TestCase): os.rmdir(self.guid_path) def test_add_ressource(self): - bund = bundler.TutorialBundler(self.test_guid) + bund = bundler.TutorialBundler(unicode(self.test_guid)) temp_file = open("test.txt",'w') temp_file.write('test') temp_file.close() - bund.add_resource("test.txt") + bund.add_resources("text", "test.txt") assert os.path.exists(os.path.join(self.guid_path,"test.txt")), "add_ressource did not create the file" if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main() -- cgit v0.9.1