Skip to content

Commit

Permalink
add test with examples
Browse files Browse the repository at this point in the history
  • Loading branch information
niccokunzmann committed Aug 23, 2022
1 parent fb7c7bb commit 700f23b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 4 deletions.
33 changes: 33 additions & 0 deletions src/icalendar/tests/issue_355_url_unescaping.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ical.marudot.com//iCal Event Maker
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
LAST-MODIFIED:20201011T015911Z
TZURL:http://tzurl.org/zoneinfo-outlook/Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZNAME:CEST
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20220822T164528Z
UID:[email protected]
DTSTART;TZID=Europe/Berlin:20220822T120000
DTEND;TZID=Europe/Berlin:20220822T120000
SUMMARY:test
DESCRIPTION:https://www.facebook.com/events/756119502186737/?acontext=%7B%22source%22%3A5%2C%22action_history%22%3A[%7B%22surface%22%3A%22page%22%2C%22mechanism%22%3A%22main_list%22%2C%22extra_data%22%3A%22%5C%22[]%5C%22%22%7D]%2C%22has_source%22%3Atrue%7D
END:VEVENT
END:VCALENDAR
20 changes: 16 additions & 4 deletions src/icalendar/tests/test_fixed_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import os
import pytz

HERE = os.path.dirname(__file__)


class TestIssues(unittest.TestCase):

Expand All @@ -14,8 +16,7 @@ def test_issue_53(self):
https://github.com/collective/icalendar/issues/53
"""

directory = os.path.dirname(__file__)
ics = open(os.path.join(directory, 'issue_53_parsing_failure.ics'),
ics = open(os.path.join(HERE, 'issue_53_parsing_failure.ics'),
'rb')
cal = icalendar.Calendar.from_ical(ics.read())
ics.close()
Expand Down Expand Up @@ -231,8 +232,7 @@ def test_issue_112(self):
"""Issue #112 - No timezone info on EXDATE
https://github.com/collective/icalendar/issues/112
"""
directory = os.path.dirname(__file__)
path = os.path.join(directory,
path = os.path.join(HERE,
'issue_112_missing_tzinfo_on_exdate.ics')
with open(path, 'rb') as ics:
cal = icalendar.Calendar.from_ical(ics.read())
Expand Down Expand Up @@ -432,6 +432,18 @@ def test_issue_184(self):
b'END:VEVENT\r\n'
)

def test_issue_356_url_escaping(self):
"""Test that the URLs stay intact.
see https://github.com/collective/icalendar/pull/356
see https://github.com/collective/icalendar/issues/355
"""
ics = open(os.path.join(HERE, 'issue_53_parsing_failure.ics'), 'rb')
cal = icalendar.Calendar.from_ical(ics)
event = cal.walk(name='VEVENT')[0]
URL = "https://www.facebook.com/events/756119502186737/?acontext=%7B%22source%22%3A5%2C%22action_history%22%3A[%7B%22surface%22%3A%22page%22%2C%22mechanism%22%3A%22main_list%22%2C%22extra_data%22%3A%22%5C%22[]%5C%22%22%7D]%2C%22has_source%22%3Atrue%7D"
self.assertEqual(event["DESCRIPTION"], URL)

def test_issue_237(self):
"""Issue #237 - Fail to parse timezone with non-ascii TZID"""

Expand Down

0 comments on commit 700f23b

Please sign in to comment.