add test cases for PERIOD support

This commit is contained in:
Peter Bieringer
2026-06-21 16:31:29 +02:00
parent 8bcd43742a
commit 3f973a870d
5 changed files with 94 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:test
BEGIN:VEVENT
UID:test-rdate-period-start-duration
DESCRIPTION:event with rdate period start duration
DTSTART:20000101T000000Z
DURATION:PT1H
DTSTAMP:20000101T000000Z
RRULE:FREQ=WEEKLY
RDATE;VALUE=PERIOD:20000102T000000Z/PT2H
END:VEVENT
END:VCALENDAR

View File

@@ -0,0 +1,13 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:test
BEGIN:VEVENT
UID:test-rdate-period-start-duration-multi
DESCRIPTION:event with rdate period multiple start duration
DTSTART:20000101T000000Z
DURATION:PT1H
DTSTAMP:20000101T000000Z
RRULE:FREQ=WEEKLY
RDATE;VALUE=PERIOD:20000102T000000Z/PT2H,20010102T000000Z/PT2H
END:VEVENT
END:VCALENDAR

View File

@@ -0,0 +1,13 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:test
BEGIN:VEVENT
UID:test-rdate-period-time-start-stop
DESCRIPTION:event with rdate period start and stop
DTSTART:20000101T000000Z
DURATION:PT1H
DTSTAMP:20000101T000000Z
RRULE:FREQ=WEEKLY
RDATE;VALUE=PERIOD:20000102T000000Z/20000402T000000Z/
END:VEVENT
END:VCALENDAR

View File

@@ -0,0 +1,13 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:test
BEGIN:VEVENT
UID:test-rdate-period-time-start-stop-multi
DESCRIPTION:event with rdate period multiple start and stop
DTSTART:20000101T000000Z
DURATION:PT1H
DTSTAMP:20000101T000000Z
RRULE:FREQ=WEEKLY
RDATE;VALUE=PERIOD:20000102T000000Z/20000402T000000Z,20010102T000000Z/20010402T000000Z
END:VEVENT
END:VCALENDAR

View File

@@ -151,6 +151,48 @@ permissions: RrWw""")
assert "Event" in answer
assert "UID:event" in answer
@pytest.mark.skipif(not utils.vobject_supports_period(), reason="vobject <= 0.9.9 does not support PERIOD")
def test_add_event_with_rdate_period_start_duration_single(self) -> None:
"""Add an event with RDATE/PERIOD with start+duration."""
self.mkcalendar("/calendar.ics/")
event = get_file_content("event_rdate_period_start_duration.ics")
path = "/calendar.ics/event_rdate_period_start_duration.ics"
self.put(path, event)
_, headers, answer = self.request("GET", path, check=200)
assert "RDATE;VALUE=PERIOD:20000102T000000Z/PT2H" in answer
@pytest.mark.skipif(not utils.vobject_supports_period(), reason="vobject <= 0.9.9 does not support PERIOD")
def test_add_event_with_rdate_period_start_duration_multi(self) -> None:
"""Add an event with RDATE/PERIOD with multiple start+duration."""
self.mkcalendar("/calendar.ics/")
event = get_file_content("event_rdate_period_start_duration_multi.ics")
path = "/calendar.ics/event_rdate_period_start_duration_multi.ics"
self.put(path, event)
_, headers, answer = self.request("GET", path, check=200)
assert "RDATE;VALUE=PERIOD:20000102T000000Z/PT2H,20010102T000000Z/PT2H" in answer
@pytest.mark.skipif(not utils.vobject_supports_period(), reason="vobject <= 0.9.9 does not support PERIOD")
def test_add_event_with_rdate_period_start_stop_single(self) -> None:
"""Add an event with RDATE/PERIOD with start+stop."""
self.mkcalendar("/calendar.ics/")
event = get_file_content("event_rdate_period_start_stop.ics")
path = "/calendar.ics/event_rdate_period_start_stop.ics"
self.put(path, event)
_, headers, answer = self.request("GET", path, check=200)
assert "RDATE;VALUE=PERIOD:20000102T000000Z/20000402T000000Z" in answer
@pytest.mark.skipif(not utils.vobject_supports_period(), reason="vobject <= 0.9.9 does not support PERIOD")
def test_add_event_with_rdate_period_start_stop_multi(self) -> None:
"""Add an event with RDATE/PERIOD with multiple start+stop."""
self.mkcalendar("/calendar.ics/")
event = get_file_content("event_rdate_period_start_stop_multi.ics")
path = "/calendar.ics/event_rdate_period_start_stop_multi.ics"
self.put(path, event)
_, headers, answer = self.request("GET", path, check=200)
# wrapped answer
assert "RDATE;VALUE=PERIOD:20000102T000000Z/20000402T000000Z,20010102T000000Z/20010" in answer
assert " 402T000000Z" in answer
def test_add_event_with_desc_ok(self) -> None:
"""Add an event."""
self.mkcalendar("/calendar.ics/")