Regression tests that tickle #247

Zero duration meeting should have a zero duration time in Free/Busy,
but doesn't, the times are whacky.
This commit is contained in:
Andrew Ruthven 2021-09-19 01:46:51 +12:00
parent 04f2da406e
commit f82929e6a2
4 changed files with 180 additions and 0 deletions

View File

@ -0,0 +1,64 @@
HTTP/1.1 201 Created
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
ETag: "8a414b95eff37e1c939823191048ed22"
Content-Length: 0
Content-Type: text/plain; charset="utf-8"
CalDAV Data: >BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//davical.org//NONSGML AWL Calendar//EN
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Pacific/Auckland
BEGIN:STANDARD
TZOFFSETFROM:+1300
TZOFFSETTO:+1200
DTSTART:19900318T030000
RRULE:FREQ=YEARLY;UNTIL=20070317T140000Z;BYMONTH=3;BYDAY=3SU
TZNAME:NZST
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:+1200
TZOFFSETTO:+1300
DTSTART:19901007T020000
RRULE:FREQ=YEARLY;UNTIL=20060930T140000Z;BYMONTH=10;BYDAY=1SU
TZNAME:NZDT
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:zero-duration-event
DTSTAMP:20210918T123000
SUMMARY:Zero duration event
DESCRIPTION:Zero duration event
CREATED:20210918T123000
DTSTART;TZID=Pacific/Auckland:20210919T013000
DTEND;TZID=Pacific/Auckland:20210919T013000
END:VEVENT
END:VCALENDAR
<
caldav_type: >VEVENT<
class: >PUBLIC<
dav_etag: >8a414b95eff37e1c939823191048ed22<
description: >Zero duration event<
dtend: >2021-09-19 01:30:00<
dtstamp: >2021-09-18 12:30:00<
dtstart: >2021-09-19 01:30:00<
due: >NULL<
last_modified: >2021-09-18 12:30:00<
location: >NULL<
logged_user: >10<
percent_complete: >NULL<
priority: >NULL<
rrule: >NULL<
status: >NULL<
summary: >Zero duration event<
transp: >NULL<
tz_id: >Pacific/Auckland<
uid: >zero-duration-event<
url: >NULL<
user_no: >10<
~Duration: >00:00:00<

View File

@ -0,0 +1,58 @@
#
# Create a zero time event, should have zero time in Free/Busy
#
TYPE=PUT
URL=http://regression.host/caldav.php/user1/home/zero-duration-event.ics
HEADER=Content-Type: text/calendar
HEADER=User-Agent: RFC5545 Duration P0D
HEAD
BEGINDATA
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//davical.org//NONSGML AWL Calendar//EN
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Pacific/Auckland
BEGIN:STANDARD
TZOFFSETFROM:+1300
TZOFFSETTO:+1200
DTSTART:19900318T030000
RRULE:FREQ=YEARLY;UNTIL=20070317T140000Z;BYMONTH=3;BYDAY=3SU
TZNAME:NZST
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:+1200
TZOFFSETTO:+1300
DTSTART:19901007T020000
RRULE:FREQ=YEARLY;UNTIL=20060930T140000Z;BYMONTH=10;BYDAY=1SU
TZNAME:NZDT
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:zero-duration-event
DTSTAMP:20210918T123000
SUMMARY:Zero duration event
DESCRIPTION:Zero duration event
CREATED:20210918T123000
DTSTART;TZID=Pacific/Auckland:20210919T013000
DTEND;TZID=Pacific/Auckland:20210919T013000
END:VEVENT
END:VCALENDAR
ENDDATA
QUERY
SELECT caldav_data.user_no, caldav_data.dav_etag, caldav_type, logged_user,
uid, dtstamp, dtstart at time zone olson_name as dtstart,
dtend at time zone olson_name as dtend, due, summary, location,
description, priority, class, transp, rrule, url,
percent_complete, tz_id, status,
caldav_data AS " CalDAV Data", calendar_item.last_modified,
dtend - dtstart AS "~Duration"
FROM caldav_data JOIN calendar_item USING(dav_name) JOIN timezones ON (tz_id=tzid)
WHERE caldav_data.dav_name =
'/user1/home/zero-duration-event.ics';
ENDQUERY

View File

@ -0,0 +1,25 @@
HTTP/1.1 200 OK
Date: Dow, 01 Jan 2000 00:00:00 GMT
Content-Length: 310
Content-Type: text/calendar;charset=UTF-8
BEGIN:VCALENDAR
PRODID:-//davical.org//NONSGML AWL Calendar//EN
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VFREEBUSY
DTSTAMP:yyyymmddThhmmssZ
DTSTART:correct
DTEND:correct
FREEBUSY:20210918T133000Z/20210918T133000Z
FREEBUSY:20210920T194500Z/20210920T203000Z
END:VFREEBUSY
END:VCALENDAR
a) Start: >2021-09-19 01:30:00<
b) Location: >Pacific/Auckland<
c) UTC Start: >20210918T133000Z<
d) UTC End: >20210918T133000Z<
rrule: >NULL<
status: >NULL<

View File

@ -0,0 +1,33 @@
#
# Request a freebusy report by URL
#
# The event that we care about has DTSTART of 20210918T133000Z.
#
TYPE=GET
URL=http://regression.host/freebusy.php/user1/home/?start=20210918T000000&period=P3D
HEAD
AUTH=user1:user1
REPLACE=/^DTSTAMP:\d{8}T\d{6}Z\r?$/DTSTAMP:yyyymmddThhmmssZ/
REPLACE=/^DTSTART:20210918T000000Z\r?$/DTSTART:correct/
REPLACE=/^DTEND:20210921T000000Z\r?$/DTEND:correct/
QUERY
SELECT calendar_item.rrule, calendar_item.status,
dtstart AT TIME ZONE olson_name AS "a) Start",
olson_name AS "b) Location",
to_char(calendar_item.dtstart at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS "c) UTC Start",
to_char(calendar_item.dtend at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS "d) UTC End"
FROM usr INNER JOIN collection USING (user_no)
INNER JOIN caldav_data USING (collection_id)
INNER JOIN calendar_item USING(dav_id)
LEFT JOIN timezones ON (tz_id=tzid)
WHERE caldav_data.dav_name ~ '^/user1/home/'
AND collection.is_calendar AND collection.schedule_transp = 'opaque'
AND rrule_event_overlaps( dtstart, dtend, rrule, '20210918T000000Z', '20210921T000000Z' )
AND caldav_data.caldav_type IN ( 'VEVENT', 'VFREEBUSY' )
AND (calendar_item.transp != 'TRANSPARENT' OR calendar_item.transp IS NULL)
AND (calendar_item.status != 'CANCELLED' OR calendar_item.status IS NULL)
ORDER BY 3
ENDQUERY