[CalendarServer-changes] [635]
CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/
Twisted/twisted.web2.dav.test.test_acl.patch
source_changes at macosforge.org
source_changes at macosforge.org
Fri Dec 1 10:36:15 PST 2006
Revision: 635
http://trac.macosforge.org/projects/calendarserver/changeset/635
Author: wsanchez at apple.com
Date: 2006-12-01 10:36:15 -0800 (Fri, 01 Dec 2006)
Log Message:
-----------
patch acl tests
Added Paths:
-----------
CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.test.test_acl.patch
Added: CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.test.test_acl.patch
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.test.test_acl.patch (rev 0)
+++ CalendarServer/branches/users/wsanchez/provisioning-2/lib-patches/Twisted/twisted.web2.dav.test.test_acl.patch 2006-12-01 18:36:15 UTC (rev 635)
@@ -0,0 +1,69 @@
+Index: twisted/web2/dav/test/test_acl.py
+===================================================================
+--- twisted/web2/dav/test/test_acl.py (revision 18545)
++++ twisted/web2/dav/test/test_acl.py (working copy)
+@@ -30,6 +30,7 @@
+ from twisted.web2.auth import basic
+ from twisted.web2.stream import MemoryStream
+ from twisted.web2.dav import davxml
++from twisted.web2.dav.resource import DAVPrincipalCollectionResource
+ from twisted.web2.dav.util import davXMLFromStream
+ from twisted.web2.dav.auth import TwistedPasswordProperty, IPrincipal, DavRealm, TwistedPropertyChecker, AuthenticationWrapper
+
+@@ -38,6 +39,11 @@
+ from twisted.web2.dav.test.util import Site, serialize
+ from twisted.web2.dav.test.test_resource import TestResource, TestDAVPrincipalResource
+
++class TestPrincipalsCollection(DAVPrincipalCollectionResource, TestResource):
++ def __init__(self, url, children):
++ DAVPrincipalCollectionResource.__init__(self, url)
++ TestResource.__init__(self, url, children, principalCollections=(self,))
++
+ class ACL(twisted.web2.dav.test.util.TestCase):
+ """
+ RFC 3744 (WebDAV ACL) tests.
+@@ -46,8 +52,14 @@
+ if not hasattr(self, "docroot"):
+ self.docroot = self.mktemp()
+ os.mkdir(self.docroot)
+- rootresource = self.resource_class(self.docroot)
+
++ userResource = TestDAVPrincipalResource("/principals/user01")
++ userResource.writeDeadProperty(TwistedPasswordProperty("user01"))
++
++ principalCollection = TestPrincipalsCollection("/principals/", children={"user01": userResource})
++
++ rootResource = self.resource_class(self.docroot, principalCollections=(principalCollection,))
++
+ portal = Portal(DavRealm())
+ portal.registerChecker(TwistedPropertyChecker())
+
+@@ -56,26 +68,14 @@
+ loginInterfaces = (IPrincipal,)
+
+ self.site = Site(AuthenticationWrapper(
+- rootresource,
++ rootResource,
+ portal,
+ credentialFactories,
+ loginInterfaces
+ ))
+
+- rootresource.setAccessControlList(self.grant(davxml.All()))
++ rootResource.setAccessControlList(self.grant(davxml.All()))
+
+- userresource = TestDAVPrincipalResource("/principals/user01")
+- userresource.writeDeadProperty(TwistedPasswordProperty.fromString("user01"))
+-
+- rootresource.putChild(
+- "principals",
+- TestResource("/principals", {"user01": userresource})
+- )
+-
+- rootresource.writeDeadProperty(
+- davxml.PrincipalCollectionSet(davxml.HRef("/principals/"))
+- )
+-
+ for name, acl in (
+ ("none" , self.grant()),
+ ("read" , self.grant(davxml.Read())),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061201/637db26d/attachment.html
More information about the calendarserver-changes
mailing list