-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #717 from niccokunzmann/issue-657-rfc-9074
RFC 9074
- Loading branch information
Showing
11 changed files
with
170 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
BEGIN:VEVENT | ||
CREATED:20210302T151004Z | ||
UID:AC67C078-CED3-4BF5-9726-832C3749F627 | ||
DTSTAMP:20210302T151004Z | ||
DTSTART;TZID=America/New_York:20210302T103000 | ||
DTEND;TZID=America/New_York:20210302T113000 | ||
SUMMARY:Meeting | ||
|
||
BEGIN:VALARM | ||
UID:8297C37D-BA2D-4476-91AE-C1EAA364F8E1 | ||
TRIGGER:-PT15M | ||
DESCRIPTION:Event reminder | ||
ACTION:DISPLAY | ||
END:VALARM | ||
|
||
END:VEVENT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
BEGIN:VEVENT | ||
CREATED:20210302T151004Z | ||
UID:AC67C078-CED3-4BF5-9726-832C3749F627 | ||
DTSTAMP:20210302T151516Z | ||
DTSTART;TZID=America/New_York:20210302T103000 | ||
DTEND;TZID=America/New_York:20210302T113000 | ||
SUMMARY:Meeting | ||
|
||
BEGIN:VALARM | ||
UID:8297C37D-BA2D-4476-91AE-C1EAA364F8E1 | ||
TRIGGER:-PT15M | ||
DESCRIPTION:Event reminder | ||
ACTION:DISPLAY | ||
ACKNOWLEDGED:20210302T151514Z | ||
END:VALARM | ||
|
||
BEGIN:VALARM | ||
UID:DE7B5C34-83FF-47FE-BE9E-FF41AE6DD097 | ||
TRIGGER;VALUE=DATE-TIME:20210302T152000Z | ||
RELATED-TO;RELTYPE=SNOOZE:8297C37D-BA2D-4476-91AE-C1EAA364F8E1 | ||
DESCRIPTION:Event reminder | ||
ACTION:DISPLAY | ||
END:VALARM | ||
|
||
END:VEVENT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
BEGIN:VEVENT | ||
CREATED:20210302T151004Z | ||
UID:AC67C078-CED3-4BF5-9726-832C3749F627 | ||
DTSTAMP:20210302T152026Z | ||
DTSTART;TZID=America/New_York:20210302T103000 | ||
DTEND;TZID=America/New_York:20210302T113000 | ||
SUMMARY:Meeting | ||
|
||
BEGIN:VALARM | ||
UID:8297C37D-BA2D-4476-91AE-C1EAA364F8E1 | ||
TRIGGER:-PT15M | ||
DESCRIPTION:Event reminder | ||
ACTION:DISPLAY | ||
ACKNOWLEDGED:20210302T152024Z | ||
END:VALARM | ||
|
||
BEGIN:VALARM | ||
UID:87D690A7-B5E8-4EB4-8500-491F50AFE394 | ||
TRIGGER;VALUE=DATE-TIME:20210302T152500Z | ||
RELATED-TO;RELTYPE=SNOOZE:8297C37D-BA2D-4476-91AE-C1EAA364F8E1 | ||
DESCRIPTION:Event reminder | ||
ACTION:DISPLAY | ||
END:VALARM | ||
|
||
END:VEVENT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
BEGIN:VEVENT | ||
CREATED:20210302T151004Z | ||
UID:AC67C078-CED3-4BF5-9726-832C3749F627 | ||
DTSTAMP:20210302T152508Z | ||
DTSTART;TZID=America/New_York:20210302T103000 | ||
DTEND;TZID=America/New_York:20210302T113000 | ||
SUMMARY:Meeting | ||
|
||
BEGIN:VALARM | ||
UID:8297C37D-BA2D-4476-91AE-C1EAA364F8E1 | ||
TRIGGER:-PT15M | ||
DESCRIPTION:Event reminder | ||
ACTION:DISPLAY | ||
ACKNOWLEDGED:20210302T152507Z | ||
END:VALARM | ||
|
||
BEGIN:VALARM | ||
UID:87D690A7-B5E8-4EB4-8500-491F50AFE394 | ||
TRIGGER;VALUE=DATE-TIME:20210302T152500Z | ||
RELATED-TO;RELTYPE=SNOOZE:8297C37D-BA2D-4476-91AE-C1EAA364F8E1 | ||
DESCRIPTION:Event reminder | ||
ACTION:DISPLAY | ||
ACKNOWLEDGED:20210302T152507Z | ||
END:VALARM | ||
|
||
END:VEVENT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
BEGIN:VEVENT | ||
BEGIN:VALARM | ||
UID:77D80D14-906B-4257-963F-85B1E734DBB6 | ||
ACTION:DISPLAY | ||
TRIGGER;VALUE=DATE-TIME:19760401T005545Z | ||
DESCRIPTION:Remember to buy milk | ||
PROXIMITY:DEPART | ||
BEGIN:VLOCATION | ||
UID:123456-abcdef-98765432 | ||
NAME:Office | ||
URL:geo:40.443,-79.945;u=10 | ||
END:VLOCATION | ||
END:VALARM | ||
END:VEVENT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""Test the VALARM compatibility of RFC 9074. | ||
See https://www.rfc-editor.org/rfc/rfc9074.html | ||
and also https://github.com/collective/icalendar/issues/657 | ||
""" | ||
import pytest | ||
|
||
from icalendar.prop import vDDDTypes, vText | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("prop", "cls", "file", "alarm_index"), | ||
[ | ||
("UID", vText, "rfc_9074_example_1", 0), | ||
("RELATED-TO", vText, "rfc_9074_example_2", 1), | ||
("ACKNOWLEDGED", vDDDTypes, "rfc_9074_example_3", 0), | ||
("PROXIMITY", vText, "rfc_9074_example_proximity", 0), | ||
] | ||
) | ||
def test_calendar_types(events, prop, cls, file, alarm_index): | ||
"""Check the types of the properties.""" | ||
event = events[file] | ||
alarm = event.subcomponents[alarm_index] | ||
value = alarm[prop] | ||
assert isinstance(value, cls) | ||
|
||
|
||
def test_snooze(events): | ||
"""Check values of the alarms.""" | ||
alarm_1 = events.rfc_9074_example_3.subcomponents[0] | ||
assert alarm_1["ACKNOWLEDGED"].dt == vDDDTypes.from_ical("20210302T152024Z") | ||
alarm_2 = events.rfc_9074_example_3.subcomponents[1] | ||
assert alarm_2["RELATED-TO"] == "8297C37D-BA2D-4476-91AE-C1EAA364F8E1" | ||
assert alarm_2["RELATED-TO"].params["RELTYPE"] == "SNOOZE" | ||
|
||
|
||
def test_proximity(events): | ||
"""Check the proximity values.""" | ||
alarm = events.rfc_9074_example_proximity.subcomponents[0] | ||
assert alarm["PROXIMITY"] == "DEPART" | ||
assert len(alarm.subcomponents) == 1 | ||
location = alarm.subcomponents[0] | ||
assert location["UID"] == "123456-abcdef-98765432" |