[Rt-commit] r5807 - in RT-Extension-CommandByEmail: .

kevinr at bestpractical.com kevinr at bestpractical.com
Wed Aug 23 18:44:57 EDT 2006


Author: kevinr
Date: Wed Aug 23 18:44:55 2006
New Revision: 5807

Added:
   RT-Extension-CommandByEmail/t/04.send.t
Modified:
   RT-Extension-CommandByEmail/   (props changed)

Log:
 r27531 at sad-girl-in-snow:  kevinr | 2006-08-23 18:00:12 -0400
 * Tests to make sure In-Reply-To: gets set properly


Added: RT-Extension-CommandByEmail/t/04.send.t
==============================================================================
--- (empty file)
+++ RT-Extension-CommandByEmail/t/04.send.t	Wed Aug 23 18:44:55 2006
@@ -0,0 +1,47 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+use File::Temp qw/ tempfile tempdir /;
+
+use RT;
+RT::LoadConfig;
+RT::Init;
+
+diag("test errors via mailgate") if $ENV{'TEST_VERBOSE'};
+{
+    my $message_id = "foobar-$$\@example.com";
+    my $text = <<END;
+Subject: error test
+From: root\@localhost
+Message-Id: $message_id
+
+Owner: this-user-does-not-exist\@example.com
+
+test
+END
+
+    my ($fh, $filename) = tempfile();
+    diag("Tempfile: $filename");
+    $RT::SendmailPath = "cat > $filename";
+    $RT::SendmailBounceArguments = '';
+    $RT::SendmailArguments = '';
+
+    use RT::EmailParser;
+    my $parser = RT::EmailParser->new();
+    $parser->ParseMIMEEntityFromScalar($text);
+
+    RT::Interface::Email::MailError(
+        To      => 'root at localhost',
+        Subject => "Extended mailgate error",
+        Explanation => "FUBARed",
+        MIMEObj => $parser->Entity,
+    );
+
+    ok( (grep { /^In-Reply-To: $message_id$/ } <$fh>), "Set the In-Reply-To: header properly" );
+}
+
+1;


More information about the Rt-commit mailing list