add testcase for issue #53. proves/ fixes #53.

pull/61/head
Johannes Raggam 2012-08-26 01:14:24 +02:00
rodzic fdb33fe68d
commit 4622af7831
2 zmienionych plików z 102 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,78 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Meetup//RemoteApi//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-ORIGINAL-URL:http://www.meetup.com/DevOpsDC/events/ical/DevOpsDC/
X-WR-CALNAME:Events - DevOpsDC
BEGIN:VTIMEZONE
TZID:America/New_York
TZURL:http://tzurl.org/zoneinfo-outlook/America/New_York
X-LIC-LOCATION:America/New_York
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:EDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:EST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20120605T003759Z
DTSTART;TZID=America/New_York:20120712T183000
DTEND;TZID=America/New_York:20120712T213000
STATUS:CONFIRMED
SUMMARY:DevOps DC Meetup
DESCRIPTION:DevOpsDC\nThursday\, July 12 at 6:30 PM\n\nThis will be a joi
nt meetup / hack night with the DC jQuery Users Group. The idea behind
the hack night: Small teams consisting of at least 1 member...\n\nDeta
ils: http://www.meetup.com/DevOpsDC/events/47635522/
CLASS:PUBLIC
CREATED:20120111T120339Z
GEO:38.90;-77.01
LOCATION:Fathom Creative\, Inc. (1333 14th Street Northwest\, Washington
D.C.\, DC 20005)
URL:http://www.meetup.com/DevOpsDC/events/47635522/
LAST-MODIFIED:20120522T174406Z
UID:event_qtkfrcyqkbnb@meetup.com
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20120605T003759Z
DTSTART;TZID=America/New_York:20120911T183000
DTEND;TZID=America/New_York:20120911T213000
STATUS:CONFIRMED
SUMMARY:DevOps DC Meetup
DESCRIPTION:DevOpsDC\nTuesday\, September 11 at 6:30 PM\n\n \n\nDetails:
http://www.meetup.com/DevOpsDC/events/47635532/
CLASS:PUBLIC
CREATED:20120111T120352Z
GEO:38.90;-77.01
LOCATION:CustomInk\, LLC (7902 Westpark Drive\, McLean\, VA 22102)
URL:http://www.meetup.com/DevOpsDC/events/47635532/
LAST-MODIFIED:20120316T202210Z
UID:event_qtkfrcyqmbpb@meetup.com
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20120605T003759Z
DTSTART;TZID=America/New_York:20121113T183000
DTEND;TZID=America/New_York:20121113T213000
STATUS:CONFIRMED
SUMMARY:DevOps DC Meetup
DESCRIPTION:DevOpsDC\nTuesday\, November 13 at 6:30 PM\n\n \n\nDetails: h
ttp://www.meetup.com/DevOpsDC/events/47635552/
CLASS:PUBLIC
CREATED:20120111T120402Z
GEO:38.90;-77.01
LOCATION:CustomInk\, LLC (7902 Westpark Drive\, McLean\, VA 22102)
URL:http://www.meetup.com/DevOpsDC/events/47635552/
LAST-MODIFIED:20120316T202210Z
UID:event_qtkfrcyqpbrb@meetup.com
END:VEVENT
END:VCALENDAR

Wyświetl plik

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
import unittest2 as unittest
import icalendar
import pytz
import datetime
import os
class TestCases(unittest.TestCase):
def test_case_meetup(self):
# broken description
# see: https://github.com/collective/icalendar/issues/53
directory = os.path.dirname(__file__)
cal = icalendar.Calendar.from_ical(open(os.path.join(directory, 'case_meetup.ics'),'rb').read())
event = cal.walk('VEVENT')[0]
desc = event.get('DESCRIPTION')
self.assertTrue('July 12 at 6:30 PM' in desc.to_ical())
timezones = cal.walk('VTIMEZONE')
self.assertEqual(len(timezones), 1)
tz = timezones[0]
self.assertEqual(tz['tzid'].to_ical(), "America/New_York")