From d50c3cd98d6e99c7311286559136dc1a775a326d Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 02 Nov 2009 19:23:15 +0000 Subject: final version of the StoreProxy and its tests --- (limited to 'tests') diff --git a/tests/storetests.py b/tests/storetests.py index 36c623c..1752fe6 100644 --- a/tests/storetests.py +++ b/tests/storetests.py @@ -17,14 +17,15 @@ import unittest from tests.utils import skip, catch_unimplemented +import random from sugar.tutorius.store import * -g_tutorial_id = '4075' -g_other_id = '47efc6ee-b2a3-11de-8cfc-001f5bf747dc' +g_tutorial_id = '4079' +g_other_id = '4080' class StoreProxyTest(unittest.TestCase): def setUp(self): - self.store = StoreProxy() + self.store = StoreProxy("http://bobthebuilder.mine.nu/tutorius/en-US/tutorius") def tearDown(self): pass @@ -46,7 +47,7 @@ class StoreProxyTest(unittest.TestCase): @catch_unimplemented def test_download_tutorial(self): - tutorial = self.store.download_tutorial(g_tutorial_id) + tutorial = self.store.download_tutorial(g_other_id) assert tutorial is not None @@ -56,10 +57,11 @@ class StoreProxyTest(unittest.TestCase): @catch_unimplemented def test_register_new_user(self): + random_num = str(random.randint(0, 999999999)) user_info = { - 'nickname' : "Albert2", + 'nickname' : "Albert%s" % (random_num), 'password' : "tutorius12", - 'email' : 'albertthetester2@mozambique.org' + 'email' : 'albertthetester%s@mozambique.org' % (random_num) } assert self.store.register_new_user(user_info) @@ -68,8 +70,8 @@ class StoreProxyTest(unittest.TestCase): class StoreProxyLoginTest(unittest.TestCase): @catch_unimplemented def setUp(self): - self.store = StoreProxy() - self.store.login("benoit.tremblay1@gmail.com", "tutorius12") + self.store = StoreProxy("http://bobthebuilder.mine.nu/tutorius/en-US/tutorius") + self.store.login("nobody@mozilla.org", "tutorius12") @catch_unimplemented def tearDown(self): @@ -78,9 +80,6 @@ class StoreProxyLoginTest(unittest.TestCase): 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): @@ -110,11 +109,13 @@ class StoreProxyLoginTest(unittest.TestCase): @catch_unimplemented def test_unpublish(self): - # TODO : We need to send in a real tutorial loaded from - # the Vault - #self.store.publish([g_tutorial_id, 'Fake tutorial']) - assert self.store.unpublish(g_tutorial_id) + + # Republish the tutorial + self.store.publish(None, None, g_tutorial_id) + + def test_republish(self): + assert self.store.publish(None, None, g_tutorial_id) @catch_unimplemented def test_update_published_tutorial(self): @@ -123,10 +124,10 @@ class StoreProxyLoginTest(unittest.TestCase): tutorial_info = { 'name': 'newtut', - 'summary': 'This is a tutorial', + 'summary': 'This is an updated tutorial', 'filename': 'test.xml', 'homepage': 'http://google.com', - 'version': '1', + 'version': '2', 'cat1': '17', 'cat2': '18', 'cat3': '' @@ -134,3 +135,6 @@ class StoreProxyLoginTest(unittest.TestCase): assert self.store.update_published_tutorial(g_tutorial_id, 'This is an updated tutorial', tutorial_info) + def test_close_session(self): + assert self.store.close_session() + -- cgit v0.9.1