[Rt-commit] r8708 - in rt/branches/3.7-EXPERIMENTAL-TUNIS: t/web

sartak at bestpractical.com sartak at bestpractical.com
Thu Aug 23 17:14:39 EDT 2007


Author: sartak
Date: Thu Aug 23 17:14:38 2007
New Revision: 8708

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

Log:
 r38025 at gorgoroth:  sartak | 2007-08-23 17:14:32 -0400
 Actually try sending RT's mail back into RT. currently failing a little


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 17:14:38 2007
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
 
-use Test::More tests => 21;
+use Test::More tests => 29;
 use RT::Test;
 use RT::Action::SendEmail;
 
@@ -83,6 +83,38 @@
 ok(@mail, "got some mail");
 for (@mail) {
     unlike $_, qr/Some content/, "outgoing mail was encrypted";
+    my ($content_type) = /(Content-Type: .*)/;
+    $_ = strip_headers($_);
+    $_ = << "MAIL";
+From: recipient\@example.com
+To: general\@$RT::rtname
+Subject: This is just RT's response fed back into RT
+$content_type
+
+$_
+MAIL
+
+    my ($status, $id) = RT::Test->send_via_mailgate($_);
+    is ($status >> 8, 0, "The mail gateway exited normally");
+    ok ($id, "got id of a newly created ticket - $id");
+
+    my $tick = RT::Ticket->new( $RT::SystemUser );
+    $tick->Load( $id );
+    ok($tick->id, "loaded ticket #$id");
+
+    is($tick->Subject, "This is just RT's response fed back into RT");
+    my $txn = $tick->Transactions->First;
+    my ($msg, @attachments) = @{$txn->Attachments->ItemsArrayRef};
+
+    is($msg->GetHeader('X-RT-Incoming-Encryption'),
+        'Success',
+        "RT's outgoing mail was indeed encrypted");
+    is($msg->GetHeader('X-RT-Privacy'),
+        'PGP');
+
+    like($attachments[0]->Content, qr/Some content/, "RT's mail includes copy of ticket text");
+    like($attachments[0]->Content, qr/\@$RT::rtname/, "RT's mail includes this instance's name");
+
 }
 
 $m->get("$baseurl/Admin/Queues/Modify.html?id=$qid");
@@ -97,6 +129,8 @@
 is($m->status, 200, "request successful");
 $m->content_like(qr/Create a new ticket/, 'ticket create page');
 
+unlink "t/mailbox";
+
 $m->form_name('TicketCreate');
 $m->field('Subject', 'Signing test');
 $m->field('Content', 'Some other content');
@@ -126,3 +160,11 @@
     unlink $path;
     return $content;
 }
+
+sub strip_headers
+{
+    my $mail = shift;
+    $mail =~ s/^.*?\n\n//s;
+    return $mail;
+}
+


More information about the Rt-commit mailing list