Monotone-Parent: 16e84a4b9506eba9d39a96290c969eda838704a2

Monotone-Revision: e9d4010d6c952c0aa503fa4571a589fb91c356b5

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-07-13T16:02:56
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-07-13 16:02:56 +00:00
parent d7d107a8cc
commit 10059831ab
11 changed files with 56 additions and 11 deletions

View File

@ -1,5 +1,10 @@
2010-07-13 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2010-07-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* 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): * Tests/Integration/test-webdavsync.py (WebdavSyncTest.test):
adapted to suit the new handling of empty collections in SOGo adapted to suit the new handling of empty collections in SOGo

View File

@ -1,9 +1,15 @@
#!/usr/bin/python #!/usr/bin/python
import os, sys, unittest, getopt, traceback import os, sys, unittest, getopt, traceback, time
import preferences import preferences
import sogotests
import unittest
if __name__ == "__main__": if __name__ == "__main__":
unittest._TextTestResult.oldStartTest = unittest._TextTestResult.startTest
unittest._TextTestResult.startTest = sogotests.UnitTestTextTestResultNewStartTest
unittest._TextTestResult.stopTest = sogotests.UnitTestTextTestResultNewStopTest
loader = unittest.TestLoader() loader = unittest.TestLoader()
modules = [] modules = []
# Duplicated from UIxPreferences.m # Duplicated from UIxPreferences.m
@ -28,7 +34,7 @@ if __name__ == "__main__":
suite = loader.loadTestsFromNames(modules) suite = loader.loadTestsFromNames(modules)
print "%d tests in modules: '%s'" % (suite.countTestCases(), print "%d tests in modules: '%s'" % (suite.countTestCases(),
"', '".join(modules)) "', '".join(modules))
runner = unittest.TextTestRunner() runner = unittest.TextTestRunner(verbosity=2)
if testLanguages: if testLanguages:
prefs = preferences.preferences() prefs = preferences.preferences()
@ -49,6 +55,7 @@ if __name__ == "__main__":
print "Running test in %s (%d/%d)" % \ print "Running test in %s (%d/%d)" % \
(languages[i], i + 1, len (languages)) (languages[i], i + 1, len (languages))
runner.verbosity = 2
runner.run(suite) runner.run(suite)
# Revert to the original language # Revert to the original language
prefs.set ("language", userLanguage) prefs.set ("language", userLanguage)

View File

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

View File

@ -6,14 +6,15 @@
from config import hostname, port, username, password, attendee1, attendee1_delegate from config import hostname, port, username, password, attendee1, attendee1_delegate
import datetime import datetime
import sogotests
import sys import sys
import time import time
import unittest import unittest
import utilities
import vobject import vobject
import vobject.base import vobject.base
import vobject.icalendar import vobject.icalendar
import webdavlib import webdavlib
import utilities
import StringIO import StringIO
import xml.etree.ElementTree import xml.etree.ElementTree
@ -475,4 +476,4 @@ class CalDAVITIPDelegationTest(unittest.TestCase):
"%stest-delegation.ics" % self.attendee1_calendar, 404) "%stest-delegation.ics" % self.attendee1_calendar, 404)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() sogotests.runTests()

View File

@ -2,7 +2,9 @@
from config import hostname, port, username, password, mailserver, subscriber_username, attendee1, attendee1_delegate from config import hostname, port, username, password, mailserver, subscriber_username, attendee1, attendee1_delegate
import sogotests
import unittest import unittest
import time
class CalDAVITIPDelegationTest(unittest.TestCase): class CalDAVITIPDelegationTest(unittest.TestCase):
def testConfigPY(self): def testConfigPY(self):
@ -51,4 +53,4 @@ class CalDAVITIPDelegationTest(unittest.TestCase):
userHash[user] = True userHash[user] = True
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() sogotests.runTests()

View File

@ -7,6 +7,7 @@ import unittest
import webdavlib import webdavlib
import time import time
import sogotests
import utilities import utilities
# TODO: # TODO:
@ -941,4 +942,4 @@ class DAVCalendarPublicAclTest(unittest.TestCase):
"resource '%s' not returned" % resource) "resource '%s' not returned" % resource)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() sogotests.runTests()

View File

@ -3,6 +3,7 @@
from config import hostname, port, username, password, subscriber_username from config import hostname, port, username, password, subscriber_username
import unittest import unittest
import sogotests
import utilities import utilities
import webdavlib import webdavlib
@ -200,4 +201,4 @@ class iCalTest(unittest.TestCase):
client.execute(delete) client.execute(delete)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() sogotests.runTests()

View File

@ -3,6 +3,7 @@
from config import hostname, port, username, password, mailserver, subscriber_username, subscriber_password from config import hostname, port, username, password, mailserver, subscriber_username, subscriber_password
import sys import sys
import sogotests
import unittest import unittest
import webdavlib import webdavlib
import time import time
@ -673,4 +674,4 @@ class DAVMailCollectionTest():
self._deleteCollection ("test-dav-mail") self._deleteCollection ("test-dav-mail")
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() sogotests.runTests()

View File

@ -2,6 +2,7 @@
from config import hostname, port, username, password, subscriber_username from config import hostname, port, username, password, subscriber_username
import sogotests
import unittest import unittest
import utilities import utilities
import webdavlib import webdavlib
@ -151,4 +152,4 @@ class WebDAVTest(unittest.TestCase):
propDisplayname)) propDisplayname))
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() sogotests.runTests()

View File

@ -1,5 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
import sogotests
import unittest import unittest
from webdavlib import * from webdavlib import *
@ -47,4 +48,4 @@ class HTTPUnparsedURLTest(unittest.TestCase):
self.assertEquals(testURL.path, "/hooray") self.assertEquals(testURL.path, "/hooray")
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() sogotests.runTests()

View File

@ -3,6 +3,7 @@
from config import hostname, port, username, password from config import hostname, port, username, password
import sys import sys
import sogotests
import unittest import unittest
import webdavlib import webdavlib
import time import time
@ -19,6 +20,7 @@ class WebdavSyncTest(unittest.TestCase):
self.client.execute(delete) self.client.execute(delete)
def test(self): def test(self):
"""webdav sync"""
# missing tests: # missing tests:
# invalid tokens: negative, non-numeric, > current timestamp # invalid tokens: negative, non-numeric, > current timestamp
# non-empty collections: token validity, status codes for added, # non-empty collections: token validity, status codes for added,
@ -63,4 +65,4 @@ class WebdavSyncTest(unittest.TestCase):
self.assertTrue(token > 0) self.assertTrue(token > 0)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() sogotests.runTests()