Monotone-Parent: d8678bc76a58d190f4f7fc03f138123104dfb577

Monotone-Revision: e44f8ed7f2cb0a7509257497630e18c476b9b901

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-09-20T13:42:16
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-09-20 13:42:16 +00:00
parent b2f882a898
commit d9cf3145da
3 changed files with 38 additions and 13 deletions
+1 -1
View File
@@ -1014,7 +1014,7 @@ class DAVCalendarPublicAclTest(unittest.TestCase):
"href was returned more than once: %s" % href.text)
resourceHrefs[href.text] = True
acl_utility.setupRights(subscriber_username, {})
acl_utility.setupRights(subscriber_username)
# 3. creation right added for "default user"
# subscriber_username expected to have access, but not "anonymous"
+24 -12
View File
@@ -64,22 +64,34 @@ class TestACLUtility(TestUtility):
def rightsToSOGoRights(self, rights):
self.fail("subclass must implement this method")
def setupRights(self, username, rights):
rights_str = "".join(["<%s/>"
% x for x in self.rightsToSOGoRights(rights) ])
aclQuery = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<acl-query"
+ " xmlns=\"urn:inverse:params:xml:ns:inverse-dav\">"
+ "<set-roles user=\"%s\">%s</set-roles>" % (xml.sax.saxutils.escape(username),
rights_str)
+ "</acl-query>")
def setupRights(self, username, rights = None):
if rights is not None:
rights_str = "".join(["<%s/>"
% x for x in self.rightsToSOGoRights(rights) ])
aclQuery = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<acl-query"
+ " xmlns=\"urn:inverse:params:xml:ns:inverse-dav\">"
+ "<set-roles user=\"%s\">%s</set-roles>" % (xml.sax.saxutils.escape(username),
rights_str)
+ "</acl-query>")
else:
aclQuery = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<acl-query"
+ " xmlns=\"urn:inverse:params:xml:ns:inverse-dav\">"
+ "<remove-user user=\"%s\"/>" % xml.sax.saxutils.escape(username)
+ "</acl-query>")
post = webdavlib.HTTPPOST(self.resource, aclQuery)
post.content_type = "application/xml; charset=\"utf-8\""
self.client.execute(post)
self.test.assertEquals(post.response["status"], 204,
"rights modification: failure to set '%s' (status: %d)"
% (rights_str, post.response["status"]))
if rights is None:
err_msg = ("rights modification: failure to remove entry (status: %d)"
% post.response["status"])
else:
err_msg = ("rights modification: failure to set '%s' (status: %d)"
% (rights_str, post.response["status"]))
self.test.assertEquals(post.response["status"], 204, err_msg)
# Calendar:
# rights: