Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/enginetests.py80
1 files changed, 80 insertions, 0 deletions
diff --git a/tests/enginetests.py b/tests/enginetests.py
new file mode 100644
index 0000000..2cb2330
--- /dev/null
+++ b/tests/enginetests.py
@@ -0,0 +1,80 @@
+# Copyright (C) 2009, Tutorius.org
+# Copyright (C) 2009, Michael Janelle-Montcalm <michael.jmontcalm@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+"""
+Core Tests
+
+This module contains all the tests that pertain to the usage of the Tutorius
+Core. This means that the Event Filters, the Finite State Machine and all the
+related elements and interfaces are tested here.
+
+Usage of actions and event filters is tested, but not the concrete actions
+and event filters. Those are in their separate test module
+
+"""
+
+import unittest
+
+from copy import deepcopy
+
+from sugar.tutorius.tutorial import Tutorial
+from sugar.tutorius.engine import TutorialRunner
+
+from actiontests import CountAction, FakeEventFilter
+
+class MockProbeMgr(object):
+ def __init__(self):
+ self.action = None
+ self.event = None
+ self.cB = None
+
+ def doCB(self):
+ self.cB(self.event)
+
+ currentActivity = property(fget=lambda s:s, fset=lambda s, v: v)
+
+ def install(self, action, block=False):
+ self.action = action
+
+ def update(self, action, newaction, block=False):
+ self.action = newaction
+
+ def uninstall(self, action, block=False):
+ self.action = None
+
+ def subscribe(self, event, callback):
+ self.event = event
+ self.cB = callback
+ return str(event)
+
+ def unsubscribe(self, address):
+ self.event = address
+
+class TutorialRunnerTest(unittest.TestCase):
+ """
+ This class needs to test the TutorialRunner
+ """
+ def setUp(self):
+ self.pM = MockProbeMgr()
+ self.runner = TutorialRunner(self.pM)
+
+ def tearDown(self):
+ self.runner = None
+ self.pM = None
+
+
+if __name__ == "__main__":
+ unittest.main()