mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-07 18:30:54 +00:00
add test_report_with_max_occur and fix vevent count issue found
Signed-off-by: David Greaves <david@dgreaves.com>
This commit is contained in:
parent
3f4f405554
commit
83a7853405
3 changed files with 117 additions and 2 deletions
|
@ -310,7 +310,7 @@ def xml_report(base_prefix: str, path: str, xml_request: Optional[ET.Element],
|
|||
found_props.append(expanded_element)
|
||||
else:
|
||||
found_props.append(element)
|
||||
n_vevents += 1
|
||||
n_vevents += len(item.vobject_item.vevent_list)
|
||||
# Avoid DoS with too many events
|
||||
if max_occurrence and n_vevents > max_occurrence:
|
||||
raise ValueError("REPORT occurrences limit of {} hit"
|
||||
|
|
100
radicale/tests/static/event_multiple_too_many.ics
Normal file
100
radicale/tests/static/event_multiple_too_many.ics
Normal file
|
@ -0,0 +1,100 @@
|
|||
BEGIN:VCALENDAR
|
||||
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
|
||||
VERSION:2.0
|
||||
BEGIN:VTIMEZONE
|
||||
TZID:Europe/Paris
|
||||
X-LIC-LOCATION:Europe/Paris
|
||||
BEGIN:DAYLIGHT
|
||||
TZOFFSETFROM:+0100
|
||||
TZOFFSETTO:+0200
|
||||
TZNAME:CEST
|
||||
DTSTART:19700329T020000
|
||||
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3
|
||||
END:DAYLIGHT
|
||||
BEGIN:STANDARD
|
||||
TZOFFSETFROM:+0200
|
||||
TZOFFSETTO:+0100
|
||||
TZNAME:CET
|
||||
DTSTART:19701025T030000
|
||||
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
||||
END:STANDARD
|
||||
END:VTIMEZONE
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many
|
||||
SUMMARY:Event
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many1
|
||||
SUMMARY:Event1
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many2
|
||||
SUMMARY:Event2
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many3
|
||||
SUMMARY:Event3
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many4
|
||||
SUMMARY:Event4
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many5
|
||||
SUMMARY:Event5
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many6
|
||||
SUMMARY:Event6
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many7
|
||||
SUMMARY:Event7
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many8
|
||||
SUMMARY:Event8
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many9
|
||||
SUMMARY:Event9
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many10
|
||||
SUMMARY:Event10
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:event_multiple_too_many11
|
||||
SUMMARY:Event11
|
||||
DTSTART;TZID=Europe/Paris:20130901T190000
|
||||
DTEND;TZID=Europe/Paris:20130901T200000
|
||||
END:VEVENT
|
||||
BEGIN:VTODO
|
||||
UID:todo
|
||||
DTSTART;TZID=Europe/Paris:20130901T220000
|
||||
DURATION:PT1H
|
||||
SUMMARY:Todo
|
||||
END:VTODO
|
||||
END:VCALENDAR
|
|
@ -203,7 +203,7 @@ permissions: RrWw""")
|
|||
|
||||
assert "RRULE" in element.text
|
||||
|
||||
status, headers, answer = self.request(
|
||||
status, _, _ = self.request(
|
||||
"REPORT", "/calendar.ics/",
|
||||
self._req_with_expand(expected_uid, start, end),
|
||||
check=check)
|
||||
|
@ -332,3 +332,18 @@ permissions: RrWw""")
|
|||
"20060501T000000Z",
|
||||
check=400
|
||||
)
|
||||
|
||||
def test_report_with_max_occur(self) -> None:
|
||||
"""Test report with too many vevents"""
|
||||
self.configure({"reporting": {"max_freebusy_occurrence": 10}})
|
||||
|
||||
uid = "event_multiple_too_many"
|
||||
start = "20130901T000000Z"
|
||||
end = "20130902T000000Z"
|
||||
check = 400
|
||||
|
||||
status, responses = self.report("/calendar.ics/",
|
||||
self._req_without_expand(uid, start, end),
|
||||
check=check)
|
||||
assert len(responses) == 0
|
||||
assert status == check
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue