merge of '087438694b433e2d312278234d9a1776d302326f'

and '6c5c0cfc38476abab3bbd81d781d653717c5be6d'

Monotone-Parent: 087438694b433e2d312278234d9a1776d302326f
Monotone-Parent: 6c5c0cfc38476abab3bbd81d781d653717c5be6d
Monotone-Revision: 6eb182232c54958d95899ac372dfe954dcc1b9f4

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-08-07T15:40:42
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2009-08-07 15:40:42 +00:00
6 changed files with 38 additions and 16 deletions

View File

@@ -1,3 +1,9 @@
2009-08-07 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Tests/all.py: modified to load and run all the test modules
found in the current directory, as long as they are prefixed by
"test-".
2009-08-06 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Tests/davacl.py: new functional testsuite for DAV acls on

View File

@@ -1,9 +1,19 @@
#!/usr/bin/python
import unittest
from davacl import *
from webdavsync import *
import os, unittest
if __name__ == "__main__":
unittest.main()
loader = unittest.TestLoader()
modules = []
for mod in os.listdir("."):
if mod.startswith("test-") and mod.endswith(".py"):
modules.append(mod[:-3])
__import__(mod[:-3])
if len(modules) > 0:
print "Test modules: '%s'" % "', '".join(modules)
suite = loader.loadTestsFromNames(modules)
runner = unittest.TextTestRunner()
runner.run(suite)
else:
print "No test available."

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python
from testconfig import hostname, port, username, password
from config import hostname, port, username, password
import webdavlib

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python
from testconfig import hostname, port, username, password, subscriber_username, subscriber_password
from config import hostname, port, username, password, subscriber_username, subscriber_password
import sys
import unittest
@@ -22,11 +22,11 @@ import time
# d: view date and time
# m: modify
# r: respond
# rights = { "c": create,
# "d": delete,
# "pu": public,
# "pr": private,
# "co": confidential }
# short rights notation: { "c": create,
# "d": delete,
# "pu": public,
# "pr": private,
# "co": confidential }
resource = '/SOGo/dav/%s/Calendar/test-dav-acl/' % username
@@ -103,7 +103,8 @@ class DAVAclTest(unittest.TestCase):
"C": "urn:ietf:params:xml:ns:caldav" })
return xml.xpath.Evaluate(query, None, xpath_context)
def _putEvent(self, client, filename, event_class = "PUBLIC", exp_status = 201):
def _putEvent(self, client, filename,
event_class = "PUBLIC", exp_status = 201):
url = "%s%s" % (resource, filename)
event = event_template % { "class": event_class,
"filename": filename }
@@ -179,6 +180,9 @@ class DAVAclTest(unittest.TestCase):
else:
exp_code = 403
self._deleteEvent(self.subscriber_client, "public.ics", exp_code)
self._deleteEvent(self.subscriber_client, "private.ics", exp_code)
self._deleteEvent(self.subscriber_client, "confidential.ics",
exp_code)
def _testEventRight(self, event_class, rights):
if rights.has_key(event_class):
@@ -210,7 +214,8 @@ class DAVAclTest(unittest.TestCase):
return event
def _calendarDataInMultistatus(self, top_node, filename, response_tag = "D:response"):
def _calendarDataInMultistatus(self, top_node, filename,
response_tag = "D:response"):
event = None
response_nodes = self._xpath_query("/D:multistatus/%s" % response_tag,
@@ -310,7 +315,8 @@ class DAVAclTest(unittest.TestCase):
"PRODID": "-//Inverse//Event Generator//EN",
"SEQUENCE": "0",
"TRANSP": "OPAQUE",
"UID": "12345-%s-%s.ics" % (icsClass, icsClass.lower()),
"UID": "12345-%s-%s.ics" % (icsClass,
icsClass.lower()),
"SUMMARY": "(%s event)" % icsClass.capitalize(),
"DTSTART": "20090805T100000Z",
"DTEND": "20090805T140000Z",

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python
from testconfig import hostname, port, username, password
from config import hostname, port, username, password
import sys
import unittest