From 888159c45f45df3ce91642b61b5d86e1e7ac9e12 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 12 Jul 2010 20:59:49 +0000 Subject: [PATCH 1/5] Fixed translation and fixed dependancy for debian packages. Monotone-Parent: 91077f9a3b3dec2d983310daef5d9923ce41255f Monotone-Revision: 56f698136f13cc3f35b72d19695a8a4606cb1c72 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2010-07-12T20:59:49 Monotone-Branch: ca.inverse.sogo --- UI/Contacts/French.lproj/Localizable.strings | 2 +- debian/control | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/UI/Contacts/French.lproj/Localizable.strings b/UI/Contacts/French.lproj/Localizable.strings index 19ad5bc4f..54638c801 100644 --- a/UI/Contacts/French.lproj/Localizable.strings +++ b/UI/Contacts/French.lproj/Localizable.strings @@ -35,7 +35,7 @@ "delete" = "Effacer"; "edit" = "Éditer"; "invalidemailwarn" = "Le champ de l'adresse électronique est invalide"; -"invaliddatewarn" = "The specified date is invalid."; +"invaliddatewarn" = "La date spécifiée est invalide."; "new" = "Nouveau"; "Preferred Phone" = "Numéro préféré"; diff --git a/debian/control b/debian/control index 71b043ad6..5f7b50e29 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Standards-Version: 3.8.2 Package: sogo Section: web Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, tmpreaper, sope4.9-libxmlsaxdriver, sope4.9-db-connector +Depends: ${shlibs:Depends}, ${misc:Depends}, tmpreaper, sope4.9-libxmlsaxdriver, sope4.9-db-connector, gnustep-make Suggests: nginx Description: a modern and scalable groupware SOGo is a groupware server built around OpenGroupware.org (OGo) and From d7d107a8cc6c7fda482a2dcfa40b7b439229e35f Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 13 Jul 2010 15:05:27 +0000 Subject: [PATCH 2/5] Monotone-Parent: 56f698136f13cc3f35b72d19695a8a4606cb1c72 Monotone-Revision: 16e84a4b9506eba9d39a96290c969eda838704a2 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-13T15:05:27 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ Tests/Integration/test-webdavsync.py | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 627c9024a..402adcb0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-07-13 Wolfgang Sourdeau + + * Tests/Integration/test-webdavsync.py (WebdavSyncTest.test): + adapted to suit the new handling of empty collections in SOGo + 2010-07-09 Francis Lachapelle * UI/WebServerResources/UIxAttendeesEditor.js (onContactKeydown): diff --git a/Tests/Integration/test-webdavsync.py b/Tests/Integration/test-webdavsync.py index 4fb44bd83..be38865da 100755 --- a/Tests/Integration/test-webdavsync.py +++ b/Tests/Integration/test-webdavsync.py @@ -51,13 +51,16 @@ class WebdavSyncTest(unittest.TestCase): self.assertTrue(token > 0) self.assertTrue(token <= int(query1.start)) - # we make sure that any token is invalid when the collection is empty + # we make sure that any token is acceoted when the collection is + # empty, but that the returned token differs query2 = webdavlib.WebDAVSyncQuery(resource, "1234", [ "getetag" ]) self.client.execute(query2) - self.assertEquals(query2.response["status"], 403) - cond_nodes = query2.response["document"].find("{DAV:}valid-sync-token") - self.assertTrue(cond_nodes is not None, - "expected 'valid-sync-token' condition error") + self.assertEquals(query2.response["status"], 207) + token_node = query2.response["document"].find("{DAV:}sync-token") + self.assertTrue(token_node is not None, + "expected 'sync-token' tag") + token = int(token_node.text) + self.assertTrue(token > 0) if __name__ == "__main__": unittest.main() From 10059831aba2d1af3a437293e30a223b169a1a5f Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 13 Jul 2010 16:02:56 +0000 Subject: [PATCH 3/5] Monotone-Parent: 16e84a4b9506eba9d39a96290c969eda838704a2 Monotone-Revision: e9d4010d6c952c0aa503fa4571a589fb91c356b5 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-13T16:02:56 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ Tests/Integration/all.py | 11 ++++++++-- Tests/Integration/sogotests.py | 23 +++++++++++++++++++++ Tests/Integration/test-caldav-scheduling.py | 5 +++-- Tests/Integration/test-config.py | 4 +++- Tests/Integration/test-davacl.py | 3 ++- Tests/Integration/test-ical.py | 3 ++- Tests/Integration/test-maildav.py | 3 ++- Tests/Integration/test-webdav.py | 3 ++- Tests/Integration/test-webdavlib.py | 3 ++- Tests/Integration/test-webdavsync.py | 4 +++- 11 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 Tests/Integration/sogotests.py diff --git a/ChangeLog b/ChangeLog index 402adcb0a..bb194c3b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-07-13 Wolfgang Sourdeau + * Tests/Integration/sogotests.py: new module overriding + certain methods from the "unittest" module in order to + automatically execute the tests in verbose mode and by displaying + a timing of the test execution. + * Tests/Integration/test-webdavsync.py (WebdavSyncTest.test): adapted to suit the new handling of empty collections in SOGo diff --git a/Tests/Integration/all.py b/Tests/Integration/all.py index 7456b5cdf..a85826788 100755 --- a/Tests/Integration/all.py +++ b/Tests/Integration/all.py @@ -1,9 +1,15 @@ #!/usr/bin/python -import os, sys, unittest, getopt, traceback +import os, sys, unittest, getopt, traceback, time import preferences +import sogotests +import unittest if __name__ == "__main__": + unittest._TextTestResult.oldStartTest = unittest._TextTestResult.startTest + unittest._TextTestResult.startTest = sogotests.UnitTestTextTestResultNewStartTest + unittest._TextTestResult.stopTest = sogotests.UnitTestTextTestResultNewStopTest + loader = unittest.TestLoader() modules = [] # Duplicated from UIxPreferences.m @@ -28,7 +34,7 @@ if __name__ == "__main__": suite = loader.loadTestsFromNames(modules) print "%d tests in modules: '%s'" % (suite.countTestCases(), "', '".join(modules)) - runner = unittest.TextTestRunner() + runner = unittest.TextTestRunner(verbosity=2) if testLanguages: prefs = preferences.preferences() @@ -49,6 +55,7 @@ if __name__ == "__main__": print "Running test in %s (%d/%d)" % \ (languages[i], i + 1, len (languages)) + runner.verbosity = 2 runner.run(suite) # Revert to the original language prefs.set ("language", userLanguage) diff --git a/Tests/Integration/sogotests.py b/Tests/Integration/sogotests.py new file mode 100644 index 000000000..becf4f78c --- /dev/null +++ b/Tests/Integration/sogotests.py @@ -0,0 +1,23 @@ +import sys +import unittest +import time + +def UnitTestTextTestResultNewStartTest(self, test): + self.xstartTime = time.time() + self.oldStartTest(test) + +def UnitTestTextTestResultNewStopTest(self, test): + unittest.TestResult.stopTest(self, test) + endTime = time.time() + delta = endTime - self.xstartTime + print " %f ms" % delta + +def runTests(): + unittest._TextTestResult.oldStartTest = unittest._TextTestResult.startTest + unittest._TextTestResult.startTest = UnitTestTextTestResultNewStartTest + unittest._TextTestResult.stopTest = UnitTestTextTestResultNewStopTest + + argv = [] + argv.extend(sys.argv) + argv.append("-v") + unittest.main(argv=argv) diff --git a/Tests/Integration/test-caldav-scheduling.py b/Tests/Integration/test-caldav-scheduling.py index 1c3b189ef..bd9ffb7c6 100755 --- a/Tests/Integration/test-caldav-scheduling.py +++ b/Tests/Integration/test-caldav-scheduling.py @@ -6,14 +6,15 @@ from config import hostname, port, username, password, attendee1, attendee1_delegate import datetime +import sogotests import sys import time import unittest +import utilities import vobject import vobject.base import vobject.icalendar import webdavlib -import utilities import StringIO import xml.etree.ElementTree @@ -475,4 +476,4 @@ class CalDAVITIPDelegationTest(unittest.TestCase): "%stest-delegation.ics" % self.attendee1_calendar, 404) if __name__ == "__main__": - unittest.main() + sogotests.runTests() diff --git a/Tests/Integration/test-config.py b/Tests/Integration/test-config.py index 49b696de0..c76af88b2 100755 --- a/Tests/Integration/test-config.py +++ b/Tests/Integration/test-config.py @@ -2,7 +2,9 @@ from config import hostname, port, username, password, mailserver, subscriber_username, attendee1, attendee1_delegate +import sogotests import unittest +import time class CalDAVITIPDelegationTest(unittest.TestCase): def testConfigPY(self): @@ -51,4 +53,4 @@ class CalDAVITIPDelegationTest(unittest.TestCase): userHash[user] = True if __name__ == "__main__": - unittest.main() + sogotests.runTests() diff --git a/Tests/Integration/test-davacl.py b/Tests/Integration/test-davacl.py index 359ba9e2d..4202e59bb 100755 --- a/Tests/Integration/test-davacl.py +++ b/Tests/Integration/test-davacl.py @@ -7,6 +7,7 @@ import unittest import webdavlib import time +import sogotests import utilities # TODO: @@ -941,4 +942,4 @@ class DAVCalendarPublicAclTest(unittest.TestCase): "resource '%s' not returned" % resource) if __name__ == "__main__": - unittest.main() + sogotests.runTests() diff --git a/Tests/Integration/test-ical.py b/Tests/Integration/test-ical.py index 51831fb86..3d314f28c 100755 --- a/Tests/Integration/test-ical.py +++ b/Tests/Integration/test-ical.py @@ -3,6 +3,7 @@ from config import hostname, port, username, password, subscriber_username import unittest +import sogotests import utilities import webdavlib @@ -200,4 +201,4 @@ class iCalTest(unittest.TestCase): client.execute(delete) if __name__ == "__main__": - unittest.main() + sogotests.runTests() diff --git a/Tests/Integration/test-maildav.py b/Tests/Integration/test-maildav.py index c19137d6e..ee1e4d84a 100755 --- a/Tests/Integration/test-maildav.py +++ b/Tests/Integration/test-maildav.py @@ -3,6 +3,7 @@ from config import hostname, port, username, password, mailserver, subscriber_username, subscriber_password import sys +import sogotests import unittest import webdavlib import time @@ -673,4 +674,4 @@ class DAVMailCollectionTest(): self._deleteCollection ("test-dav-mail") if __name__ == "__main__": - unittest.main() + sogotests.runTests() diff --git a/Tests/Integration/test-webdav.py b/Tests/Integration/test-webdav.py index 375e3e9f4..f77e7ce1f 100755 --- a/Tests/Integration/test-webdav.py +++ b/Tests/Integration/test-webdav.py @@ -2,6 +2,7 @@ from config import hostname, port, username, password, subscriber_username +import sogotests import unittest import utilities import webdavlib @@ -151,4 +152,4 @@ class WebDAVTest(unittest.TestCase): propDisplayname)) if __name__ == "__main__": - unittest.main() + sogotests.runTests() diff --git a/Tests/Integration/test-webdavlib.py b/Tests/Integration/test-webdavlib.py index 20a4f6f10..781448d14 100755 --- a/Tests/Integration/test-webdavlib.py +++ b/Tests/Integration/test-webdavlib.py @@ -1,5 +1,6 @@ #!/usr/bin/python +import sogotests import unittest from webdavlib import * @@ -47,4 +48,4 @@ class HTTPUnparsedURLTest(unittest.TestCase): self.assertEquals(testURL.path, "/hooray") if __name__ == "__main__": - unittest.main() + sogotests.runTests() diff --git a/Tests/Integration/test-webdavsync.py b/Tests/Integration/test-webdavsync.py index be38865da..d26ec93fe 100755 --- a/Tests/Integration/test-webdavsync.py +++ b/Tests/Integration/test-webdavsync.py @@ -3,6 +3,7 @@ from config import hostname, port, username, password import sys +import sogotests import unittest import webdavlib import time @@ -19,6 +20,7 @@ class WebdavSyncTest(unittest.TestCase): self.client.execute(delete) def test(self): + """webdav sync""" # missing tests: # invalid tokens: negative, non-numeric, > current timestamp # non-empty collections: token validity, status codes for added, @@ -63,4 +65,4 @@ class WebdavSyncTest(unittest.TestCase): self.assertTrue(token > 0) if __name__ == "__main__": - unittest.main() + sogotests.runTests() From 9afaff4af42fe6f08762908a67a06a3225db7227 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 13 Jul 2010 17:36:32 +0000 Subject: [PATCH 4/5] Monotone-Parent: e9d4010d6c952c0aa503fa4571a589fb91c356b5 Monotone-Revision: b6518b59a7eb387bb26b065aa4b947048534a96a Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-13T17:36:32 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++ Tests/Integration/config.py.in | 2 + Tests/Integration/ev_generator.py | 92 +++++++++++++++++++++++++++++++ Tests/Integration/test-put.py | 42 ++++++++++++++ 4 files changed, 142 insertions(+) create mode 100644 Tests/Integration/ev_generator.py create mode 100755 Tests/Integration/test-put.py diff --git a/ChangeLog b/ChangeLog index bb194c3b6..90d56719c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-07-13 Wolfgang Sourdeau + * Tests/Integration/test-put.py: new test module executing X puts + based on a number of auto-generated events configured in config.py + + * Tests/Integration/ev_generator.py: new module producing + auto-generated events based on a number of days + * Tests/Integration/sogotests.py: new module overriding certain methods from the "unittest" module in order to automatically execute the tests in verbose mode and by displaying diff --git a/Tests/Integration/config.py.in b/Tests/Integration/config.py.in index 4924ecf90..c3c4a0a35 100644 --- a/Tests/Integration/config.py.in +++ b/Tests/Integration/config.py.in @@ -13,3 +13,5 @@ attendee1 = "user@domain.com" attendee1_delegate = "otheruser@domain.com" mailserver = "imaphost" + +testput_nbrdays = 30 diff --git a/Tests/Integration/ev_generator.py b/Tests/Integration/ev_generator.py new file mode 100644 index 000000000..c12dadb24 --- /dev/null +++ b/Tests/Integration/ev_generator.py @@ -0,0 +1,92 @@ +import time + +def hours(nbr): + return nbr * 3600 + +def days(nbr): + return nbr * hours(24) + +class ev_generator: + ev_templ = """ +BEGIN:VCALENDAR\r +VERSION:2.0\r +PRODID:-//Inverse//Event Generator//EN\r +CALSCALE:GREGORIAN\r +BEGIN:VTIMEZONE\r +TZID:America/Montreal\r +BEGIN:DAYLIGHT\r +TZOFFSETFROM:-0500\r +TZOFFSETTO:-0400\r +DTSTART:20070311T020000\r +RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r +TZNAME:EDT\r +END:DAYLIGHT\r +BEGIN:STANDARD\r +TZOFFSETFROM:-0400\r +TZOFFSETTO:-0500\r +DTSTART:20071104T020000\r +RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r +TZNAME:EST\r +END:STANDARD\r +END:VTIMEZONE\r +BEGIN:VEVENT\r +SEQUENCE:4\r +TRANSP:OPAQUE\r +UID:%(uid)s\r +SUMMARY:%(summary)s\r +DTSTART;TZID=America/Montreal:%(start)s\r +DTEND;TZID=America/Montreal:%(end)s\r +CREATED:20080711T231608Z\r +DTSTAMP:20080711T231640Z\r +END:VEVENT\r +END:VCALENDAR\r +""" + def __init__(self, maxDays): + self.reset(maxDays) + + def reset(self, maxDays): + self.maxDays = maxDays + self.currentDay = 0 + self.currentStart = 0 + today = time.mktime(time.localtime()) + self.firstDay = today - days(maxDays + 30) + + def _calendarDate(self, eventTime): + timeStruct = time.localtime(eventTime) + return time.strftime("%Y%m%dT%H0000", timeStruct) + + def _iterValues(self): + event = None + + if (self.currentDay < self.maxDays): + eventStart = (self.firstDay + + days(self.currentDay) + + hours(self.currentStart + 8)) + eventEnd = eventStart + hours(1) + + thatDay = time.localtime(int(eventStart)) + uid = "Event%d%d" % (eventStart, eventEnd) + summary = "%s - event %d" % (time.strftime("%Y-%m-%d", thatDay), + self.currentStart) + start = self._calendarDate(eventStart) + end = self._calendarDate(eventEnd) + event = {'uid': uid, + 'summary': summary, + 'start': start, + 'end': end} + + self.currentStart = self.currentStart + 1 + if (self.currentStart > 7): + self.currentStart = 0 + self.currentDay = self.currentDay + 1 + + return event + + def iter(self): + hasMore = False + entryValues = self._iterValues() + if (entryValues is not None): + self.event = (self.ev_templ % entryValues).strip() + hasMore = True + + return hasMore diff --git a/Tests/Integration/test-put.py b/Tests/Integration/test-put.py new file mode 100755 index 000000000..3737d4fed --- /dev/null +++ b/Tests/Integration/test-put.py @@ -0,0 +1,42 @@ +#!/usr/bin/python + +from config import hostname, port, username, password, testput_nbrdays + +import ev_generator +import sogotests +import unittest +import webdavlib + +class HTTPUnparsedURLTest(unittest.TestCase): + def __init__(self, arg): + unittest.TestCase.__init__(self, arg) + self.client = webdavlib.WebDAVClient(hostname, port, + username, password) + + def setUp(self): + self.resource = '/SOGo/dav/%s/Calendar/test-dav-put/' % username + delete = webdavlib.WebDAVDELETE(self.resource) + self.client.execute(delete) + mkcol = webdavlib.WebDAVMKCOL(self.resource) + self.client.execute(mkcol) + self.assertEquals(mkcol.response["status"], 201, + "preparation: failure creating collection" + "(code = %d)" % mkcol.response["status"]) + + def testPUT(self): + gen = ev_generator.ev_generator(testput_nbrdays) + counter = 1 + while gen.iter(): + event = gen.event + url = self.resource + "event-%d.ics" % counter + put = webdavlib.HTTPPUT(url, event) + put.content_type = "text/calendar; charset=utf-8" + self.client.execute(put) + counter = counter + 1 + + def tearDown(self): + delete = webdavlib.WebDAVDELETE(self.resource) + self.client.execute(delete) + +if __name__ == "__main__": + sogotests.runTests() From bed50b5b59b92aef504c2ef9b15b99313460ffe9 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 14 Jul 2010 14:13:10 +0000 Subject: [PATCH 5/5] Monotone-Parent: b6518b59a7eb387bb26b065aa4b947048534a96a Monotone-Revision: fadda581fd1abe4d86b55b0e83a0de4f42e41119 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-07-14T14:13:10 Monotone-Branch: ca.inverse.sogo --- debian/sogo.init | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/debian/sogo.init b/debian/sogo.init index 6f8712668..08752c989 100644 --- a/debian/sogo.init +++ b/debian/sogo.init @@ -46,40 +46,48 @@ if [ -f /etc/default/$NAME ]; then . /etc/default/$NAME fi +. /lib/lsb/init-functions + if [ ! -x $DAEMON ]; then - echo "$DAEMON is not executable." + log_failure_msg "$DAEMON is not executable." exit 1 fi -# Ensure directory's existence and permissions -install -o sogo -g adm -m 755 -d /var/run/$NAME -install -o sogo -g adm -m 750 -d /var/spool/$NAME -install -o sogo -g adm -m 750 -d /var/log/$NAME - set -e -. /lib/lsb/init-functions . /usr/share/GNUstep/Makefiles/GNUstep.sh DAEMON_OPTS="-WOWorkersCount $PREFORK -WOPidFile $PIDFILE -WOLogFile $LOGFILE" case "$1" in start) - echo -n "Starting $DESC: " - start-stop-daemon -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS || true - echo "$NAME." + log_daemon_msg "Starting $DESC" "$NAME" + + # Ensure directory's existence and permissions + install -o $USER -g adm -m 755 -d /var/run/$NAME + install -o $USER -g adm -m 750 -d /var/spool/$NAME + install -o $USER -g adm -m 750 -d /var/log/$NAME + + if ! start-stop-daemon -c $USER --quiet --start --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS + then + log_progress_msg "already running" + fi + log_end_msg 0 ;; stop) - echo -n "Stopping $DESC: " - start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON || true - echo "$NAME." + log_daemon_msg "Stopping $DESC" "$NAME" + start-stop-daemon --stop --pidfile $PIDFILE --retry=TERM/20/KILL/5 + log_end_msg 0 ;; restart) - echo -n "Restarting $DESC: " - start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON || true - sleep 1 - start-stop-daemon -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS || true - echo "$NAME." + log_daemon_msg "Restarting $DESC" "$NAME" + start-stop-daemon --stop --pidfile $PIDFILE --retry=TERM/20/KILL/5 + # Ensure directory's existence and permissions + install -o sogo -g adm -m 755 -d /var/run/$NAME + install -o sogo -g adm -m 750 -d /var/spool/$NAME + install -o sogo -g adm -m 750 -d /var/log/$NAME + start-stop-daemon -c $USER --quiet --start --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS + log_end_msg 0 ;; status) status_of_proc -p $PIDFILE "$DAEMON" $NAME && exit 0 || exit $?