[Bps-public-commit] r10686 - Mail-GnuPG/trunk/t

robert at bestpractical.com robert at bestpractical.com
Sun Feb 3 03:19:08 EST 2008


Author: robert
Date: Sun Feb  3 03:19:05 2008
New Revision: 10686

Modified:
   Mail-GnuPG/trunk/t/round-trip.t

Log:

http://rt.cpan.org/Ticket/Display.html?id=32256

  Requestors: ntyni at debian.org


Hi,

while working on other issues in Mail::GnuPG 0.10, I noticed that
t/roundtrip.t is currently incomplete. The comments inside indicate a
problem with initializing the trust database in the test gpg keyring.
One fix for this is to import the test key with '--trusted-key'.



Modified: Mail-GnuPG/trunk/t/round-trip.t
==============================================================================
--- Mail-GnuPG/trunk/t/round-trip.t	(original)
+++ Mail-GnuPG/trunk/t/round-trip.t	Sun Feb  3 03:19:05 2008
@@ -17,12 +17,12 @@
 
 my $tmpdir = tempdir( "mgtXXXXX", CLEANUP => 1);
 
-unless ( 0 == system("gpg --homedir $tmpdir --import t/test-key.pgp 2>&1 >/dev/null")) {
+unless ( 0 == system("gpg --homedir $tmpdir --trusted-key 0x49539D60EFEA4EAD --import t/test-key.pgp 2>&1 >/dev/null")) {
   plan skip_all => "unable to import testing keys";
   goto end;
 }
 
-plan tests => 13;
+plan tests => 20;
 
 
 my $mg = new Mail::GnuPG( key => '49539D60EFEA4EAD',
@@ -36,7 +36,6 @@
 			      To      => 'you at yourhost.com',
 			      Subject => "Hello, nurse!",
 			      Data    => ["Line 1","Line 2"]);
-
 # Test MIME Signing Round Trip
 
 $copy = $me->dup;
@@ -67,30 +66,18 @@
 }
 # Test MIME Encryption Round Trip
 
-# hmm.. the encryption functions don't seem to be working right.
-# something about ...
-# gpg: 9FE08E94: There is no indication that this key really belongs to the owner
-# gpg: [stdin]: encryption failed: unusable public key
-
-
-# $copy = $me->dup;
-
-# is( 0, $mg->ascii_encrypt( $copy, $KEY ));
-# warn @{$mg->{last_message}},"\n";
-# warn @{$mg->{plaintext}},"\n";
-# warn "hihi\n";
-# exit;
-# is( 0, $mg->is_signed($copy) );
-# is( 1, $mg->is_encrypted($copy) );
-
-# my ($verify,$key,$who) = $mg->decrypt($copy);
+$copy = $me->dup;
 
-# is( 0, $verify );
-# is( undef, $key );
-# is( undef, $who );
+is( 0, $mg->ascii_encrypt( $copy, $KEY ));
+is( 0, $mg->is_signed($copy) );
+is( 1, $mg->is_encrypted($copy) );
 
-# is_deeply($mg->{decrypted},$me);
+($verify,$key,$who) = $mg->decrypt($copy);
 
+is( 0, $verify );
+is( undef, $key );
+is( undef, $who );
 
+is_deeply($mg->{decrypted}->body,$me->body);
 
 end:



More information about the Bps-public-commit mailing list