[Rt-commit] r8784 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Tue Aug 28 14:42:00 EDT 2007


Author: ruz
Date: Tue Aug 28 14:41:58 2007
New Revision: 8784

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t

Log:
 r8706 at cubic-pc (orig r8705):  sartak | 2007-08-24 00:03:23 +0400
  r38014 at gorgoroth:  sartak | 2007-08-23 16:03:14 -0400
  Now we actually test whether the mail RT sends is encrypted
 


Modified: rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t	Tue Aug 28 14:41:58 2007
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 
-use Test::More tests => 14;
+use Test::More tests => 13;
 use RT::Test;
 use RT::Action::SendEmail;
 
@@ -10,23 +10,22 @@
 # catch any outgoing emails
 unlink "t/mailbox";
 
-is (__PACKAGE__, 'main', "We're operating in the main package");
-{
-    no warnings qw/redefine/;
-    sub RT::Action::SendEmail::SendMessage {
-        my $self = shift;
-        my $MIME = shift;
-
-        open my $handle, '>>', 't/mailbox'
-            or die "Unable to open t/mailbox for appending: $!";
-
-        print $handle map {"$_\n"} @{$MIME->body};
-        print $handle "%% split me! %%\n";
-    }
+sub capture_mail {
+    my $MIME = shift;
+
+    open my $handle, '>>', 't/mailbox'
+        or die "Unable to open t/mailbox for appending: $!";
+
+    $MIME->print($handle);
+    print $handle "%% split me! %%\n";
+    close $handle;
 }
 
 RT->Config->Set( LogToScreen => 'debug' );
 RT->Config->Set( LogStackTraces => 'error' );
+RT->Config->Set( CommentAddress => 'general at example.com');
+RT->Config->Set( CorrespondAddress => 'general at example.com');
+RT->Config->Set( MailCommand => \&capture_mail);
 
 use File::Spec ();
 use Cwd;
@@ -80,8 +79,7 @@
 $m->get($baseurl); # ensure that the mail has been processed
 
 my $mail = file_content('t/mailbox');
-my @mail = split /\n%% split me! %%\n/, $mail;
-pop @mail;
+my @mail = grep {/\S/} split /%% split me! %%/, $mail;
 ok(@mail, "got some mail");
 for (@mail) {
     unlike $_, qr/Some content/, "outgoing mail was encrypted";


More information about the Rt-commit mailing list