propagate from branch 'ca.inverse.sogo.1_3_17' (head 8ce46d6fa7b1d1a9d12069cee3ba796d99d668d2)

to branch 'ca.inverse.sogo' (head 207a29e043f7f41c818a8697fe995a55940787fc)

Monotone-Parent: 207a29e043f7f41c818a8697fe995a55940787fc
Monotone-Parent: 8ce46d6fa7b1d1a9d12069cee3ba796d99d668d2
Monotone-Revision: cd2989d3a11079dde73d3a4890b0976e1405ebaa

Monotone-Author: jraby@inverse.ca
Monotone-Date: 2012-07-18T20:22:58
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Jean Raby 2012-07-18 20:22:58 +00:00
commit d067ddce43
5 changed files with 104 additions and 1 deletions

View File

@ -7,6 +7,15 @@
other than participation status changes.
2012-07-18 Jean Raby <jraby@inverse.ca>
* 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)

View File

@ -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

View File

@ -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"

View File

@ -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()

View File

@ -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