[CalendarServer-changes] [10050] CalendarServer/branches/users/glyph/one-home-list-api

source_changes at macosforge.org source_changes at macosforge.org
Fri Nov 16 14:48:44 PST 2012


Revision: 10050
          http://trac.calendarserver.org//changeset/10050
Author:   glyph at apple.com
Date:     2012-11-16 14:48:44 -0800 (Fri, 16 Nov 2012)
Log Message:
-----------
Basic unit test for withEachCalendarHomeDo.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/one-home-list-api/txdav/caldav/datastore/test/common.py

Property Changed:
----------------
    CalendarServer/branches/users/glyph/one-home-list-api/

Modified: CalendarServer/branches/users/glyph/one-home-list-api/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/branches/users/glyph/one-home-list-api/txdav/caldav/datastore/test/common.py	2012-11-16 22:48:42 UTC (rev 10049)
+++ CalendarServer/branches/users/glyph/one-home-list-api/txdav/caldav/datastore/test/common.py	2012-11-16 22:48:44 UTC (rev 10050)
@@ -2300,3 +2300,28 @@
         additionalUIDs.add("home_attachments")
         expectedUIDs = additionalUIDs.union(requiredUIDs)
         self.assertEquals(foundUIDs, expectedUIDs)
+
+
+    @inlineCallbacks
+    def test_withEachCalendarHomeDo(self):
+        """
+        L{ICalendarStore.withEachCalendarHomeDo} executes its C{action}
+        argument repeatedly with all homes that have been craeted.
+        """
+        additionalUIDs = set('alpha-uid home2 home3 beta-uid'.split())
+        txn = self.transactionUnderTest()
+        for name in additionalUIDs:
+            yield txn.calendarHomeWithUID(name, create=True)
+        yield self.commit()
+        store = yield self.storeUnderTest()
+        def toEachCalendarHome(txn, eachHome):
+            return eachHome.createCalendarWithName("a-new-calendar")
+        result = yield store.withEachCalendarHomeDo(toEachCalendarHome)
+        self.assertEquals(result, None)
+        txn2 = self.transactionUnderTest()
+        for uid in additionalUIDs:
+            home = yield txn2.calendarHomeWithUID(uid)
+            self.assertNotIdentical(
+                None, (yield home.calendarWithName("a-new-calendar"))
+            )
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121116/e72c54a4/attachment.html>


More information about the calendarserver-changes mailing list