[CalendarServer-changes] [2057]
CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/
test
source_changes at macosforge.org
source_changes at macosforge.org
Mon Dec 10 13:06:10 PST 2007
Revision: 2057
http://trac.macosforge.org/projects/calendarserver/changeset/2057
Author: cdaboo at apple.com
Date: 2007-12-10 13:06:08 -0800 (Mon, 10 Dec 2007)
Log Message:
-----------
Test that exposes the problem.
Added Paths:
-----------
CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/data/TruncatedApr01.ics
CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/data/TruncatedDec10.ics
CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/test_timezones.py
Added: CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/data/TruncatedApr01.ics
===================================================================
--- CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/data/TruncatedApr01.ics (rev 0)
+++ CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/data/TruncatedApr01.ics 2007-12-10 21:06:08 UTC (rev 2057)
@@ -0,0 +1,37 @@
+BEGIN:VCALENDAR
+METHOD:PUBLISH
+X-WR-TIMEZONE:America/New_York
+PRODID:-//Apple Inc.//iCal 3.0//EN
+CALSCALE:GREGORIAN
+X-WR-CALNAME:Work
+VERSION:2.0
+X-WR-RELCALID:3AF1C607-A090-43CF-8142-9A0D08AEF6A6
+X-APPLE-CALENDAR-COLOR:#2CA10B
+BEGIN:VTIMEZONE
+TZID:America/New_York
+BEGIN:STANDARD
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+DTSTART:19551030T020000
+RRULE:FREQ=YEARLY;UNTIL=20061029T060000Z;BYMONTH=10;BYDAY=-1SU
+TZNAME:EST
+END:STANDARD
+BEGIN:DAYLIGHT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+TZNAME:EDT
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+SEQUENCE:4
+TRANSP:OPAQUE
+UID:F756C5EB-2D97-41AA-8E70-31AC0C0217DB
+DTSTART;TZID=America/New_York:20070401T120000
+DTSTAMP:20071210T203041Z
+SUMMARY:April 1 2007
+CREATED:20071210T202739Z
+DTEND;TZID=America/New_York:20070401T130000
+END:VEVENT
+END:VCALENDAR
Added: CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/data/TruncatedDec10.ics
===================================================================
--- CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/data/TruncatedDec10.ics (rev 0)
+++ CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/data/TruncatedDec10.ics 2007-12-10 21:06:08 UTC (rev 2057)
@@ -0,0 +1,37 @@
+BEGIN:VCALENDAR
+METHOD:PUBLISH
+X-WR-TIMEZONE:America/New_York
+PRODID:-//Apple Inc.//iCal 3.0//EN
+CALSCALE:GREGORIAN
+X-WR-CALNAME:Work
+VERSION:2.0
+X-WR-RELCALID:55D44C7E-6CE5-430C-AAC5-4E062875417D
+X-APPLE-CALENDAR-COLOR:#2CA10B
+BEGIN:VTIMEZONE
+TZID:America/New_York
+BEGIN:DAYLIGHT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+DTSTART:20070311T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
+TZNAME:EDT
+END:DAYLIGHT
+BEGIN:STANDARD
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+DTSTART:20071104T020000
+RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
+TZNAME:EST
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+SEQUENCE:7
+TRANSP:OPAQUE
+UID:F756C5EB-2D97-41AA-8E70-31AC0C0217DB
+DTSTART;TZID=America/New_York:20071210T120000
+DTSTAMP:20071210T204110Z
+SUMMARY:December 10 2007
+CREATED:20071210T202739Z
+DTEND;TZID=America/New_York:20071210T130000
+END:VEVENT
+END:VCALENDAR
Added: CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/test_timezones.py
===================================================================
--- CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/test_timezones.py (rev 0)
+++ CalendarServer/branches/users/cdaboo/timezones-2054/twistedcaldav/test/test_timezones.py 2007-12-10 21:06:08 UTC (rev 2057)
@@ -0,0 +1,75 @@
+##
+# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# DRI: Cyrus Daboo, cdaboo at apple.com
+##
+
+import twistedcaldav.test.util
+from twistedcaldav.ical import Component
+from vobject.icalendar import utc
+from vobject.icalendar import registerTzid
+import datetime
+import os
+
+class Timezones (twistedcaldav.test.util.TestCase):
+ """
+ Timezone support tests
+ """
+
+ data_dir = os.path.join(os.path.dirname(__file__), "data")
+
+ def doTest(self, filename, dtstart, dtend):
+ calendar = Component.fromStream(file(os.path.join(self.data_dir, filename)))
+ if calendar.name() != "VCALENDAR": self.fail("Calendar is not a VCALENDAR")
+
+ instances = calendar.expandTimeRanges(datetime.date(2100, 1, 1))
+ for key in instances:
+ instance = instances[key]
+ start = instance.start
+ end = instance.end
+ self.assertEqual(start, dtstart)
+ self.assertEqual(end, dtend)
+ break;
+
+ def test_truncatedApr(self):
+ """
+ Properties in components
+ """
+
+ registerTzid("America/New_York", None)
+ self.doTest("TruncatedApr01.ics", datetime.datetime(2007, 04, 01, 16, 0, 0, tzinfo=utc), datetime.datetime(2007, 04, 01, 17, 0, 0, tzinfo=utc))
+
+ def test_truncatedDec(self):
+ """
+ Properties in components
+ """
+ registerTzid("America/New_York", None)
+ self.doTest("TruncatedDec10.ics", datetime.datetime(2007, 12, 10, 17, 0, 0, tzinfo=utc), datetime.datetime(2007, 12, 10, 18, 0, 0, tzinfo=utc))
+
+ def test_truncatedAprThenDec(self):
+ """
+ Properties in components
+ """
+ registerTzid("America/New_York", None)
+ self.doTest("TruncatedApr01.ics", datetime.datetime(2007, 04, 01, 16, 0, 0, tzinfo=utc), datetime.datetime(2007, 04, 01, 17, 0, 0, tzinfo=utc))
+ self.doTest("TruncatedDec10.ics", datetime.datetime(2007, 12, 10, 17, 0, 0, tzinfo=utc), datetime.datetime(2007, 12, 10, 18, 0, 0, tzinfo=utc))
+
+ def test_truncatedDecThenApr(self):
+ """
+ Properties in components
+ """
+ registerTzid("America/New_York", None)
+ self.doTest("TruncatedDec10.ics", datetime.datetime(2007, 12, 10, 17, 0, 0, tzinfo=utc), datetime.datetime(2007, 12, 10, 18, 0, 0, tzinfo=utc))
+ self.doTest("TruncatedApr01.ics", datetime.datetime(2007, 04, 01, 16, 0, 0, tzinfo=utc), datetime.datetime(2007, 04, 01, 17, 0, 0, tzinfo=utc))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20071210/2d6fac51/attachment.html
More information about the calendarserver-changes
mailing list