Monotone-Parent: fadda581fd1abe4d86b55b0e83a0de4f42e41119

Monotone-Revision: 9b5cf1dad0f0c1ebc67a93241e06b486406df417

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-07-14T20:37:38
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-07-14 20:37:38 +00:00
parent bed50b5b59
commit 100285f763
2 changed files with 52 additions and 15 deletions
+9
View File
@@ -1,3 +1,12 @@
2010-07-14 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Tests/Integration/test-davacl.py
(DAVCalendarAclTest._testEventIsSecureVersion): accept a differing
SUMMARY since it will always change depending on the user's
language and is a pain to adapt.
(DAVCalendarPublicAclTest.testCollectionAccessNormalUser): added
code to accept and handle the XML and ICS calendar variants.
2010-07-13 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Tests/Integration/test-put.py: new test module executing X puts
+43 -15
View File
@@ -484,7 +484,8 @@ class DAVCalendarAclTest(DAVAclTest):
for key in event_dict.keys():
self.assertTrue(expected_dict.has_key(key),
"key '%s' of secure event not expected" % key)
self.assertTrue(expected_dict[key] == event_dict[key],
self.assertTrue(expected_dict[key] == event_dict[key]
or key == "SUMMARY",
"value for key '%s' of secure does not match"
" (exp: '%s', obtained: '%s'"
% (key, expected_dict[key], event_dict[key] ))
@@ -853,13 +854,22 @@ class DAVCalendarPublicAclTest(unittest.TestCase):
acl_utility.setupRights(subscriber_username, { "c": True })
self.subscriber_client.execute(propfind)
hrefs = propfind.response["document"] \
.findall("{DAV:}response/{DAV:}href")
self.assertEquals(len(hrefs), 2, "expected two hrefs in response")
hrefs = propfind.response["document"].findall("{DAV:}response/{DAV:}href")
self.assertEquals(len(hrefs), 4,
"expected 4 hrefs in response, got %d: %s"
% (len(hrefs), ", ".join([ x.text for x in hrefs ])))
self.assertEquals(hrefs[0].text, parentColl,
"the first href is not a 'Calendar' parent coll.")
self.assertEquals(hrefs[1].text, resource,
"the 2nd href is not the accessible coll.")
resourceHrefs = { resource: False,
"%s.xml" % resource[:-1]: False,
"%s.ics" % resource[:-1]: False }
for href in hrefs[1:]:
self.assertTrue(resourceHrefs.has_key(href.text),
"received unexpected href: %s" % href.text)
self.assertFalse(resourceHrefs[href.text],
"href was returned more than once: %s" % href.text)
resourceHrefs[href.text] = True
acl_utility.setupRights(subscriber_username, {})
@@ -870,13 +880,21 @@ class DAVCalendarPublicAclTest(unittest.TestCase):
self.subscriber_client.execute(propfind)
hrefs = propfind.response["document"] \
.findall("{DAV:}response/{DAV:}href")
self.assertEquals(len(hrefs), 2,
"expected two hrefs in response: %d received" \
% len(hrefs))
self.assertEquals(len(hrefs), 4,
"expected 4 hrefs in response, got %d: %s"
% (len(hrefs), ", ".join([ x.text for x in hrefs ])))
self.assertEquals(hrefs[0].text, parentColl,
"the first href is not a 'Calendar' parent coll.")
self.assertEquals(hrefs[1].text, resource,
"the 2nd href is not the accessible coll.")
resourceHrefs = { resource: False,
"%s.xml" % resource[:-1]: False,
"%s.ics" % resource[:-1]: False }
for href in hrefs[1:]:
self.assertTrue(resourceHrefs.has_key(href.text),
"received unexpected href: %s" % href.text)
self.assertFalse(resourceHrefs[href.text],
"href was returned more than once: %s" % href.text)
resourceHrefs[href.text] = True
anonParentColl = '/SOGo/dav/public/%s/Calendar/' % username
anon_propfind = webdavlib.WebDAVPROPFIND(anonParentColl,
@@ -898,13 +916,23 @@ class DAVCalendarPublicAclTest(unittest.TestCase):
self.anon_client.execute(anon_propfind)
hrefs = anon_propfind.response["document"] \
.findall("{DAV:}response/{DAV:}href")
self.assertEquals(len(hrefs), 2, "expected 2 hrefs in response")
self.assertEquals(len(hrefs), 4,
"expected 4 hrefs in response, got %d: %s"
% (len(hrefs), ", ".join([ x.text for x in hrefs ])))
self.assertEquals(hrefs[0].text, anonParentColl,
"the first href is not a 'Calendar' parent coll.")
anonResource = '%stest-dav-acl/' % anonParentColl
self.assertEquals(hrefs[1].text, anonResource,
"expected href '%s' instead of '%s'."\
% (anonResource, hrefs[1].text))
resourceHrefs = { anonResource: False,
"%s.xml" % anonResource[:-1]: False,
"%s.ics" % anonResource[:-1]: False }
for href in hrefs[1:]:
self.assertTrue(resourceHrefs.has_key(href.text),
"received unexpected href: %s" % href.text)
self.assertFalse(resourceHrefs[href.text],
"href was returned more than once: %s" % href.text)
resourceHrefs[href.text] = True
self.subscriber_client.execute(propfind)
hrefs = propfind.response["document"] \