Skip to content

Commit

Permalink
Merge pull request #4871 from cyrusimap/caldav-recurrence-check
Browse files Browse the repository at this point in the history
Caldav: test changing organiser and overwriting including removing recurrences
  • Loading branch information
brong committed Jun 11, 2024
2 parents 631f127 + eeb50d9 commit 4f5d511
Showing 1 changed file with 143 additions and 0 deletions.
143 changes: 143 additions & 0 deletions cassandane/tiny-tests/Caldav/invite_change_organizer_recur
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
#!perl
use Cassandane::Tiny;

sub test_invite_change_organizer_recur
:VirtDomains :min_version_3_0 :needs_component_httpd
{
my ($self) = @_;

my $service = $self->{instance}->get_service("http");
my $CalDAV = Net::CalDAVTalk->new(
user => "cassandane%example.com",
password => 'pass',
host => $service->host(),
port => $service->port(),
scheme => 'http',
url => '/',
expandurl => 1,
);

my $CalendarId = $CalDAV->NewCalendar({name => 'hello'});
$self->assert_not_null($CalendarId);

my $uuid = "6de280c9-edff-4019-8ebd-cfebc73f8401";
my $href = "$CalendarId/$uuid.ics";
my $card = <<EOF;
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//Mac OS X 10.10.4//EN
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Australia/Melbourne
BEGIN:STANDARD
TZOFFSETFROM:+1100
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU
DTSTART:20080406T030000
TZNAME:AEST
TZOFFSETTO:+1000
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:+1000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=1SU
DTSTART:20081005T020000
TZNAME:AEDT
TZOFFSETTO:+1100
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20150806T234327Z
UID:$uuid
RRULE:FREQ=WEEKLY
TRANSP:OPAQUE
SUMMARY:An Event
DTSTART;TZID=Australia/Melbourne:20240701T153000
DTEND;TZID=Australia/Melbourne:20240701T183000
DTSTAMP:20150806T234327Z
SEQUENCE:0
ATTENDEE;CN=Test User;PARTSTAT=ACCEPTED;RSVP=TRUE:MAILTO:cassandane\@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:MAILTO:friend\@example.com
ORGANIZER;CN=Test User:MAILTO:cassandane\@example.com
END:VEVENT
BEGIN:VEVENT
CREATED:20150806T234327Z
UID:$uuid
TRANSP:OPAQUE
SUMMARY:An Event (late start)
DTSTART;TZID=Australia/Melbourne:20240708T163000
DTEND;TZID=Australia/Melbourne:20240708T183000
RECURRENCE-ID;TZID=Australia/Melbourne:20240708T153000
DTSTAMP:20150806T234327Z
SEQUENCE:0
ATTENDEE;CN=Test User;PARTSTAT=ACCEPTED;RSVP=TRUE:MAILTO:cassandane\@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:MAILTO:friend\@example.com
ORGANIZER;CN=Test User:MAILTO:cassandane\@example.com
END:VEVENT
END:VCALENDAR
EOF

$CalDAV->Request('PUT', $href, $card, 'Content-Type' => 'text/calendar');

$self->assert_caldav_notified(
{ recipient => "friend\@example.com", is_update => JSON::false, method => 'REQUEST' },
);

# change organizer and make the event 1 hour shorter, removing recurrence
$card = <<EOF;
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//Mac OS X 10.10.4//EN
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Australia/Melbourne
BEGIN:STANDARD
TZOFFSETFROM:+1100
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU
DTSTART:20080406T030000
TZNAME:AEST
TZOFFSETTO:+1000
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:+1000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=1SU
DTSTART:20081005T020000
TZNAME:AEDT
TZOFFSETTO:+1100
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20150806T234327Z
UID:$uuid
RRULE:FREQ=WEEKLY
TRANSP:OPAQUE
SUMMARY:An Event
DTSTART;TZID=Australia/Melbourne:20240701T153000
DTEND;TZID=Australia/Melbourne:20240701T173000
DTSTAMP:20150806T234327Z
SEQUENCE:0
ATTENDEE;CN=Test User;PARTSTAT=ACCEPTED;RSVP=TRUE:MAILTO:otherme\@example.com
ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:MAILTO:friend\@example.com
ORGANIZER;CN=Test User:MAILTO:otherme\@example.com
END:VEVENT
END:VCALENDAR
EOF

$CalDAV->Request('PUT', $href, $card,
'Content-Type' => 'text/calendar',
'Schedule-Address' => '[email protected]',
'Allow-Organizer-Change' => 'yes',
);

$self->assert_caldav_notified(
{
recipient => "friend\@example.com",
is_update => JSON::true,
method => 'REQUEST',
event => {
replyTo => {
imip => 'mailto:[email protected]',
},
},
},
{ recipient => "cassandane\@example.com", is_update => JSON::false, method => 'CANCEL' },
);
}

0 comments on commit 4f5d511

Please sign in to comment.