#!/usr/bin/perl
test_needs_openpgp_backend();
plan
tests
=> 6;
use_ok(
'Dpkg::Source::Package'
);
report_options(
quiet_warnings
=> 1);
my
$datadir
= test_get_data_path();
my
$tmpdir
= test_get_temp_path();
my
$ascfile
;
my
$p
= Dpkg::Source::Package->new();
$ascfile
=
"$tmpdir/package_1.0.orig.tar.enoent"
;
is(
$p
->armor_original_tarball_signature(
"$datadir/nonexistent"
,
$ascfile
),
undef
,
'no conversion of inexistent file'
);
$ascfile
=
"$tmpdir/package_1.0.orig.tar.sig2asc"
;
is(
$p
->armor_original_tarball_signature(
"$datadir/package_1.0.orig.tar.sig"
,
$ascfile
),
OPENPGP_OK,
'conversion from binary sig to armored asc'
);
ok(compare(
$ascfile
,
"$datadir/package_1.0.orig.tar.asc"
) == 0,
'binary signature converted to OpenPGP ASCII Armor'
);
eval
{
$ascfile
=
"$tmpdir/package_1.0.orig.tar.asc2asc"
;
is(
$p
->armor_original_tarball_signature(
"$datadir/package_1.0.orig.tar.asc"
,
$ascfile
),
OPENPGP_OK,
'copy instead of converting already armored input'
);
};
ok(compare(
$ascfile
,
"$datadir/package_1.0.orig.tar.asc"
) == 0,
'OpenPGP ASCII Armor copied to destination'
);