[Rt-commit] r8873 - rt/branches/3.7-EXPERIMENTAL/t/mail

ruz at bestpractical.com ruz at bestpractical.com
Fri Aug 31 21:02:45 EDT 2007


Author: ruz
Date: Fri Aug 31 21:02:45 2007
New Revision: 8873

Modified:
   rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t
   rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-reverification.t

Log:
* use new helper functions and standalone keyring for each gnupg test file

Modified: rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t	Fri Aug 31 21:02:45 2007
@@ -1,15 +1,14 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
+
 use Test::More tests => 176;
-use File::Temp;
 use RT::Test;
-use Cwd 'getcwd';
-use String::ShellQuote 'shell_quote';
-use IPC::Run3 'run3';
+
 use Digest::MD5 qw(md5_hex);
 
-my $homedir = File::Spec->catdir( getcwd(), qw(lib t data crypt-gnupg-2) );
+use File::Temp qw(tempdir);
+my $homedir = tempdir( CLEANUP => 1 );
 
 RT->Config->Set( LogToScreen => 'debug' );
 RT->Config->Set( 'GnuPG',
@@ -23,6 +22,9 @@
 
 RT->Config->Set( 'MailPlugins' => 'Auth::MailFrom', 'Auth::GnuPG' );
 
+RT::Test->import_gnupg_key('rt-recipient at example.com');
+RT::Test->import_gnupg_key('rt-test at example.com', 'public');
+
 my ($baseurl, $m) = RT::Test->started_ok;
 ok $m->login, 'we did log in';
 $m->get_ok( '/Admin/Queues/');

Modified: rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-reverification.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-reverification.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-reverification.t	Fri Aug 31 21:02:45 2007
@@ -38,7 +38,7 @@
 my ($baseurl, $m) = RT::Test->started_ok;
 ok $m->login, 'we get log in';
 
-import_key('rt-recipient at example.com');
+RT::Test->import_gnupg_key('rt-recipient at example.com');
 
 my @ticket_ids;
 
@@ -72,7 +72,7 @@
 }
 
 diag "import key into keyring" if $ENV{'TEST_VERBOSE'};
-import_key('rt-test at example.com', 'public');
+RT::Test->import_gnupg_key('rt-test at example.com', 'public');
 
 foreach my $id ( @ticket_ids ) {
     diag "testing ticket #$id" if $ENV{'TEST_VERBOSE'};
@@ -93,20 +93,3 @@
     return do { local $/; <$mailhandle> };
 }
 
-sub delete_key {
-    require RT::Crypt::GnuPG;
-    return RT::Crypt::GnuPG::DeleteKey( shift );
-}
-
-sub import_key {
-    my $key = shift;
-    my $type = shift || 'secret';
-
-    $key =~ s/\@/-at-/g;
-    $key .= ".$type.key";
-    $key = 't/data/gnupg/keys/'. $key;
-    open my $fh, '<:raw', $key or die "couldn't open '$key': $!";
-
-    require RT::Crypt::GnuPG;
-    return RT::Crypt::GnuPG::ImportKey( do { local $/; <$fh> } );
-}


More information about the Rt-commit mailing list