[CalendarServer-changes] [9229] CalendarServer/trunk/txdav

source_changes at macosforge.org source_changes at macosforge.org
Fri May 4 09:11:27 PDT 2012


Revision: 9229
          http://trac.macosforge.org/projects/calendarserver/changeset/9229
Author:   glyph at apple.com
Date:     2012-05-04 09:11:27 -0700 (Fri, 04 May 2012)
Log Message:
-----------
test and fix for new-transaction unshare case

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/test/common.py
    CalendarServer/trunk/txdav/caldav/datastore/test/test_file.py
    CalendarServer/trunk/txdav/common/datastore/sql.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/common.py	2012-05-04 16:10:42 UTC (rev 9228)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/common.py	2012-05-04 16:11:27 UTC (rev 9229)
@@ -1038,14 +1038,16 @@
 
 
     @inlineCallbacks
-    def test_unshareWith(self):
+    def test_unshareWith(self, commit=False):
         """
         L{ICalendar.unshareWith} will remove a previously-shared calendar from
-        anotheruser's calendar home.
+        another user's calendar home.
         """
         # XXX: ideally this would actually be using the shared calendar object
         # from the shareee's home and just calling .unshare() on it.
         yield self.test_shareWith()
+        if commit:
+            yield self.commit()
         cal = yield self.calendarUnderTest()
         other = yield self.homeUnderTest(name=OTHER_HOME_UID)
         newName = yield cal.unshareWith(other)
@@ -1058,6 +1060,16 @@
 
 
     @inlineCallbacks
+    def test_unshareWithInDifferentTransaction(self):
+        """
+        L{ICalendar.unshareWith} will remove a previously-shared calendar from
+        another user's calendar home, assuming the sharing was committed in a
+        previous transaction.
+        """
+        yield self.test_unshareWith(True)
+
+
+    @inlineCallbacks
     def test_hasCalendarResourceUIDSomewhereElse(self):
         """
         L{ICalendarHome.hasCalendarResourceUIDSomewhereElse} will determine if

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_file.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_file.py	2012-05-04 16:10:42 UTC (rev 9228)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_file.py	2012-05-04 16:11:27 UTC (rev 9229)
@@ -473,6 +473,7 @@
     test_shareWith.skip = "Not implemented for file store yet."
     test_shareAgainChangesMode = test_shareWith
     test_unshareWith = test_shareWith
+    test_unshareWithInDifferentTransaction = test_shareWith
 
 
     def test_init(self):

Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py	2012-05-04 16:10:42 UTC (rev 9228)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py	2012-05-04 16:11:27 UTC (rev 9229)
@@ -2049,7 +2049,7 @@
             Return=bind.RESOURCE_NAME,
         ).on(self._txn, resourceID=self._resourceID,
              homeID=shareeHome._resourceID))[0][0]
-        del shareeHome._sharedChildren[resourceName]
+        shareeHome._sharedChildren.pop(resourceName, None)
         returnValue(resourceName)
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120504/3a3a2ad7/attachment.html>


More information about the calendarserver-changes mailing list