[Rt-commit] r8705 - in rt/branches/3.7-EXPERIMENTAL-TUNIS: t/web
sartak at bestpractical.com
sartak at bestpractical.com
Thu Aug 23 16:03:27 EDT 2007
Author: sartak
Date: Thu Aug 23 16:03:23 2007
New Revision: 8705
Modified:
rt/branches/3.7-EXPERIMENTAL-TUNIS/ (props changed)
rt/branches/3.7-EXPERIMENTAL-TUNIS/t/web/crypt-gnupg.t
Log:
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-TUNIS/t/web/crypt-gnupg.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/t/web/crypt-gnupg.t (original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/t/web/crypt-gnupg.t Thu Aug 23 16:03:23 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