Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorerick <erick@sugar-dev-erick.(none)>2009-10-30 22:22:33 (GMT)
committer erick <erick@sugar-dev-erick.(none)>2009-10-30 22:22:33 (GMT)
commita3631cdcb01879ad1d0b8ed5454a6c581ba14300 (patch)
treeaadebcab65d466b8a4155d8860b054743e3afe68 /tests
parenta023cce7ec486c85234bc25ad1740191c920d454 (diff)
parent794e7ebdcd6ab80f0cba235c46fba46b8c5c3cef (diff)
Merge branch 'master' of git://git.sugarlabs.org/tutorius/mainline
Diffstat (limited to 'tests')
-rw-r--r--tests/skip1
-rw-r--r--tests/storetests.py16
-rw-r--r--tests/utils.py49
3 files changed, 66 insertions, 0 deletions
diff --git a/tests/skip b/tests/skip
index 882d14d..3868383 100644
--- a/tests/skip
+++ b/tests/skip
@@ -1,3 +1,4 @@
+utils.py
run-tests.py
overlaytests.py
viewer.py
diff --git a/tests/storetests.py b/tests/storetests.py
index da20c00..0d1d9af 100644
--- a/tests/storetests.py
+++ b/tests/storetests.py
@@ -15,6 +15,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import unittest
+from tests.utils import skip, catch_unimplemented
from sugar.tutorius.store import *
@@ -28,32 +29,39 @@ class StoreProxyTest(unittest.TestCase):
def tearDown(self):
pass
+ @catch_unimplemented
def test_get_categories(self):
categories = self.store.get_categories()
assert isinstance(categories, list), "categories should be a list"
+ @catch_unimplemented
def test_get_tutorials(self):
self.store.get_tutorials()
+ @catch_unimplemented
def test_get_tutorial_collection(self):
collection_list = self.store.get_tutorial_collection('top5_rating')
assert isinstance(collection_list, list), "get_tutorial_collection should return a list"
+ @catch_unimplemented
def test_get_latest_version(self):
version_dict = self.store.get_latest_version([])
assert isinstance(version_dict, dict)
+ @catch_unimplemented
def test_download_tutorial(self):
tutorial = self.store.download_tutorial(g_tutorial_id)
assert tutorial is not None
+ @catch_unimplemented
def test_login(self):
assert self.store.login("unknown_user", "random_password")
+ @catch_unimplemented
def test_register_new_user(self):
user_info = {
'name' : "Albert",
@@ -66,32 +74,39 @@ class StoreProxyTest(unittest.TestCase):
class StoreProxyLoginTest(unittest.TestCase):
+ @catch_unimplemented
def setUp(self):
self.store = StoreProxy()
self.store.login("unknown_user", "random_password")
+ @catch_unimplemented
def tearDown(self):
session_id = self.store.get_session_id()
if session_id is not None:
self.store.close_session()
+ @catch_unimplemented
def test_close_session(self):
assert self.store.close_session()
+ @catch_unimplemented
def test_get_session_id(self):
session_id = self.store.get_session_id()
assert session_id is not None
+ @catch_unimplemented
def test_rate(self):
assert self.store.rate(5, g_tutorial_id)
+ @catch_unimplemented
def test_publish(self):
# TODO : We need to send in a real tutorial loaded from
# the Vault
assert self.store.publish(['This should be a real tutorial...'])
+ @catch_unimplemented
def test_unpublish(self):
# TODO : We need to send in a real tutorial loaded from
# the Vault
@@ -99,6 +114,7 @@ class StoreProxyLoginTest(unittest.TestCase):
assert self.store.unpublish(g_tutorial_id)
+ @catch_unimplemented
def test_update_published_tutorial(self):
# TODO : Run these tests with files from the Vault
self.store.publish([g_tutorial_id, 'Fake tutorial'])
diff --git a/tests/utils.py b/tests/utils.py
new file mode 100644
index 0000000..98738b8
--- /dev/null
+++ b/tests/utils.py
@@ -0,0 +1,49 @@
+# Copyright (C) 2009, Tutorius.org
+# Copyright (C) 2009, Simon Poirier <simpoir@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
+"""
+Here are some utility functions for easy tests maintenance
+"""
+
+def catch_unimplemented(fnct):
+ """
+ Decorator for globbing not implemented errors.
+ """
+ def ret(self, *args, **kwargs):
+ try:
+ fnct(self, *args, **kwargs)
+ print "PREVIOUSLY UNIMPLEMENTED TEST PASSES. REMOVE THIS DECORATOR: %s (%s.%s)"%\
+ (fnct.__name__, type(self).__module__, type(self).__name__)
+ except NotImplementedError:
+ pass
+ return ret
+
+
+def skip(msg):
+ """
+ Decorator for skipping pyunit tests.
+
+ @type msg: str
+ @param msg: reason for skipping the test
+ """
+ def ret(fnct):
+ print "SKIPPED TEST: %s (%s): %s"%(fnct.__name__, fnct.__module__, msg)
+ return ret
+
+
+# vim:set ts=4 sts=4 sw=4 et:
+