~ubuntu-branches/ubuntu/precise/libmodule-signature-perl/precise-updates

« back to all changes in this revision

Viewing changes to t/0-signature.t

  • Committer: Bazaar Package Importer
  • Author(s): Chip Salzenberg
  • Date: 2005-04-08 18:28:23 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050408182823-9f7rbs3n81zp48n1
Tags: 0.44-3
Re-upload with full source, as the 0.44-1 upload was borked so the
0.44-2 upload was refused.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/perl
2
 
# $File: //member/autrijus/Module-Signature/t/0-signature.t $ $Author: autrijus $
3
 
# $Revision: #5 $ $Change: 7212 $ $DateTime: 2003/07/28 14:21:21 $
4
2
 
5
3
use strict;
6
 
use Test::More tests => 1;
7
 
 
 
4
use Test::More;
 
5
 
 
6
if (!eval { require Module::Signature; 1 }) {
 
7
    plan skip_all => 
 
8
      "Next time around, consider installing Module::Signature, ".
 
9
      "so you can verify the integrity of this distribution.";
 
10
}
 
11
elsif ( !-e 'SIGNATURE' ) {
 
12
    plan skip_all => "SIGNATURE not found";
 
13
}
 
14
elsif ( -s 'SIGNATURE' == 0 ) {
 
15
    plan skip_all => "SIGNATURE file empty";
 
16
}
 
17
elsif (!eval { require Socket; Socket::inet_aton('subkeys.pgp.net') }) {
 
18
    plan skip_all => "Cannot connect to the keyserver to check module ".
 
19
                     "signature";
 
20
}
 
21
else {
 
22
    plan tests => 1;
 
23
}
 
24
 
 
25
my $ret = Module::Signature::verify();
8
26
SKIP: {
9
 
    if (!eval { require Module::Signature; 1 }) {
10
 
        skip("Next time around, consider install Module::Signature, ".
11
 
             "so you can verify the integrity of this distribution.", 1);
12
 
    }
13
 
    elsif (!eval { require Socket; Socket::inet_aton('pgp.mit.edu') }) {
14
 
        skip("Cannot connect to the keyserver", 1);
15
 
    }
16
 
    else {
17
 
        ok(Module::Signature::verify() == Module::Signature::SIGNATURE_OK()
18
 
            => "Valid signature" );
19
 
    }
 
27
    skip "Module::Signature cannot verify", 1 
 
28
      if $ret eq Module::Signature::CANNOT_VERIFY();
 
29
 
 
30
    cmp_ok $ret, '==', Module::Signature::SIGNATURE_OK(), "Valid signature";
20
31
}
21
 
 
22
 
__END__