[CalendarServer-changes] [10571] CalendarServer/branches/users/glyph/unshare-when-access-revoked

source_changes at macosforge.org source_changes at macosforge.org
Mon Jan 28 19:28:51 PST 2013


Revision: 10571
          http://trac.calendarserver.org//changeset/10571
Author:   glyph at apple.com
Date:     2013-01-28 19:28:51 -0800 (Mon, 28 Jan 2013)
Log Message:
-----------
Finally, a test failing for the right reason.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/unshare-when-access-revoked/twistedcaldav/test/test_sharing.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/unshare-when-access-revoked/

Modified: CalendarServer/branches/users/glyph/unshare-when-access-revoked/twistedcaldav/test/test_sharing.py
===================================================================
--- CalendarServer/branches/users/glyph/unshare-when-access-revoked/twistedcaldav/test/test_sharing.py	2013-01-29 03:28:50 UTC (rev 10570)
+++ CalendarServer/branches/users/glyph/unshare-when-access-revoked/twistedcaldav/test/test_sharing.py	2013-01-29 03:28:51 UTC (rev 10571)
@@ -33,7 +33,9 @@
 from twistedcaldav.sharing import SharedCollectionMixin, WikiDirectoryService
 
 from twistedcaldav.resource import CalDAVResource
+
 from txdav.common.datastore.test.util import buildStore, StubNotifierFactory
+from txdav.caldav.icalendarstore import BIND_DIRECT
 
 
 sharedOwnerType = davxml.ResourceType.sharedownercalendar #@UndefinedVariable
@@ -774,7 +776,26 @@
         access controls for a directly shared collection, it will automatically
         un-share that collection.
         """
-        yield self.fail()
+        # Since this is a HomeTestCase, self.site.resource refers to a _calendar
+        # home_, not the actual site root.  Rummage around in the bag of state
+        # there looking for the relevant stuff to test with.
+        txn = self.site.resource._associatedTransaction
+        sharee = self.site.resource._newStoreHome
 
+        sharer = yield txn.calendarHomeWithUID("wiki-testing", create=True)
+        cal = yield sharer.calendarWithName("calendar")
+        access = "write"
+        def stubWikiAccessMethod(userID, wikiID):
+            return access
+        from twistedcaldav import sharing
+        self.patch(sharing, "getWikiAccess", stubWikiAccessMethod)
+        sharedName = yield cal.shareWith(sharee, BIND_DIRECT)
+        childNames = yield self.site.resource.listChildren()
+        self.assertIn(sharedName, childNames)
+        access = "no-access"
+        childNames = yield self.site.resource.listChildren()
+        self.assertNotIn(sharedName, childNames)
 
 
+
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130128/e957bbc8/attachment.html>


More information about the calendarserver-changes mailing list