[Rt-commit] r8872 - rt/branches/3.7-EXPERIMENTAL/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Fri Aug 31 21:01:28 EDT 2007


Author: ruz
Date: Fri Aug 31 21:01:27 2007
New Revision: 8872

Modified:
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm

Log:
* add RT::Test->import_gnupg_key helper function

Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Test.pm	Fri Aug 31 21:01:27 2007
@@ -389,4 +389,18 @@
     return ($status, $id);
 }
 
+sub import_gnupg_key {
+    my $self = shift;
+    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> } );
+}
+
 1;


More information about the Rt-commit mailing list