Skip to content

Commit 343e386

Browse files
committed
alarm creation and search works
1 parent 0be48d2 commit 343e386

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

caldav/davclient.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ def _expand_simple_prop(
293293
values = []
294294
if proptag in props_found:
295295
prop_xml = props_found[proptag]
296-
error.assert_(not prop_xml.items())
296+
if prop_xml.items():
297+
from caldav.lib.debug import xmlstring
298+
log.error(f"If you see this, please add a report at https://github.com/python-caldav/caldav/issues/209 - in _expand_simple_prop, dealing with {proptag}, extra items found: {xmlstring(prop_xml)}.")
297299
if not xpath and len(prop_xml) == 0:
298300
if prop_xml.text:
299301
values.append(prop_xml.text)

tests/compatibility_issues.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
"""date searches covering recurrances may yield no results, """
3939
"""and events/todos may not be expanded with recurrances""",
4040

41+
'no_alarmsearch':
42+
"""Searching for alarms may yield too few or too many or even a 500 internal server error""",
43+
4144
'no_recurring_todo':
4245
"""Recurring events are supported, but not recurring todos""",
4346

@@ -235,13 +238,19 @@
235238

236239
## scheduling is not supported
237240
"no_scheduling",
241+
242+
## No alarm search
243+
"no_alarmsearch",
238244
]
239245

246+
## TODO - there has been quite some development in radicale recently, so this list
247+
## should probably be gone through
240248
radicale = [
241249
## calendar listings and calendar creation works a bit
242250
## "weird" on radicale
243251
"broken_expand",
244252
"no_default_calendar",
253+
"no_alarmsearch", ## This is fixed and will be released soon
245254

246255
## freebusy is not supported yet, but on the long-term road map
247256
"no_freebusy_rfc4791",

tests/test_caldav.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -982,14 +982,19 @@ def testAlarm(self):
982982
## Ref https://github.com/python-caldav/caldav/issues/132
983983
c = self._fixCalendar()
984984
ev = c.save_event(
985-
dtstart=datetime(2015, 10, 10, 8, 7, 6),
985+
dtstart=datetime(2015, 10, 10, 8, 0, 0),
986986
summary="This is a test event",
987-
dtend=datetime(2016, 10, 10, 9, 8, 7),
987+
dtend=datetime(2016, 10, 10, 9, 0, 0),
988988
alarm_trigger=timedelta(minutes=-15),
989989
alarm_action="AUDIO",
990990
)
991991

992-
## Search for the alarm (procrastinated - see https://github.com/python-caldav/caldav/issues/132)
992+
self.skip_on_compatibility_flag("no_alarmsearch")
993+
994+
## So we have an alarm that goes off 07:45 for an event starting 08:00
995+
996+
## Search for alarms after 8 should find nothing
997+
## (search for an alarm 07:55 - 08:05 should most likely find nothing).
993998
assert (
994999
len(
9951000
c.search(
@@ -1000,12 +1005,14 @@ def testAlarm(self):
10001005
)
10011006
== 0
10021007
)
1008+
1009+
## Search for alarms from 07:40 to 07:55 should definitively find the alarm.
10031010
assert (
10041011
len(
10051012
c.search(
10061013
event=True,
1007-
alarm_start=datetime(2015, 10, 10, 7, 44),
1008-
alarm_end=datetime(2015, 10, 10, 8, 7),
1014+
alarm_start=datetime(2015, 10, 10, 7, 40),
1015+
alarm_end=datetime(2015, 10, 10, 7, 55),
10091016
)
10101017
)
10111018
== 1

0 commit comments

Comments
 (0)