From 61850d9b137d1877dc2498b024b2ea4bb0edf313 Mon Sep 17 00:00:00 2001 From: David Greaves Date: Tue, 8 Jul 2025 13:24:59 +0100 Subject: [PATCH] refactor _test_expand ready to support max_freebusy_occurrence Signed-off-by: David Greaves --- radicale/tests/test_expand.py | 76 ++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/radicale/tests/test_expand.py b/radicale/tests/test_expand.py index b4d54b22..0614bd91 100644 --- a/radicale/tests/test_expand.py +++ b/radicale/tests/test_expand.py @@ -72,17 +72,13 @@ permissions: RrWw""") self.configure({"rights": {"file": rights_file_path, "type": "from_file"}}) - def _test_expand(self, - expected_uid: str, - start: str, - end: str, - expected_recurrence_ids: List[str], - expected_start_times: List[str], - expected_end_times: List[str], - only_dates: bool, - nr_uids: int) -> None: + def _req_without_expand(self, + expected_uid: str, + start: str, + end: str, + ) -> str: self.put("/calendar.ics/", get_file_content(f"{expected_uid}.ics")) - req_body_without_expand = \ + return \ f""" @@ -98,9 +94,43 @@ permissions: RrWw""") """ - _, responses = self.report("/calendar.ics/", req_body_without_expand) - assert len(responses) == 1 + def _req_with_expand(self, + expected_uid: str, + start: str, + end: str, + ) -> str: + self.put("/calendar.ics/", get_file_content(f"{expected_uid}.ics")) + return \ + f""" + + + + + + + + + + + + + + + """ + + def _test_expand(self, + expected_uid: str, + start: str, + end: str, + expected_recurrence_ids: List[str], + expected_start_times: List[str], + expected_end_times: List[str], + only_dates: bool, + nr_uids: int) -> None: + _, responses = self.report("/calendar.ics/", + self._req_without_expand(expected_uid, start, end)) + assert len(responses) == 1 response_without_expand = responses[f'/calendar.ics/{expected_uid}.ics'] assert not isinstance(response_without_expand, int) status, element = response_without_expand["C:calendar-data"] @@ -122,26 +152,8 @@ permissions: RrWw""") assert len(uids) == nr_uids - req_body_with_expand = \ - f""" - - - - - - - - - - - - - - - """ - - _, responses = self.report("/calendar.ics/", req_body_with_expand) - + _, responses = self.report("/calendar.ics/", + self._req_with_expand(expected_uid, start, end)) assert len(responses) == 1 response_with_expand = responses[f'/calendar.ics/{expected_uid}.ics']