[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-554-g8abfe0f

Shawn Moore sartak at bestpractical.com
Mon Nov 22 23:06:28 EST 2010


The branch, 3.9-trunk has been updated
       via  8abfe0f3fe01caff7fa6dec2b41a40a680684afc (commit)
      from  2b03802f46e0dae4f444e3bf0d2b7f4f8c32759e (commit)

Summary of changes:
 lib/RT/Test.pm       |    6 +++++-
 lib/RT/Test/GnuPG.pm |   45 +++++++++++++++++++++++++++++----------------
 2 files changed, 34 insertions(+), 17 deletions(-)

- Log -----------------------------------------------------------------
commit 8abfe0f3fe01caff7fa6dec2b41a40a680684afc
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 22 20:03:10 2010 -0500

    Have GPG's test config extend regular test config
    
        Without this, GPG doesn't get the regular test config, which means
        that for example $WebPort is set incorrectly

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 8be8403..1334c21 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -260,7 +260,9 @@ Set( \$MailCommand, sub {
     close \$handle;
 } );
 END
-    
+
+    $self->bootstrap_more_config($config, \%args);
+
     print $config $args{'config'} if $args{'config'};
 
     print $config "\n1;\n";
@@ -270,6 +272,8 @@ END
     return $config;
 }
 
+sub bootstrap_more_config { }
+
 sub bootstrap_logging {
     my $self = shift;
     my $config = shift;
diff --git a/lib/RT/Test/GnuPG.pm b/lib/RT/Test/GnuPG.pm
index fad3d37..206c06d 100644
--- a/lib/RT/Test/GnuPG.pm
+++ b/lib/RT/Test/GnuPG.pm
@@ -21,25 +21,10 @@ sub import {
     $t->plan( skip_all => 'gpg executable is required.' )
       unless RT::Test->find_executable('gpg');
 
-    RT->Config->Set(
-        GnuPG                  => Enable => 1,
-        OutgoingMessagesFormat => 'RFC',
-    );
-
-    my %gnupg_options = (
-        'no-permission-warning' => undef,
-        $args{gnupg_options} ? %{ $args{gnupg_options} } : (),
-    );
-    $gnupg_options{homedir} ||= scalar tempdir( CLEANUP => 1 );
-
-    RT->Config->Set( GnuPGOptions => %gnupg_options );
+    $class->SUPER::import(%args);
 
     RT::Test::diag "GnuPG --homedir " . RT->Config->Get('GnuPGOptions')->{'homedir'};
 
-    RT->Config->Set( 'MailPlugins' => 'Auth::MailFrom', 'Auth::GnuPG' );
-
-    $class->SUPER::import(%args);
-
     $class->set_rights(
         Principal => 'Everyone',
         Right => ['CreateTicket', 'ShowTicket', 'SeeQueue', 'ReplyToTicket', 'ModifyTicket'],
@@ -48,6 +33,34 @@ sub import {
     $class->export_to_level(1);
 }
 
+sub bootstrap_more_config {
+    my $self = shift;
+    my $handle = shift;
+    my $args = shift;
+
+    $self->SUPER::bootstrap_more_config($handle, $args, @_);
+
+    my %gnupg_options = (
+        'no-permission-warning' => undef,
+        $args->{gnupg_options} ? %{ $args->{gnupg_options} } : (),
+    );
+    $gnupg_options{homedir} ||= scalar tempdir( CLEANUP => 1 );
+
+    use Data::Dumper;
+    local $Data::Dumper::Terse = 1; # "{...}" instead of "$VAR1 = {...};"
+    my $dumped_gnupg_options = Dumper(\%gnupg_options);
+
+    print $handle qq{
+Set(\%GnuPG, (
+    Enable                 => 1,
+    OutgoingMessagesFormat => 'RFC',
+));
+Set(\%GnuPGOptions => \%{ $dumped_gnupg_options });
+Set(\@MailPlugins => qw(Auth::MailFrom Auth::GnuPG));
+};
+
+}
+
 sub create_a_ticket {
     my $queue = shift;
     my $mail = shift;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list