Skip to content

Commit 6bdc140

Browse files
committed
Code and test changes to avoid warnings on Stalwart and get tests passing on OX
1 parent 54139ad commit 6bdc140

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

caldav/response.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def _parse_response(self, response: _Element) -> tuple[str, list[_Element], Any
192192
status = None
193193
href: str | None = None
194194
propstats: list[_Element] = []
195-
check_404 = False ## special for purelymail
195+
check_404 = False ## special for purelymail and stalwart
196196
error.assert_(response.tag == dav.Response.tag)
197197
for elem in response:
198198
if elem.tag == dav.Status.tag:
@@ -205,6 +205,12 @@ def _parse_response(self, response: _Element) -> tuple[str, list[_Element], Any
205205
href = _normalize_href(elem.text or "")
206206
elif elem.tag == dav.PropStat.tag:
207207
propstats.append(elem)
208+
elif elem.tag == "{DAV:}responsedescription":
209+
## This happens with Stalwart on a 404.
210+
## This code is mostly moot, but in debug
211+
## mode I want to be sure we do not toss away any data
212+
error.assert_(elem.text == "No resources found")
213+
check_404 = True
208214
elif elem.tag == "{DAV:}error":
209215
## This happens with purelymail on a 404.
210216
## This code is mostly moot, but in debug

tests/test_caldav.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,9 @@ def testSearchShouldYieldData(self):
10871087
"""
10881088
ref https://github.com/python-caldav/caldav/issues/201
10891089
"""
1090+
## Test breaks for OX (because it does not support old events in any meaningful way).
1091+
self.skip_unless_support("search.unlimited-time-range")
1092+
10901093
c = self._fixCalendar()
10911094

10921095
if self.is_supported("save-load.event"):
@@ -1890,6 +1893,8 @@ def testSearchEvent(self):
18901893
def testSearchSortTodo(self):
18911894
self.skip_unless_support("save-load.todo")
18921895
self.skip_unless_support("search")
1896+
## Test breaks for OX (because it does not support old events in any meaningful way).
1897+
self.skip_unless_support("search.unlimited-time-range")
18931898
c = self._fixCalendar(supported_calendar_component_set=["VTODO"])
18941899
pre_todos = c.get_todos()
18951900
pre_todo_uid_map = {x.icalendar_component["uid"] for x in pre_todos}
@@ -1965,6 +1970,8 @@ def check_order(tasks, order):
19651970
def testSearchTodos(self):
19661971
self.skip_unless_support("save-load.todo")
19671972
self.skip_unless_support("search")
1973+
## Test breaks for OX (because it does not support old events in any meaningful way).
1974+
self.skip_unless_support("search.unlimited-time-range")
19681975
c = self._fixCalendar(supported_calendar_component_set=["VTODO"])
19691976

19701977
pre_cnt = len(c.get_todos())
@@ -2375,6 +2382,8 @@ def testCreateTaskListAndTodo(self):
23752382
* Verify that cal.get_events() method returns nothing
23762383
"""
23772384
self.skip_unless_support("save-load.todo")
2385+
## Test breaks for OX (because it does not support old events in any meaningful way).
2386+
self.skip_unless_support("search.unlimited-time-range")
23782387

23792388
# For most servers (notable exception Zimbra), it's
23802389
# possible to create a calendar and add todo-items to it.
@@ -2427,6 +2436,8 @@ def testTodos(self):
24272436
* It will list out all pending tasks, sorted by priority
24282437
"""
24292438
self.skip_unless_support("save-load.todo")
2439+
## Test breaks for OX (because it does not support old events in any meaningful way).
2440+
self.skip_unless_support("search.unlimited-time-range")
24302441
c = self._fixCalendar(supported_calendar_component_set=["VTODO"])
24312442

24322443
# add todo-item
@@ -2690,6 +2701,8 @@ def testTodoCompletion(self):
26902701
Will check that todo-items can be completed and deleted
26912702
"""
26922703
self.skip_unless_support("save-load.todo")
2704+
## Test breaks for OX, because it doesn't support old tasks.
2705+
self.skip_unless_support("search.unlimited-time-range")
26932706
# not all caldav servers support VTODO
26942707
c = self._fixCalendar(supported_calendar_component_set=["VTODO"])
26952708

@@ -2735,6 +2748,8 @@ def testTodoCompletion(self):
27352748
## TODO: use parameterized test, this is duplicated in testTodoRecurringCompleteThisandfuture
27362749
def testTodoRecurringCompleteSafe(self):
27372750
self.skip_unless_support("save-load.todo")
2751+
## Test breaks for OX, because it doesn't support old tasks.
2752+
self.skip_unless_support("search.unlimited-time-range")
27382753
c = self._fixCalendar(supported_calendar_component_set=["VTODO"])
27392754
assert len(c.get_todos()) == 0
27402755
t6 = c.add_todo(todo6, status="NEEDS-ACTION")

0 commit comments

Comments
 (0)