Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Tremblay <benoit.tremblay1@gmail.com>2009-11-06 19:01:23 (GMT)
committer Ben Tremblay <benoit.tremblay1@gmail.com>2009-11-06 19:01:23 (GMT)
commitb30a273d6d2926fb404a1e87d9e31e6ef62d0d5f (patch)
treec701cb7d23048ea5c7dd4ed55c11e7e22bd758a3
parent6ffa07d3321cd9f0514a49814c096654f75b174d (diff)
parentb8c5cca98f2b278c9ba6d81e7c3d70b01f76d95b (diff)
Merge branch 'master' of gitorious@git.sugarlabs.org:tutorius/BenTremblay-Dev into bentremblay-dev
-rw-r--r--tests/storetests.py5
-rw-r--r--tutorius/store.py20
2 files changed, 15 insertions, 10 deletions
diff --git a/tests/storetests.py b/tests/storetests.py
index 1752fe6..0c36973 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
+import uuid
from tests.utils import skip, catch_unimplemented
import random
@@ -79,7 +80,6 @@ class StoreProxyLoginTest(unittest.TestCase):
if session_id is not None:
self.store.close_session()
-
@catch_unimplemented
def test_get_session_id(self):
@@ -99,13 +99,14 @@ class StoreProxyLoginTest(unittest.TestCase):
'name': 'newtut',
'summary': 'This is a tutorial',
'filename': 'test.xml',
+ 'guid': str(uuid.uuid1()),
'homepage': 'http://google.com',
'version': '1',
'cat1': '17',
'cat2': '18',
'cat3': ''
}
- assert self.store.publish('This should be a real tutorial...', tutorial_info)
+ assert self.store.publish('This should be a real tutorial...', tutorial_info) != -1
@catch_unimplemented
def test_unpublish(self):
diff --git a/tutorius/store.py b/tutorius/store.py
index 81925ed..cf20dd0 100644
--- a/tutorius/store.py
+++ b/tutorius/store.py
@@ -323,27 +323,31 @@ class StoreProxy(object):
headers = { 'X-API-Auth' : self.api_auth_key }
response = self.conn.request_post(request_url, None, None, None, headers)
-
if self.helper.iserror(response):
- return False
+ return -1
- return True
+ return tutorial_store_id
# Otherwise, we want to publish a new tutorial
if tutorial_info == None:
- return False
+ return -1
request_url = "/%s/publish/" % (self.tutorius_api)
headers = { 'X-API-Auth' : self.api_auth_key }
response = self.conn.request_post(request_url, tutorial_info, tutorial, tutorial_info['filename'], headers)
-
+
if self.helper.iserror(response):
- return False
+ return -1
+
+ xml_response = minidom.parseString(response['body'])
+
+ id_node = xml_response.getElementsByTagName("id")[0]
+
+ id = id_node.getAttribute('value')
- return True
-
+ return id
def unpublish(self, tutorial_store_id):
"""