[CalendarServer-changes] [11161] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu May 9 14:29:44 PDT 2013
Revision: 11161
http://trac.calendarserver.org//changeset/11161
Author: cdaboo at apple.com
Date: 2013-05-09 14:29:44 -0700 (Thu, 09 May 2013)
Log Message:
-----------
Fixes for calverify. Fix case were bogus per-user data is present - now ignore the error and carry on.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/calverify.py
CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py
CalendarServer/trunk/twistedcaldav/datafilters/test/test_peruserdata.py
Modified: CalendarServer/trunk/calendarserver/tools/calverify.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/calverify.py 2013-05-09 19:52:52 UTC (rev 11160)
+++ CalendarServer/trunk/calendarserver/tools/calverify.py 2013-05-09 21:29:44 UTC (rev 11161)
@@ -1598,7 +1598,8 @@
# Look at each attendee in the organizer's meeting
for organizerAttendee, organizerViewOfStatus in organizerViewOfAttendees.iteritems():
- broken = False
+ missing = False
+ mismatch = False
self.matched_attendee_to_organizer[uid].add(organizerAttendee)
@@ -1627,7 +1628,7 @@
if partstat not in ("DECLINED", "CANCELLED"):
results_mismatch.append((uid, resid, organizer, org_created, org_modified, organizerAttendee, att_created, att_modified))
self.results.setdefault("Mismatch Attendee", set()).add((uid, organizer, organizerAttendee,))
- broken = True
+ mismatch = True
if self.options["details"]:
self.output.write("Mismatch: on Organizer's side:\n")
self.output.write(" UID: %s\n" % (uid,))
@@ -1638,10 +1639,10 @@
# Check that the difference is only cancelled on the attendees side
for _attendeeInstance, partstat in attendeeOwnStatus.difference(organizerViewOfStatus):
if partstat not in ("CANCELLED",):
- if not broken:
+ if not mismatch:
results_mismatch.append((uid, resid, organizer, org_created, org_modified, organizerAttendee, att_created, att_modified))
self.results.setdefault("Mismatch Attendee", set()).add((uid, organizer, organizerAttendee,))
- broken = True
+ mismatch = True
if self.options["details"]:
self.output.write("Mismatch: on Attendee's side:\n")
self.output.write(" Organizer: %s\n" % (organizer,))
@@ -1655,12 +1656,19 @@
if partstat not in ("DECLINED", "CANCELLED"):
results_missing.append((uid, resid, organizer, organizerAttendee, org_created, org_modified))
self.results.setdefault("Missing Attendee", set()).add((uid, organizer, organizerAttendee,))
- broken = True
+ missing = True
break
# If there was a problem we can fix it
- if broken and self.fix:
- yield self.fixByReinvitingAttendee(resid, attendeeResIDs.get((organizerAttendee, uid)), organizerAttendee)
+ if (missing or mismatch) and self.fix:
+ fix_result = (yield self.fixByReinvitingAttendee(resid, attendeeResIDs.get((organizerAttendee, uid)), organizerAttendee))
+ if fix_result:
+ if missing:
+ self.fixAttendeesForOrganizerMissing += 1
+ else:
+ self.fixAttendeesForOrganizerMismatch += 1
+ else:
+ self.fixFailed += 1
yield self.txn.commit()
self.txn = None
@@ -1803,7 +1811,11 @@
# If there is a mismatch we fix by re-inviting the attendee
if self.fix:
- yield self.fixByReinvitingAttendee(self.organized_byuid[uid][1], resid, attendee)
+ fix_result = (yield self.fixByReinvitingAttendee(self.organized_byuid[uid][1], resid, attendee))
+ if fix_result:
+ self.fixOrganizersForAttendeeMismatch += 1
+ else:
+ self.fixFailed += 1
yield self.txn.commit()
self.txn = None
Modified: CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py 2013-05-09 19:52:52 UTC (rev 11160)
+++ CalendarServer/trunk/twistedcaldav/datafilters/peruserdata.py 2013-05-09 21:29:44 UTC (rev 11161)
@@ -40,7 +40,7 @@
for each instance overridden by the per-user data. These per-user overridden components may not correspond to an
actual overridden component. In that situation the server has to re-construct the per-user data appropriately:
-e.g.,
+e.g.,
1. VEVENT contains an overridden instance, but X-CALENDARSERVER-PERUSER does not - server uses the must instance
X-CALENDARSERVER-PERUSER data (if any) for the overridden instance.
@@ -59,23 +59,24 @@
"""
# If any of these change also update usage in ical.py
- PERUSER_COMPONENT = "X-CALENDARSERVER-PERUSER"
- PERUSER_UID = "X-CALENDARSERVER-PERUSER-UID"
+ PERUSER_COMPONENT = "X-CALENDARSERVER-PERUSER"
+ PERUSER_UID = "X-CALENDARSERVER-PERUSER-UID"
PERINSTANCE_COMPONENT = "X-CALENDARSERVER-PERINSTANCE"
- PERUSER_PROPERTIES = ("TRANSP",)
+ PERUSER_PROPERTIES = ("TRANSP",)
PERUSER_SUBCOMPONENTS = ("VALARM",)
- IGNORE_X_PROPERTIES = ("X-CALENDARSERVER-HIDDEN-INSTANCE",)
+ IGNORE_X_PROPERTIES = ("X-CALENDARSERVER-HIDDEN-INSTANCE",)
def __init__(self, uid):
"""
-
- @param uid: unique identifier of the user for whom the data is being filtered
+
+ @param uid: unique identifier of the user for whom the data is being filtered
@type uid: C{str}
"""
-
+
self.uid = uid
-
+
+
def filter(self, ical):
"""
Filter the supplied iCalendar object using the request information.
@@ -83,10 +84,10 @@
@param ical: iCalendar object - this will be modified and returned
@type ical: L{Component} or C{str}
-
+
@return: L{Component} for the filtered calendar data
"""
-
+
# Make sure input is valid
ical = self.validCalendar(ical)
@@ -94,7 +95,7 @@
peruser_component = None
for component in tuple(ical.subcomponents()):
if component.name() == PerUserDataFilter.PERUSER_COMPONENT:
-
+
# Check user id - remove if not matches
if component.propertyValue(PerUserDataFilter.PERUSER_UID) != self.uid:
ical.removeComponent(component)
@@ -110,6 +111,7 @@
return ical
+
def merge(self, icalnew, icalold):
"""
Merge the new data with the old taking per-user information into account.
@@ -118,13 +120,13 @@
@type icalnew: L{Component} or C{str}
@param icalold: existing calendar data
@type icalold: L{Component} or C{str}
-
+
@return: L{Component} for the merged calendar data
"""
# Make sure input is valid
icalnew = self.validCalendar(icalnew)
-
+
# There cannot be any X-CALENDARSERVER-PERUSER components in the new data
for component in tuple(icalnew.subcomponents()):
if component.name() == PerUserDataFilter.PERUSER_COMPONENT:
@@ -134,13 +136,14 @@
self._splitPerUserData(icalnew)
if icalold is None:
return icalnew
-
+
# Make sure input is valid
icalold = self.validCalendar(icalold)
self._mergeRepresentations(icalnew, icalold)
return icalnew
+
def _mergeBack(self, ical, peruser):
"""
Merge the per-user data back into the main calendar data.
@@ -150,22 +153,22 @@
@param peruser: the per-user data to merge in
@type peruser: L{Component}
"""
-
+
# Iterate over each instance in the per-user data and build mapping
peruser_recurrence_map = {}
for subcomponent in peruser.subcomponents():
if subcomponent.name() != PerUserDataFilter.PERINSTANCE_COMPONENT:
raise AssertionError("Wrong sub-component '%s' in a X-CALENDARSERVER-PERUSER component" % (subcomponent.name(),))
peruser_recurrence_map[subcomponent.getRecurrenceIDUTC()] = subcomponent
-
+
ical_recurrence_set = set(ical.getComponentInstances())
peruser_recurrence_set = set(peruser_recurrence_map.keys())
-
+
# Set operations to find union and differences
union_set = ical_recurrence_set.intersection(peruser_recurrence_set)
ical_only_set = ical_recurrence_set.difference(peruser_recurrence_set)
peruser_only_set = peruser_recurrence_set.difference(ical_recurrence_set)
-
+
# For ones in per-user data but no main data, we synthesize an instance and copy over per-user data
# NB We have to do this before we do any merge that may change the master
if ical.masterComponent() is not None:
@@ -175,8 +178,9 @@
self._mergeBackComponent(ical_component, peruser_component)
ical.addComponent(ical_component)
elif peruser_only_set:
- raise AssertionError("Cannot derive a per-user instance when there is no master component.")
-
+ # We used to error out here, but instead we should silently ignore this error and keep going
+ pass
+
# Process the unions by merging in per-user data
for rid in union_set:
ical_component = ical.overriddenComponent(rid)
@@ -190,7 +194,8 @@
for rid in ical_only_set:
ical_component = ical.overriddenComponent(rid)
self._mergeBackComponent(ical_component, peruser_master)
-
+
+
def _mergeBackComponent(self, ical, peruser):
"""
Copy all properties and sub-components from per-user data into the main component
@@ -199,17 +204,18 @@
@param peruser:
@type peruser:
"""
-
+
# Each sub-component
for subcomponent in peruser.subcomponents():
ical.addComponent(subcomponent)
-
+
# Each property except RECURRENCE-ID
for property in peruser.properties():
if property.name() == "RECURRENCE-ID":
continue
ical.addProperty(property)
+
def _splitPerUserData(self, ical):
"""
Split the per-user data out of the "normal" iCalendar components into separate per-user
@@ -219,13 +225,13 @@
@param ical: calendar data to process
@type ical: L{Component}
"""
-
+
def init_peruser_component():
peruser = Component(PerUserDataFilter.PERUSER_COMPONENT)
peruser.addProperty(Property("UID", ical.resourceUID()))
peruser.addProperty(Property(PerUserDataFilter.PERUSER_UID, self.uid))
return peruser
-
+
components = tuple(ical.subcomponents())
peruser_component = init_peruser_component() if self.uid else None
perinstance_components = {}
@@ -245,7 +251,7 @@
perinstance_component.addProperty(property)
component.removeProperty(property)
perinstance_id_different = True
-
+
# Transfer per-user components from main component to per-instance component
for subcomponent in tuple(component.subcomponents()):
if subcomponent.name() in PerUserDataFilter.PERUSER_SUBCOMPONENTS or subcomponent.name().startswith("X-"):
@@ -253,10 +259,10 @@
perinstance_component.addComponent(subcomponent)
component.removeComponent(subcomponent)
perinstance_id_different = True
-
+
if perinstance_id_different and perinstance_component:
perinstance_components[rid] = perinstance_component
-
+
if self.uid:
# Add unique per-instance components into the per-user component
peruser_component_different = False
@@ -271,12 +277,13 @@
perinstance.addProperty(Property("RECURRENCE-ID", rid))
peruser_component.addComponent(perinstance)
peruser_component_different = True
-
+
if peruser_component_different:
ical.addComponent(peruser_component)
self._compactInstances(ical)
+
def _compactInstances(self, ical):
"""
Remove recurrences instances that are the same as their master-derived counterparts. This gives the most
@@ -303,17 +310,19 @@
if derived and derived == subcomponent:
ical.removeComponent(subcomponent)
+
def _mergeRepresentations(self, icalnew, icalold):
-
+
# Test for simple case first
if icalnew.isRecurring() and icalold.isRecurring():
- # Test each instance from old data to see whether it is still valid in the new one
+ # Test each instance from old data to see whether it is still valid in the new one
self._complexMerge(icalnew, icalold)
else:
self._simpleMerge(icalnew, icalold)
-
+
+
def _simpleMerge(self, icalnew, icalold):
-
+
# Take all per-user components from old and add to new, except for our user
new_recur = icalnew.isRecurring()
old_recur = icalold.isRecurring()
@@ -322,7 +331,7 @@
if component.name() == PerUserDataFilter.PERUSER_COMPONENT:
if component.propertyValue(PerUserDataFilter.PERUSER_UID) != self.uid and not new_recur_has_no_master:
newcomponent = component.duplicate()
-
+
# Only transfer the master components from the old data to the new when the old
# was recurring and the new is not recurring
if not new_recur and old_recur:
@@ -332,15 +341,16 @@
if len(tuple(newcomponent.subcomponents())):
icalnew.addComponent(newcomponent)
-
+
+
def _complexMerge(self, icalnew, icalold):
-
+
# Take all per-user components from old and add to new, except for our user
for component in icalold.subcomponents():
if component.name() == PerUserDataFilter.PERUSER_COMPONENT:
if component.propertyValue(PerUserDataFilter.PERUSER_UID) != self.uid:
newcomponent = component.duplicate()
-
+
# See which of the instances are still valid
old_rids = dict([(subcomponent.getRecurrenceIDUTC(), subcomponent,) for subcomponent in newcomponent.subcomponents()])
valid_rids = icalnew.validInstances(old_rids.keys())
Modified: CalendarServer/trunk/twistedcaldav/datafilters/test/test_peruserdata.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/datafilters/test/test_peruserdata.py 2013-05-09 19:52:52 UTC (rev 11160)
+++ CalendarServer/trunk/twistedcaldav/datafilters/test/test_peruserdata.py 2013-05-09 21:29:44 UTC (rev 11161)
@@ -122,7 +122,7 @@
class PerUserDataFilterTestNotRecurring (twistedcaldav.test.util.TestCase):
def test_public_noperuser(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -137,14 +137,15 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").filter(item)), data)
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").filter(item)), data)
+
def test_public_oneuser(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -205,7 +206,7 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").filter(item)), result01)
for item in (data, Component.fromString(data),):
@@ -238,7 +239,7 @@
class PerUserDataFilterTestRecurring (twistedcaldav.test.util.TestCase):
def test_public_noperuser(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -264,14 +265,15 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").filter(item)), data)
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").filter(item)), data)
+
def test_public_oneuser_master(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -371,7 +373,7 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").filter(item)), result01)
for item in (data, Component.fromString(data),):
@@ -379,8 +381,9 @@
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").filter(item)), result02)
+
def test_public_oneuser_master_and_override(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -489,7 +492,7 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").filter(item)), result01)
for item in (data, Component.fromString(data),):
@@ -497,8 +500,9 @@
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").filter(item)), result02)
+
def test_public_oneuser_override(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -593,7 +597,7 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").filter(item)), result01)
for item in (data, Component.fromString(data),):
@@ -601,8 +605,9 @@
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").filter(item)), result02)
+
def test_public_oneuser_master_derived_override(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -691,7 +696,7 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").filter(item)), result01)
for item in (data, Component.fromString(data),):
@@ -699,8 +704,9 @@
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").filter(item)), result02)
+
def test_public_oneuser_master_derived_override_x2(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -847,7 +853,7 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").filter(item)), result01)
for item in (data, Component.fromString(data),):
@@ -855,8 +861,9 @@
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").filter(item)), result03)
+
def test_public_oneuser_no_master_and_override(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -921,7 +928,7 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").filter(item)), result01)
for item in (data, Component.fromString(data),):
@@ -929,22 +936,44 @@
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").filter(item)), result02)
-class PerUserDataMergeTestNewNotRecurring (twistedcaldav.test.util.TestCase):
- def test_public_noperuser(self):
-
+ def test_public_oneuser_no_master_and_override_bogus_peruser(self):
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
-DTSTART:20080601T120000Z
-DTEND:20080601T130000Z
+RECURRENCE-ID:20080602T120000Z
+DTSTART:20080602T130000Z
+DTEND:20080602T140000Z
ATTENDEE:mailto:user1 at example.com
ATTENDEE:mailto:user2 at example.com
DTSTAMP:20080601T120000Z
ORGANIZER;CN=User 01:mailto:user1 at example.com
END:VEVENT
+BEGIN:X-CALENDARSERVER-PERUSER
+UID:12345-67890
+X-CALENDARSERVER-PERUSER-UID:user01
+BEGIN:X-CALENDARSERVER-PERINSTANCE
+RECURRENCE-ID:20080602T120000Z
+BEGIN:VALARM
+ACTION:DISPLAY
+DESCRIPTION:Test-override
+TRIGGER;RELATED=START:-PT10M
+END:VALARM
+TRANSP:TRANSPARENT
+END:X-CALENDARSERVER-PERINSTANCE
+BEGIN:X-CALENDARSERVER-PERINSTANCE
+RECURRENCE-ID:20080603T120000Z
+BEGIN:VALARM
+ACTION:DISPLAY
+DESCRIPTION:Test-override
+TRIGGER;RELATED=START:-PT10M
+END:VALARM
+TRANSP:TRANSPARENT
+END:X-CALENDARSERVER-PERINSTANCE
+END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
result01 = """BEGIN:VCALENDAR
@@ -952,23 +981,48 @@
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
BEGIN:VEVENT
UID:12345-67890
-DTSTART:20080601T120000Z
-DTEND:20080601T130000Z
+RECURRENCE-ID:20080602T120000Z
+DTSTART:20080602T130000Z
+DTEND:20080602T140000Z
ATTENDEE:mailto:user1 at example.com
ATTENDEE:mailto:user2 at example.com
DTSTAMP:20080601T120000Z
ORGANIZER;CN=User 01:mailto:user1 at example.com
+TRANSP:TRANSPARENT
+BEGIN:VALARM
+ACTION:DISPLAY
+DESCRIPTION:Test-override
+TRIGGER;RELATED=START:-PT10M
+END:VALARM
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+ result02 = """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080602T120000Z
+DTSTART:20080602T130000Z
+DTEND:20080602T140000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE:mailto:user2 at example.com
+DTSTAMP:20080601T120000Z
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""".replace("\n", "\r\n")
+
for item in (data, Component.fromString(data),):
- self.assertEqual(str(PerUserDataFilter("user01").merge(item, None)), result01)
+ self.assertEqual(str(PerUserDataFilter("user01").filter(item)), result01)
for item in (data, Component.fromString(data),):
- self.assertEqual(str(PerUserDataFilter("").merge(item, None)), data)
+ self.assertEqual(str(PerUserDataFilter("user02").filter(item)), result02)
+ for item in (data, Component.fromString(data),):
+ self.assertEqual(str(PerUserDataFilter("").filter(item)), result02)
+
def test_public_oneuser(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1029,14 +1083,15 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").merge(item, None)), result01)
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").merge(item, None)), result02)
+
def test_prevent_injection(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1057,7 +1112,7 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
filter = PerUserDataFilter("user01")
self.assertRaises(ValueError, filter.merge, item, None)
@@ -1065,10 +1120,12 @@
filter = PerUserDataFilter("")
self.assertRaises(ValueError, filter.merge, item, None)
+
+
class PerUserDataMergeTestNewRecurring (twistedcaldav.test.util.TestCase):
def test_public_noperuser(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1119,14 +1176,15 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").merge(item, None)), result01)
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").merge(item, None)), data)
+
def test_public_oneuser_master(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1226,14 +1284,15 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").merge(item, None)), result01)
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").merge(item, None)), result02)
+
def test_public_oneuser_master_and_override(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1342,14 +1401,15 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").merge(item, None)), result01)
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").merge(item, None)), result02)
+
def test_public_oneuser_override(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1444,14 +1504,15 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").merge(item, None)), result01)
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").merge(item, None)), result02)
+
def test_public_oneuser_master_compact_override(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1550,14 +1611,15 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").merge(item, None)), result01)
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").merge(item, None)), result02)
+
def test_public_oneuser_master_noncompact_override(self):
-
+
data = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1666,16 +1728,18 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("user01").merge(item, None)), result01)
for item in (data, Component.fromString(data),):
self.assertEqual(str(PerUserDataFilter("").merge(item, None)), result02)
+
+
class PerUserDataMergeTestExistingNotRecurring (twistedcaldav.test.util.TestCase):
def test_public_noperuser(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1718,13 +1782,14 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), newresult)
+
def test_public_oneuser(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1797,13 +1862,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1900,13 +1966,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_removal(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -1985,15 +2052,17 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
+
class PerUserDataMergeTestExistingNowRecurring (twistedcaldav.test.util.TestCase):
def test_public_noperuser_master(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -2038,13 +2107,14 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), newresult)
+
def test_public_noperuser_master_with_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -2109,13 +2179,14 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), newresult)
+
def test_public_noperuser_only_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -2160,13 +2231,14 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), newresult)
+
def test_public_oneuser_master(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -2241,13 +2313,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_oneuser_master_with_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -2357,13 +2430,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_oneuser_only_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -2441,13 +2515,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_master(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -2546,13 +2621,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_master_with_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -2686,13 +2762,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_only_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -2780,13 +2857,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_removal_master(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -2867,13 +2945,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_removal_master_with_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -2974,14 +3053,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
def test_public_twousers_removal_only_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3050,15 +3129,17 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
+
class PerUserDataMergeTestExistingWasRecurring (twistedcaldav.test.util.TestCase):
def test_public_noperuser_master(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3104,13 +3185,14 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), newresult)
+
def test_public_noperuser_master_with_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3166,13 +3248,14 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), newresult)
+
def test_public_noperuser_only_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3216,13 +3299,14 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), newresult)
+
def test_public_oneuser_master(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3296,13 +3380,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_oneuser_master_with_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3386,13 +3471,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_oneuser_only_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3467,13 +3553,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_master(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3571,13 +3658,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_master_with_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3703,13 +3791,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_only_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3797,13 +3886,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_removal_master(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3884,13 +3974,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_removal_master_with_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -3991,14 +4082,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
def test_public_twousers_removal_only_override(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -4068,15 +4159,17 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
+
class PerUserDataMergeTestBothRecurringMasterOnly (twistedcaldav.test.util.TestCase):
def test_public_noperuser(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -4122,13 +4215,14 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), newresult)
+
def test_public_oneuser(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -4204,13 +4298,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -4310,13 +4405,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_removal(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -4398,13 +4494,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_invalid_instance(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -4495,15 +4592,17 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
+
class PerUserDataMergeTestBothRecurringMasterWithOverride (twistedcaldav.test.util.TestCase):
def test_public_noperuser(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -4579,13 +4678,14 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), newresult)
+
def test_public_oneuser(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -4715,13 +4815,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -4884,13 +4985,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_removal(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -5020,15 +5122,17 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
+
class PerUserDataMergeTestBothRecurringOverrideOnly (twistedcaldav.test.util.TestCase):
def test_public_noperuser(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -5074,13 +5178,14 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), newresult)
+
def test_public_oneuser(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -5158,13 +5263,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -5255,13 +5361,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_removal(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -5333,15 +5440,17 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
+
class PerUserDataMergeTestBothRecurringSpecialCase (twistedcaldav.test.util.TestCase):
def test_public_twousers_recurrence_truncation(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -5468,13 +5577,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_recurrence_shift(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -5592,13 +5702,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_rdate_removed(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -5708,13 +5819,14 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
def test_public_twousers_exdate_added(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -5825,16 +5937,17 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
for olditem in (olddata, Component.fromString(olddata),):
for newitem in (newdata, Component.fromString(newdata),):
self.assertEqual(str(PerUserDataFilter("user01").merge(newitem, olditem)), result01)
+
class PerUserDataMergeTestCompact (twistedcaldav.test.util.TestCase):
def test_merge_vevent_compact(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -5908,7 +6021,7 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
filtered = PerUserDataFilter("user01").merge(newdata, None)
self.assertEqual(str(filtered), result)
unfiltered = PerUserDataFilter("user01").filter(filtered)
@@ -5916,7 +6029,7 @@
def test_merge_vevent_all_day_compact(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -5990,7 +6103,7 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
filtered = PerUserDataFilter("user01").merge(newdata, None)
self.assertEqual(str(filtered), result)
unfiltered = PerUserDataFilter("user01").filter(filtered)
@@ -5998,7 +6111,7 @@
def test_merge_peruser_compact(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -6073,7 +6186,7 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
filtered = PerUserDataFilter("user01").merge(newdata, None)
self.assertEqual(str(filtered), result)
unfiltered = PerUserDataFilter("user01").filter(filtered)
@@ -6081,7 +6194,7 @@
def test_merge_peruser_all_day_compact(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -6158,7 +6271,7 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
filtered = PerUserDataFilter("user01").merge(newdata, None)
self.assertEqual(str(filtered), result)
unfiltered = PerUserDataFilter("user01").filter(filtered)
@@ -6166,7 +6279,7 @@
def test_merge_both_compact(self):
-
+
newdata = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -6231,7 +6344,7 @@
END:X-CALENDARSERVER-PERUSER
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
unfiltered_result = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
@@ -6253,7 +6366,7 @@
END:VEVENT
END:VCALENDAR
""".replace("\n", "\r\n")
-
+
filtered = PerUserDataFilter("user01").merge(newdata, None)
self.assertEqual(str(filtered), result)
unfiltered = PerUserDataFilter("user01").filter(filtered)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130509/e79150db/attachment-0001.html>
More information about the calendarserver-changes
mailing list