[Rt-commit] r8519 - in rt/branches/3.7-EXPERIMENTAL-TUNIS: .
sartak at bestpractical.com
sartak at bestpractical.com
Mon Aug 13 16:01:59 EDT 2007
Author: sartak
Date: Mon Aug 13 16:01:57 2007
New Revision: 8519
Modified:
rt/branches/3.7-EXPERIMENTAL-TUNIS/ (props changed)
rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/gnupg-realmail.t
Log:
r37376 at gorgoroth: sartak | 2007-08-13 16:01:10 -0400
more test fixes
Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/gnupg-realmail.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/gnupg-realmail.t (original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/gnupg-realmail.t Mon Aug 13 16:01:57 2007
@@ -1,12 +1,13 @@
#!/usr/bin/perl
use strict;
use warnings;
-use Test::More tests => 160;
+use Test::More tests => 158;
use File::Temp;
use RT::Test;
use Cwd 'getcwd';
use String::ShellQuote 'shell_quote';
use IPC::Run3 'run3';
+use Digest::MD5 qw(md5_base64);
my $homedir = File::Spec->catdir( getcwd(), qw(lib t data crypt-gnupg-realmail) );
@@ -35,14 +36,15 @@
ok($user->Load('root'), "Loaded user 'root'");
$user->SetEmailAddress('ternus at mit.edu');
+my %body = (1 => qr/This is a test email with MIME signature./);
+
my $eid = 0;
for my $usage (qw/signed encrypted signed&encrypted/) {
for my $format (qw/MIME inline/) {
for my $attachment (qw/plain text-attachment binary-attachment/) {
++$eid;
diag "Email $eid: $usage, $attachment email with $format key" if $ENV{TEST_VERBOSE};
- my $ok = eval { email_ok($eid, $usage, $format, $attachment) };
- ok($ok, "$usage, $attachment email with $format key");
+ eval { email_ok($eid, $usage, $format, $attachment) };
}
}
}
@@ -93,7 +95,7 @@
#XXX: maybe RT will have already decrypted this for us
unlike( $msg->Content,
- qr/ID:$eid/,
+ ($body{$eid} || qr/ID:$eid/),
'incoming mail did NOT have original body'
);
}
@@ -103,7 +105,7 @@
'recorded incoming mail that is not encrypted'
);
like( $msg->Content || $attachments[0]->Content,
- qr/ID:$eid/,
+ ($body{$eid} || qr/ID:$eid/),
'got original content'
);
}
@@ -122,18 +124,26 @@
}
if ($attachment =~ /attachment/) {
- my $attachment = $attachments[0];
- my $file = '';
- ok ($attachment->Id, 'loaded attachment object');
- my $acontent = $attachment->Content;
- is ($acontent, $file, 'The attachment isn\'t screwed up in the database.');
-
# signed messages should sign each attachment too
if ($usage =~ /signed/) {
- my $sig = $attachments[1];
- ok ($attachment->Id, 'loaded attachment.sig object');
- my $acontent = $attachment->Content;
+ my $sig = pop @attachments;
+ ok ($sig->Id, 'loaded attachment.sig object');
+ my $acontent = $sig->Content;
+ }
+
+ my $a = pop @attachments;
+ my $file = '';
+ ok ($a->Id, 'loaded attachment object');
+ my $acontent = $a->Content;
+ if ($attachment =~ /binary/)
+ {
+ is(md5_base64($acontent), '', "The binary attachment's md5sum matches");
}
+ else
+ {
+ like($acontent, qr/zanzibar/, 'The attachment isn\'t screwed up in the database.');
+ }
+
}
return 0;
More information about the Rt-commit
mailing list