-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5065 from rsto/http_caldav_proppatch_timezone_id
http_caldav.c: do not require tzdist module for calendar-timezone-id
- Loading branch information
Showing
3 changed files
with
168 additions
and
6 deletions.
There are no files selected for viewing
149 changes: 149 additions & 0 deletions
149
cassandane/tiny-tests/Caldav/rfc7898_calendar_timezone_id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
#!perl | ||
use Cassandane::Tiny; | ||
use XML::Spice; | ||
|
||
sub test_rfc7898_calendar_timezone_id { | ||
my ($self) = @_; | ||
my $caldav = $self->{caldav}; | ||
|
||
my $vtimezone = <<EOF; | ||
BEGIN:VCALENDAR | ||
PRODID:-//citadel.org//NONSGML Citadel calendar//EN | ||
VERSION:2.0 | ||
BEGIN:VTIMEZONE | ||
TZID:Etc/GMT+2 | ||
LAST-MODIFIED:20240909T122233Z | ||
BEGIN:STANDARD | ||
TZNAME:Etc/GMT+2 | ||
TZOFFSETFROM:-0200 | ||
TZOFFSETTO:-0200 | ||
DTSTART:16010101T000000 | ||
END:STANDARD | ||
END:VTIMEZONE | ||
END:VCALENDAR | ||
EOF | ||
|
||
xlog $self, "Verify no timezone or timezone-id is set"; | ||
$self->assert_timezone_id(undef); | ||
|
||
xlog $self, "Set timezone"; | ||
my $res = $caldav->Request( | ||
'PROPPATCH', "/dav/calendars/user/cassandane/Default", | ||
x('D:propertyupdate', $caldav->NS(), | ||
x('D:set', | ||
x('D:prop', | ||
x('C:calendar-timezone', $vtimezone), | ||
), | ||
), | ||
), | ||
); | ||
|
||
xlog $self, "Verify timezone and timezone-id are set"; | ||
$self->assert_timezone_id("Etc/GMT+2"); | ||
|
||
xlog $self, "Set timezone-id"; | ||
$res = $caldav->Request( | ||
'PROPPATCH', "/dav/calendars/user/cassandane/Default", | ||
x('D:propertyupdate', $caldav->NS(), | ||
x('D:set', | ||
x('D:prop', | ||
x('C:calendar-timezone-id', 'Etc/GMT+2'), | ||
), | ||
), | ||
), | ||
); | ||
|
||
xlog $self, "Verify timezone and timezone-id are set"; | ||
$self->assert_timezone_id("Etc/GMT+2"); | ||
|
||
xlog $self, "Delete timezone property"; | ||
$res = $caldav->Request( | ||
'PROPPATCH', "/dav/calendars/user/cassandane/Default", | ||
x('D:propertyupdate', $caldav->NS(), | ||
x('D:remove', | ||
x('D:prop', | ||
x('C:calendar-timezone'), | ||
), | ||
), | ||
), | ||
); | ||
|
||
xlog $self, "Verify no timezone or timezone-id is set"; | ||
$self->assert_timezone_id(undef); | ||
|
||
xlog $self, "Set differing timezone and timezone-id, timezone as second"; | ||
$res = $caldav->Request( | ||
'PROPPATCH', "/dav/calendars/user/cassandane/Default", | ||
x('D:propertyupdate', $caldav->NS(), | ||
x('D:set', | ||
x('D:prop', | ||
x('C:calendar-timezone-id', 'Etc/GMT+4'), | ||
x('C:calendar-timezone', $vtimezone), | ||
), | ||
), | ||
), | ||
); | ||
|
||
xlog $self, "Verify timezone-id matches timezone value"; | ||
$self->assert_timezone_id("Etc/GMT+2"); | ||
|
||
xlog $self, "Set differing timezone and timezone-id, timezone-id as second"; | ||
$res = $caldav->Request( | ||
'PROPPATCH', "/dav/calendars/user/cassandane/Default", | ||
x('D:propertyupdate', $caldav->NS(), | ||
x('D:set', | ||
x('D:prop', | ||
x('C:calendar-timezone', $vtimezone), | ||
x('C:calendar-timezone-id', 'Etc/GMT+4'), | ||
), | ||
), | ||
), | ||
); | ||
|
||
xlog $self, "Verify timezone-id matches timezone value"; | ||
$self->assert_timezone_id("Etc/GMT+4"); | ||
|
||
xlog $self, "Delete timezone-id property"; | ||
$res = $caldav->Request( | ||
'PROPPATCH', "/dav/calendars/user/cassandane/Default", | ||
x('D:propertyupdate', $caldav->NS(), | ||
x('D:remove', | ||
x('D:prop', | ||
x('C:calendar-timezone-id'), | ||
), | ||
), | ||
), | ||
); | ||
|
||
xlog $self, "Verify no timezone or timezone-id is set"; | ||
$self->assert_timezone_id(undef); | ||
} | ||
|
||
sub assert_timezone_id { | ||
my ($self, $tzid) = @_; | ||
my $caldav = $self->{caldav}; | ||
|
||
my $res = $caldav->Request( | ||
'PROPFIND', "/dav/calendars/user/cassandane/Default", | ||
x('D:propfind', $caldav->NS(), | ||
x('D:prop', | ||
x('C:calendar-timezone-id'), | ||
x('C:calendar-timezone'), | ||
), | ||
), | ||
); | ||
|
||
my $propstat = $res->{'{DAV:}response'}[0]{'{DAV:}propstat'}[0]; | ||
if (not $tzid) { | ||
$self->assert_str_equals( | ||
'HTTP/1.1 404 Not Found', | ||
$propstat->{'{DAV:}status'}{content} | ||
); | ||
$self->assert( | ||
exists $propstat->{'{DAV:}prop'} | ||
{'{urn:ietf:params:xml:ns:caldav}calendar-timezone-id'}); | ||
$self->assert( | ||
exists $propstat->{'{DAV:}prop'} | ||
{'{urn:ietf:params:xml:ns:caldav}calendar-timezone'}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Description: | ||
|
||
Enable the calendar-timezone-id (RFC 7809) DAV property even if tzdist http module is disabled. | ||
|
||
|
||
Config changes: | ||
|
||
None | ||
|
||
Upgrade instructions: | ||
|
||
None | ||
|
||
GitHub issue: | ||
|
||
None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters