#!perl
use Cassandane::Tiny;

sub test_email2details
    :min_version_3_1 :needs_component_httpd
    ($self)
{
    my $CardDAV = $self->{carddav};
    my $Id = $CardDAV->NewAddressBook('foo');
    $self->assert_not_null($Id);
    $self->assert_str_equals($Id, 'foo');

    my $Str = <<EOF;
BEGIN:VCARD
VERSION:3.0
N:Gump;Forrest;;Mr.
FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
EMAIL;TYPE=INTERNET:user\@example.com
REV:2008-04-24T19:52:43Z
END:VCARD
EOF

    my $VCard = vcard_to_jscontact($Str);

    my $uid = $CardDAV->NewContact($Id, $VCard);

    my $res = $CardDAV->Request('GET', '/dblookup/email2details', '',
        User => 'cassandane',
        Key => "user\@example.com",
        Mailbox => 'foo',
    );

    # XXX: actually compare to the UID
}
