Skip to content

Commit

Permalink
add subcomponents to recurring events
Browse files Browse the repository at this point in the history
- fixes #6
  • Loading branch information
niccokunzmann committed Feb 6, 2020
1 parent 6277ece commit 66c7cfc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions recurring_ical_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def as_vevent(self):
for attribute in self.ATTRIBUTES_TO_DELETE_ON_COPY:
if attribute in revent:
del revent[attribute]
for subcomponent in self.source.subcomponents:
revent.add_component(subcomponent)
return revent

def is_in_span(self, span_start, span_stop):
Expand Down
30 changes: 30 additions & 0 deletions test/calendars/subcomponents.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
BEGIN:VCALENDAR
BEGIN:VEVENT
SUMMARY:redacted
DTSTART;TZID=Europe/Berlin:20190527T140000
DTEND;TZID=Europe/Berlin:20190527T163000
DTSTAMP:20190510T070457Z
UID:00000000-0000-0000-0000-000000000000
SEQUENCE:4
ATTENDEE;CN=redacted;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:redacted@example.com
ATTENDEE;CN="redacted";PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:redacted@example.com
ATTENDEE;CN="redacted";PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:redacted@example.com
ATTENDEE;CN="redacted";PARTSTAT=ACCEPTED;ROLE=REQ-PARTICIPANT:mailto:redacted@example.com
ATTENDEE;CUTYPE=RESOURCE;PARTSTAT=ACCEPTED;ROLE=NON-PARTICIPANT;RSVP=TRUE:mailto:redacted@example.com
ATTENDEE;CUTYPE=RESOURCE;PARTSTAT=ACCEPTED;ROLE=NON-PARTICIPANT;RSVP=TRUE:mailto:redacted@example.com
CLASS:PUBLIC
DESCRIPTION:redacted
LAST-MODIFIED:20190510T070457Z
LOCATION:redacted@example.com
ORGANIZER;CN=redacted;SENT-BY="mailto:redacted@example.com":mailto:redacted@example.com
STATUS:CONFIRMED
TRANSP:OPAQUE
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
X-MS-OLK-SENDER:mailto:redacted@example.com
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:Reminder
TRIGGER;RELATED=START:-PT10M
END:VALARM
END:VEVENT
END:VCALENDAR
12 changes: 12 additions & 0 deletions test/test_issue_6_copy_subcomponents.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""
This tests that subcomponents are carried over to different events.
"""

def test_subcomponents_are_compied(calendars):
event = calendars.subcomponents.all()[0]
assert event.subcomponents

def test_there_are_no_subcomponents(calendars):
event = calendars.Germany.all()[0]
assert not event.subcomponents

0 comments on commit 66c7cfc

Please sign in to comment.