diff --git a/ChangeLog b/ChangeLog index 4afa5d28e..2078ce707 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,15 @@ other than participation status changes. 2012-07-18 Jean Raby + * Tests/Integration/config.py.in: New config parameter: webCalendarURL + * Tests/Integration/webdavlib.py(HTTPPOST,HTTPGET): + Allow cookies in post and get requests. + * Tests/Integration/test-ui-posts.py: New test class + Currently contains only one test case which exercises addWebCalendar + + * SoObjects/Appointments/GNUmakefile: + use -Wl,--no-as-needed when linking. Fixes #1863 + * Scripts/sql-update-1.3.16_to_1.3.17-mysql.sh * Scripts/sql-update-1.3.16_to_1.3.17.sh: New scripts to expand c_cycleinfo to mediumtext or varchar(1000000) diff --git a/SoObjects/Appointments/GNUmakefile b/SoObjects/Appointments/GNUmakefile index c9b03f199..b2aedc140 100644 --- a/SoObjects/Appointments/GNUmakefile +++ b/SoObjects/Appointments/GNUmakefile @@ -59,7 +59,7 @@ Appointments_LOCALIZED_RESOURCE_FILES = Localizable.strings ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/ ADDITIONAL_LIB_DIRS += -L../../SOPE/GDLContentStore/obj/ -ADDITIONAL_LDFLAGS += -lcurl +ADDITIONAL_LDFLAGS += -Wl,--no-as-needed -lcurl -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/wobundle.make diff --git a/Tests/Integration/config.py.in b/Tests/Integration/config.py.in index 0de6d4a4f..3a7d79a55 100644 --- a/Tests/Integration/config.py.in +++ b/Tests/Integration/config.py.in @@ -32,3 +32,5 @@ sieve_port = 2000 sogo_user = "sogo" sogo_tool_path = "/usr/local/sbin/sogo-tool" + +webCalendarURL = "http://inverse.ca/sogo-integration-tests/CanadaHolidays.ics" diff --git a/Tests/Integration/test-ui-posts.py b/Tests/Integration/test-ui-posts.py new file mode 100644 index 000000000..11a5477ac --- /dev/null +++ b/Tests/Integration/test-ui-posts.py @@ -0,0 +1,75 @@ +#!/usr/bin/python + + +from config import hostname, port, username, password, \ + webCalendarURL + +import simplejson +import sogoLogin +import sogotests +import unittest +import utilities +import webdavlib +import httplib + + +class UIPostsTests(unittest.TestCase): + + def setUp(self): + self.client = webdavlib.WebDAVClient(hostname, port) + self.gcClient = webdavlib.WebDAVClient(hostname, port) + self.cookie = sogoLogin.getAuthCookie(hostname, port, username, password) + + def _urlPostData(self, client, url, data, exp_status=200): + post = webdavlib.HTTPPOST(url, data) + post.content_type = "application/x-www-form-urlencoded" + post.cookie = self.cookie + + client.execute(post) + if (exp_status is not None): + self.assertEquals(post.response["status"], exp_status) + return post.response + + def _urlGet(self, client, url, exp_status=200): + get = webdavlib.HTTPGET(url) + get.cookie = self.cookie + + client.execute(get) + if (exp_status is not None): + self.assertEquals(get.response["status"], exp_status) + return get.response + + def testAddWebCalendar(self): + """ Add Web Calendar """ + + ret=True + data = "url=%s" % webCalendarURL + calendarBaseURL="/SOGo/so/%s/Calendar" % username + addWebCalendarURL = "%s/addWebCalendar" % calendarBaseURL + response = self._urlPostData(self.client, addWebCalendarURL, data) + + respJSON = simplejson.loads(response['body']) + folderID = respJSON['folderID'] + + #sogo1:Calendar/C07-5006F300-1-370E2480 + (_, calID) = folderID.split('/', 1) + self.assertNotEqual(calID, None) + + # reload the cal + calURL = "%s/%s" % (calendarBaseURL, calID) + try: + response = self._urlGet(self.client, "%s/reload" % calURL, exp_status=None) + except httplib.BadStatusLine: + # that's bad, the server probably reset the connection. fake a 502 + response['status'] = 502 + + # cleanup our trash + self._urlPostData(self.gcClient, "%s/delete" % calURL, "", exp_status=None) + + # delayed assert to allow cal deletion on failure + self.assertEqual(response['status'], 200) + + + +if __name__ == "__main__": + sogotests.runTests() diff --git a/Tests/Integration/webdavlib.py b/Tests/Integration/webdavlib.py index 553c9d1a3..a97cc10a5 100644 --- a/Tests/Integration/webdavlib.py +++ b/Tests/Integration/webdavlib.py @@ -136,6 +136,14 @@ class HTTPSimpleQuery: class HTTPGET(HTTPSimpleQuery): method = "GET" + cookie = None + + def prepare_headers (self): + headers = HTTPSimpleQuery.prepare_headers(self) + if self.cookie: + headers["Cookie"] = self.cookie + return headers + class HTTPOPTIONS(HTTPSimpleQuery): method = "OPTIONS" @@ -168,6 +176,15 @@ class HTTPPUT(HTTPQuery): class HTTPPOST(HTTPPUT): method = "POST" + cookie = None + + def prepare_headers (self): + headers = HTTPPUT.prepare_headers(self) + if self.cookie: + headers["Cookie"] = self.cookie + return headers + + class WebDAVQuery(HTTPQuery): method = None