From 3f973a870d04637ae1f4d6cc2d0ecfac92b7ceff Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sun, 21 Jun 2026 16:31:29 +0200 Subject: [PATCH] add test cases for PERIOD support --- .../event_rdate_period_start_duration.ics | 13 ++++++ ...vent_rdate_period_start_duration_multi.ics | 13 ++++++ .../static/event_rdate_period_start_stop.ics | 13 ++++++ .../event_rdate_period_start_stop_multi.ics | 13 ++++++ radicale/tests/test_base.py | 42 +++++++++++++++++++ 5 files changed, 94 insertions(+) create mode 100644 radicale/tests/static/event_rdate_period_start_duration.ics create mode 100644 radicale/tests/static/event_rdate_period_start_duration_multi.ics create mode 100644 radicale/tests/static/event_rdate_period_start_stop.ics create mode 100644 radicale/tests/static/event_rdate_period_start_stop_multi.ics diff --git a/radicale/tests/static/event_rdate_period_start_duration.ics b/radicale/tests/static/event_rdate_period_start_duration.ics new file mode 100644 index 00000000..5a767fd6 --- /dev/null +++ b/radicale/tests/static/event_rdate_period_start_duration.ics @@ -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 diff --git a/radicale/tests/static/event_rdate_period_start_duration_multi.ics b/radicale/tests/static/event_rdate_period_start_duration_multi.ics new file mode 100644 index 00000000..ebbd2a92 --- /dev/null +++ b/radicale/tests/static/event_rdate_period_start_duration_multi.ics @@ -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 diff --git a/radicale/tests/static/event_rdate_period_start_stop.ics b/radicale/tests/static/event_rdate_period_start_stop.ics new file mode 100644 index 00000000..f76a1680 --- /dev/null +++ b/radicale/tests/static/event_rdate_period_start_stop.ics @@ -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 diff --git a/radicale/tests/static/event_rdate_period_start_stop_multi.ics b/radicale/tests/static/event_rdate_period_start_stop_multi.ics new file mode 100644 index 00000000..aad13b3f --- /dev/null +++ b/radicale/tests/static/event_rdate_period_start_stop_multi.ics @@ -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 diff --git a/radicale/tests/test_base.py b/radicale/tests/test_base.py index d17dc70f..38775595 100644 --- a/radicale/tests/test_base.py +++ b/radicale/tests/test_base.py @@ -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/")