-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jmap_contact.c: Add Card[Group]/get methods (with a simple test)
- Loading branch information
1 parent
3d2cf33
commit e0990d5
Showing
2 changed files
with
1,420 additions
and
2 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
cassandane/tiny-tests/JMAPContacts/card-get-apple-countrycode
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,53 @@ | ||
#!perl | ||
use Cassandane::Tiny; | ||
|
||
sub test_card_get_apple_countrycode | ||
:min_version_3_9 :needs_component_jmap | ||
{ | ||
my ($self) = @_; | ||
my $jmap = $self->{jmap}; | ||
|
||
my $service = $self->{instance}->get_service("http"); | ||
$ENV{DEBUGDAV} = 1; | ||
my $carddav = Net::CardDAVTalk->new( | ||
user => 'cassandane', | ||
password => 'pass', | ||
host => $service->host(), | ||
port => $service->port(), | ||
scheme => 'http', | ||
url => '/', | ||
expandurl => 1, | ||
); | ||
|
||
my $id = 'ae2640cc-234a-4dd9-95cc-3106258445b9'; | ||
my $href = "Default/$id.vcf"; | ||
my $card = <<EOF; | ||
BEGIN:VCARD | ||
VERSION:3.0 | ||
UID:$id | ||
N:Gump;Forrest;;Mr. | ||
FN:Forrest Gump | ||
ORG:Bubba Gump Shrimp Co. | ||
TITLE:Shrimp Man | ||
REV:2008-04-24T19:52:43Z | ||
item1.ADR;prop-id=A1;type=WORK:;;2 Example Avenue;Anytown;NY;01111;USA | ||
item1.X-ABADR:US | ||
item1.X-ABLabel:xyz | ||
item2.ADR;prop-id=A2;type=WORK:;;Beispielstrasse 2;IrgendwoStadt;IrgendwoLand;00000;Germany | ||
item2.X-ABADR:de | ||
END:VCARD | ||
EOF | ||
|
||
$card =~ s/\r?\n/\r\n/gs; | ||
$carddav->Request('PUT', $href, $card, 'Content-Type' => 'text/vcard'); | ||
|
||
my $res = $jmap->CallMethods([ | ||
['Card/get', { | ||
properties => ['addresses'] | ||
}, 'R1'] | ||
]); | ||
|
||
$self->assert_str_equals('us', $res->[0][1]{list}[0]{addresses}{A1}{countryCode}); | ||
$self->assert_str_equals('xyz', $res->[0][1]{list}[0]{addresses}{A1}{label}); | ||
$self->assert_str_equals('de', $res->[0][1]{list}[0]{addresses}{A2}{countryCode}); | ||
} |
Oops, something went wrong.