Skip to content

Commit 167158f

Browse files
committed
Carddav.pm: added test_replication
1 parent ec54544 commit 167158f

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

Diff for: cassandane/Cassandane/Cyrus/Carddav.pm

+60
Original file line numberDiff line numberDiff line change
@@ -1362,4 +1362,64 @@ EOF
13621362
}
13631363
}
13641364

1365+
sub test_replication
1366+
:needs_component_httpd :needs_component_replication
1367+
{
1368+
my ($self) = @_;
1369+
1370+
my $CardDAV = $self->{carddav};
1371+
1372+
my $ABookId = $CardDAV->NewAddressBook('foo');
1373+
$self->assert_not_null($ABookId);
1374+
1375+
$self->run_replication();
1376+
$self->check_replication('cassandane');
1377+
1378+
my $uid = "3b678b69-ca41-461e-b2c7-f96b9fe48d68";
1379+
my $href = "$ABookId/card.ics";
1380+
my $card = <<EOF;
1381+
BEGIN:VCARD
1382+
VERSION:3.0
1383+
UID:$uid
1384+
N:Gump;Forrest;;Mr.
1385+
FN;FOO=bar:Forrest Gump
1386+
ORG:Bubba Gump Shrimp Co.
1387+
TITLE:Shrimp Man
1388+
REV:2008-04-24T19:52:43Z
1389+
END:VCARD
1390+
EOF
1391+
1392+
$CardDAV->Request('PUT', $href, $card, 'Content-Type' => 'text/vcard');
1393+
my $response = $CardDAV->Request('GET', $href);
1394+
my $value = $response->{content};
1395+
$self->assert_matches(qr/$uid/, $value);
1396+
1397+
$self->run_replication();
1398+
$self->check_replication('cassandane');
1399+
1400+
$card =~ s/;FOO=bar:Forrest Gump/:/;
1401+
1402+
$CardDAV->Request('PUT', $href, $card, 'Content-Type' => 'text/vcard');
1403+
1404+
$self->run_replication();
1405+
$self->check_replication('cassandane');
1406+
1407+
$card =~ s/REV:/NICKNAME:Captain\r\nREV:/;
1408+
1409+
$CardDAV->Request('PUT', $href, $card, 'Content-Type' => 'text/vcard');
1410+
1411+
$self->run_replication();
1412+
$self->check_replication('cassandane');
1413+
1414+
$CardDAV->DeleteContact($href);
1415+
1416+
$self->run_replication();
1417+
$self->check_replication('cassandane');
1418+
1419+
$CardDAV->DeleteAddressBook($ABookId);
1420+
1421+
$self->run_replication();
1422+
$self->check_replication('cassandane');
1423+
}
1424+
13651425
1;

0 commit comments

Comments
 (0)