From 77671f444acb640ac19ac8f7f21771d216352879 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 30 Oct 2009 15:06:59 +0000 Subject: StoreProxy ready for review --- (limited to 'tests/storetests.py') diff --git a/tests/storetests.py b/tests/storetests.py index da20c00..73ac2f7 100644 --- a/tests/storetests.py +++ b/tests/storetests.py @@ -18,7 +18,7 @@ import unittest from sugar.tutorius.store import * -g_tutorial_id = '114db454-b2a1-11de-8cfc-001f5bf747dc' +g_tutorial_id = '4075' g_other_id = '47efc6ee-b2a3-11de-8cfc-001f5bf747dc' class StoreProxyTest(unittest.TestCase): @@ -36,11 +36,6 @@ class StoreProxyTest(unittest.TestCase): def test_get_tutorials(self): self.store.get_tutorials() - 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" - def test_get_latest_version(self): version_dict = self.store.get_latest_version([]) @@ -52,14 +47,13 @@ class StoreProxyTest(unittest.TestCase): assert tutorial is not None def test_login(self): - assert self.store.login("unknown_user", "random_password") + assert self.store.login("benoit.tremblay1@gmail.com", "tutorius12") def test_register_new_user(self): user_info = { - 'name' : "Albert", - 'last_name' : "The Tester", - 'location' : 'Mozambique', - 'email' : 'albertthetester@mozambique.org' + 'nickname' : "Albert2", + 'password' : "tutorius12", + 'email' : 'albertthetester2@mozambique.org' } assert self.store.register_new_user(user_info) @@ -68,7 +62,7 @@ class StoreProxyTest(unittest.TestCase): class StoreProxyLoginTest(unittest.TestCase): def setUp(self): self.store = StoreProxy() - self.store.login("unknown_user", "random_password") + self.store.login("benoit.tremblay1@gmail.com", "tutorius12") def tearDown(self): session_id = self.store.get_session_id() @@ -90,18 +84,39 @@ class StoreProxyLoginTest(unittest.TestCase): 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...']) + tutorial_info = { + 'name': 'newtut', + 'summary': 'This is a tutorial', + 'filename': 'test.xml', + 'homepage': 'http://google.com', + 'version': '1', + 'cat1': '17', + 'cat2': '18', + 'cat3': '' + } + assert self.store.publish('This should be a real tutorial...', tutorial_info) 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']) + #self.store.publish([g_tutorial_id, 'Fake tutorial']) assert self.store.unpublish(g_tutorial_id) def test_update_published_tutorial(self): # TODO : Run these tests with files from the Vault - self.store.publish([g_tutorial_id, 'Fake tutorial']) + #self.store.publish([g_tutorial_id, 'Fake tutorial']) + + tutorial_info = { + 'name': 'newtut', + 'summary': 'This is a tutorial', + 'filename': 'test.xml', + 'homepage': 'http://google.com', + 'version': '1', + 'cat1': '17', + 'cat2': '18', + 'cat3': '' + } - assert self.store.update_published_tutorial(g_tutorial_id, [g_tutorial_id, 'This is an updated tutorial']) + assert self.store.update_published_tutorial(g_tutorial_id, 'This is an updated tutorial', tutorial_info) -- cgit v0.9.1