[CalendarServer-changes] [14954] CalendarServer/trunk/txdav/caldav/datastore

source_changes at macosforge.org source_changes at macosforge.org
Wed Jul 8 13:47:53 PDT 2015


Revision: 14954
          http://trac.calendarserver.org//changeset/14954
Author:   sagen at apple.com
Date:     2015-07-08 13:47:53 -0700 (Wed, 08 Jul 2015)
Log Message:
-----------
Verify normalization of dropbox paths is reported as a change to the client

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

Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py	2015-07-08 18:41:27 UTC (rev 14953)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py	2015-07-08 20:47:53 UTC (rev 14954)
@@ -3788,6 +3788,8 @@
                 self._componentChanged = True
 
             # Fix broken VTODOs
+            # Note: if this does recover lost organizer/attendee properties, the
+            # implicit code below will set _componentChanged
             yield self.replaceMissingToDoProperties(component, inserting, internal_state)
 
             # Handle sharing dropbox normalization

Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py	2015-07-08 18:41:27 UTC (rev 14953)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py	2015-07-08 20:47:53 UTC (rev 14954)
@@ -56,7 +56,7 @@
 from txdav.common.datastore.sql import ECALENDARTYPE, CommonObjectResource, \
     CommonStoreTransactionMonitor
 from txdav.common.datastore.sql_tables import schema, _BIND_MODE_DIRECT, \
-    _BIND_STATUS_ACCEPTED, _TRANSP_OPAQUE
+    _BIND_STATUS_ACCEPTED, _TRANSP_OPAQUE, _BIND_MODE_WRITE
 from txdav.caldav.datastore.test.common import CommonTests as CalendarCommonTests, \
     test_event_text, cal1Root
 from txdav.caldav.datastore.test.test_file import setUpCalendarStore
@@ -3291,6 +3291,70 @@
 
 
     @inlineCallbacks
+    def test_setComponent_changed_dropboxPathNormalization(self):
+        """
+        Verify we let the client know we normalized dropbox paths
+        """
+
+        dataWithout = """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//Mac OS X 10.9.1//EN
+BEGIN:VEVENT
+UID:561F5DBB-3F38-4B3A-986F-DD05CBAF554F
+DTSTART:%(now_fwd30)s
+DURATION:PT1H
+DTSTAMP:%(now)s
+SEQUENCE:1
+END:VEVENT
+END:VCALENDAR
+""".replace("\n", "\r\n")
+
+        dataWith = """BEGIN:VCALENDAR
+VERSION:2.0
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//Mac OS X 10.9.1//EN
+BEGIN:VEVENT
+UID:561F5DBB-3F38-4B3A-986F-DD05CBAF554F
+DTSTART:%(now_fwd30)s
+DURATION:PT1H
+DTSTAMP:%(now)s
+SEQUENCE:2
+X-APPLE-DROPBOX:https://example.com/calendars/users/user02/dropbox/123.dropbox
+ATTACH;VALUE=URI:https://example.com/calendars/users/user02/dropbox/123.dropbox/1.txt
+ATTACH;VALUE=URI:https://example.org/attachments/2.txt
+END:VEVENT
+END:VCALENDAR
+""".replace("\n", "\r\n")
+
+        calendarCollection = (yield self.calendarUnderTest(name="calendar", home="user01"))
+        shareeHome = (yield self.homeUnderTest(name="user02"))
+        sharedName = (yield calendarCollection.shareWith(shareeHome, _BIND_MODE_WRITE,))
+        yield self.commit()
+
+        calendar = yield self.calendarUnderTest(name=sharedName, home="user02")
+        yield calendar.createCalendarObjectWithName(
+            "attach.ics",
+            Component.fromString(dataWithout % self.dtsubs)
+        )
+
+        yield self.commit()
+
+        cobj = yield self.calendarObjectUnderTest(
+            name="attach.ics",
+            calendar_name=sharedName,
+            home="user02"
+        )
+
+        comp = Component.fromString(dataWith % self.dtsubs)
+        yield cobj.setComponent(comp)
+        comp = yield cobj.componentForUser()
+        self.assertTrue(cobj._componentChanged)
+
+        yield self.commit()
+
+
+    @inlineCallbacks
     def test_setComponent_externalPrincipal(self):
         """
         Verify attendees who are not locally hosted have X-APPLE-HOSTED-STATUS=EXTERNAL
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150708/1924bb3b/attachment.html>


More information about the calendarserver-changes mailing list