[Rt-commit] r7672 - rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail

clkao at bestpractical.com clkao at bestpractical.com
Tue Apr 24 12:56:45 EDT 2007


Author: clkao
Date: Tue Apr 24 12:56:26 2007
New Revision: 7672

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/gnupg-incoming.t

Log:
tests for attached original message.

Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/gnupg-incoming.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/gnupg-incoming.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/t/mail/gnupg-incoming.t	Tue Apr 24 12:56:26 2007
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 use strict;
-use Test::More tests => 45;
+use Test::More tests => 46;
 use File::Temp;
 use RT::Test;
 use Cwd 'getcwd';
@@ -95,8 +95,9 @@
     );
 
     my $txn = $tick->Transactions->First;
-    my $attach = $txn->Attachments->First;
-    is( $attach->GetHeader('X-RT-Incoming-Encryption'),
+    my ($msg, $attach) = @{$txn->Attachments->ItemsArrayRef};
+
+    is( $msg->GetHeader('X-RT-Incoming-Encryption'),
         'Not encrypted',
         'recorded incoming mail that is encrypted'
     );
@@ -136,8 +137,8 @@
     );
 
     my $txn = $tick->Transactions->First;
-    my $attach = $txn->Attachments->First;
-    is( $attach->GetHeader('X-RT-Incoming-Encryption'),
+    my ($msg, $attach) = @{$txn->Attachments->ItemsArrayRef};
+    is( $msg->GetHeader('X-RT-Incoming-Encryption'),
         'Not encrypted',
         'recorded incoming mail that is encrypted'
     );
@@ -178,16 +179,20 @@
     );
 
     my $txn = $tick->Transactions->First;
-    my $attach = $txn->Attachments->First;
-    is( $attach->GetHeader('X-RT-Incoming-Encryption'),
+    my ($msg, $attach, $orig) = @{$txn->Attachments->ItemsArrayRef};
+
+    is( $msg->GetHeader('X-RT-Incoming-Encryption'),
         'Success',
         'recorded incoming mail that is encrypted'
     );
-    is( $attach->GetHeader('X-RT-Privacy'),
+    is( $msg->GetHeader('X-RT-Privacy'),
         'PGP',
         'recorded incoming mail that is encrypted'
     );
     like( $attach->Content, qr'orz');
+
+    is( $orig->GetHeader('Content-Type'), 'application/x-rt-original-message');
+    ok(index($orig->Content, $buf) != -1, 'found original msg');
 }
 
 # test for signed mail by other key
@@ -219,8 +224,9 @@
     my $tick = get_latest_ticket_ok();
     my $txn = $tick->Transactions->First;
     my $attach = $txn->Attachments->First;
-    like( $attach->Content, qr'alright');
-    is( $attach->GetHeader('X-RT-Incoming-Signature'),
+    my ($msg, $attach) = @{$txn->Attachments->ItemsArrayRef};
+    # XXX: in this case, which credential should we be using?
+    is( $msg->GetHeader('X-RT-Incoming-Signature'),
         'Test User <rt at example.com>',
         'recorded incoming mail signed by others'
     );
@@ -253,7 +259,7 @@
 {
     my $tick = get_latest_ticket_ok();
     my $txn = $tick->Transactions->First;
-    my $attach = $txn->Attachments->First;
+    my ($msg, $attach) = @{$txn->Attachments->ItemsArrayRef};
     unlike( $attach->Content, qr'should not be there either');
 }
 
@@ -294,7 +300,7 @@
 {
     my $tick = get_latest_ticket_ok();
     my $txn = $tick->Transactions->First;
-    my $attach = $txn->Attachments->First;
+    my ($msg, $attach) = @{$txn->Attachments->ItemsArrayRef};
     unlike( $attach->Content, qr'really should not be there either');
 }
 
@@ -306,3 +312,4 @@
     ok( $tick->Id, "found ticket " . $tick->Id );
     return $tick;
 }
+


More information about the Rt-commit mailing list