#!perl use Cassandane::Tiny; sub test_shared_team_invite_sharer :VirtDomains :min_version_3_1 :NoAltNameSpace { my ($self) = @_; my $admintalk = $self->{adminstore}->get_client(); $admintalk->create("user.test"); $admintalk->setacl("user.test", "test" => "lrswipkxtecda"); my $service = $self->{instance}->get_service("http"); my $testtalk = Net::CalDAVTalk->new( user => "test", password => 'pass', host => $service->host(), port => $service->port(), scheme => 'http', url => '/', expandurl => 1, ); my $xml = < mailto:test\@example.com EOF $testtalk->Request('PROPPATCH', "/dav/principals/user/test", $xml, 'Content-Type' => 'text/xml'); xlog $self, "create calendar"; my $CalendarId = $testtalk->NewCalendar({name => 'Team Calendar'}); $self->assert_not_null($CalendarId); xlog $self, "share to user"; $admintalk->setacl("user.test.#calendars.$CalendarId", "cassandane" => 'lrswipcdn'); my $CalDAV = Net::CalDAVTalk->new( user => "cassandane", password => 'pass', host => $service->host(), port => $service->port(), scheme => 'http', url => '/', expandurl => 1, ); xlog $self, "subscribe to shared calendar"; my $imapstore = $self->{instance}->get_service('imap')->create_store( username => "cassandane"); my $imaptalk = $imapstore->get_client(); $imaptalk->subscribe("user.test.#calendars.$CalendarId"); xlog $self, "get calendars as cassandane"; my $CasCal = $CalDAV->GetCalendars(); my $sharedCalendarId = $CasCal->[1]{href}; my $uuid = "6de280c9-edff-4019-8ebd-cfebc73f8201"; my $href = "$sharedCalendarId/$uuid.ics"; my $card = <Request('PUT', $href, $card, 'Content-Type' => 'text/calendar'); $self->assert_caldav_notified( { recipient => "test\@example.com", is_update => JSON::false, method => 'REQUEST' }, { recipient => "friend\@example.com", is_update => JSON::false, method => 'REQUEST' }, ); xlog $self, "update PARTSTAT as sharer"; $href = "/dav/calendars/user/test/$CalendarId/$uuid.ics"; $card =~ s/PARTSTAT=NEEDS-ACTION/PARTSTAT=ACCEPTED/; $testtalk->Request('PUT', $href, $card, 'Content-Type' => 'text/calendar'); $self->assert_caldav_notified( { recipient => "cassandane\@example.com", is_update => JSON::false, method => 'REPLY' }, ); }