#!perl use Cassandane::Tiny; sub test_addressbook_set_destroy_contents :min_version_3_9 :needs_dependency_icalvcard { my ($self) = @_; my $jmap = $self->{jmap}; my $carddav = $self->{carddav}; xlog "Create addressbook and contact"; my $abookId = $carddav->NewAddressBook("foo"); my $card = <new_fromstring($card); my $cardId = basename($carddav->NewContact($abookId, $VCard), '.vcf'); xlog "Destroy addressbook (with and without onDestroyRemoveContents)"; my $res = $jmap->CallMethods([ ['AddressBook/set', { destroy => [$abookId], }, 'R1'], # XXX Change to ContactCard/get once implemented ['Contact/get', { ids => [$cardId], properties => ['id'], }, 'R2'], ['AddressBook/set', { destroy => [$abookId], onDestroyRemoveContents => JSON::true, }, 'R3'], ['Contact/get', { ids => [$cardId], properties => ['id'], }, 'R2'], ]); $self->assert_str_equals('addressBookHasContents', $res->[0][1]{notDestroyed}{$abookId}{type}); $self->assert_str_equals($cardId, $res->[1][1]{list}[0]{id}); $self->assert_deep_equals([$abookId], $res->[2][1]{destroyed}); $self->assert_deep_equals([$cardId], $res->[3][1]{notFound}); }