[Rt-commit] r13762 - in rt/3.8/trunk: t/mail

spang at bestpractical.com spang at bestpractical.com
Thu Jul 3 07:15:11 EDT 2008


Author: spang
Date: Thu Jul  3 07:15:10 2008
New Revision: 13762

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/t/mail/sendmail.t

Log:
 r43557 at loki:  spang | 2008-07-03 10:44:16 +0100
 make sendmail.t use relative paths to find the test data


Modified: rt/3.8/trunk/t/mail/sendmail.t
==============================================================================
--- rt/3.8/trunk/t/mail/sendmail.t	(original)
+++ rt/3.8/trunk/t/mail/sendmail.t	Thu Jul  3 07:15:10 2008
@@ -43,9 +43,15 @@
 
 my $parser = RT::EmailParser->new();
 
+# figure out where to find the test data
+(my $volume, my $directories, my $file) = File::Spec->splitpath($0);
+my $datadir = File::Spec->catdir(File::Spec->curdir(), $directories,
+    File::Spec->updir(), "data");
+my $emaildatadir = File::Spec->catdir($datadir, "emails");
 
 # Let's test to make sure a multipart/report is processed correctly
-my $content =  RT::Test->file_content("t/data/emails/multipart-report");
+my $multipart_report_email = File::Spec->catfile($emaildatadir, "multipart-report");
+my $content =  RT::Test->file_content($multipart_report_email);
 # be as much like the mail gateway as possible.
 use RT::Interface::Email;
 my %args =        (message => $content, queue => 1, action => 'correspond');
@@ -100,7 +106,9 @@
 # create an iso 8859-1 ticket
 @scrips_fired = ();
 
-$content =  RT::Test->file_content("t/data/emails/new-ticket-from-iso-8859-1");
+my $iso_8859_1_ticket_email = File::Spec->catfile($emaildatadir,
+    "new-ticket-from-iso-8859-1");
+$content =  RT::Test->file_content($iso_8859_1_ticket_email);
 
 
 
@@ -148,7 +156,7 @@
 # create an iso 8859-1 ticket
 @scrips_fired = ();
 
- $content =  RT::Test->file_content("t/data/emails/new-ticket-from-iso-8859-1");
+ $content =  RT::Test->file_content($test_email);
 # be as much like the mail gateway as possible.
 use RT::Interface::Email;
                                   
@@ -242,7 +250,8 @@
 
 # {{{ test a multipart alternative containing a text-html part with an umlaut
 
- $content =  RT::Test->file_content("t/data/emails/multipart-alternative-with-umlaut");
+ my $alt_umlaut_email = File::Spec->catfile($emaildatadir, 'multipart-alternative-with-umlaut');
+ $content =  RT::Test->file_content($alt_umlaut_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
 
@@ -270,8 +279,8 @@
 # }}}
 
 # {{{ test a text-html message with an umlaut
-
- $content =  RT::Test->file_content("t/data/emails/text-html-with-umlaut");
+ my $text_html_email = File::Spec->catfile($emaildatadir, "text-html-with-umlaut");
+ $content =  RT::Test->file_content($text_html_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
 
@@ -306,8 +315,8 @@
 # }}}
 
 # {{{ test a text-html message with russian characters
-
- $content =  RT::Test->file_content("t/data/emails/text-html-in-russian");
+ my $russian_email = File::Spec->catfile($emaildatadir, "text-html-in-russian");
+ $content =  RT::Test->file_content($russian_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
 
@@ -333,7 +342,9 @@
 
 RT->Config->Set( EmailInputEncodings => 'koi8-r', RT->Config->Get('EmailInputEncodings') );
 RT->Config->Set( EmailOutputEncoding => 'koi8-r' );
-$content =  RT::Test->file_content("t/data/emails/russian-subject-no-content-type");
+my $russian_subject_email = File::Spec->catfile($emaildatadir,
+    'russian-subject-no-content-type');
+$content = RT::Test->file_content($russian_subject_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
 
@@ -374,7 +385,8 @@
 
 # {{{ test a message containing a nested RFC 822 message
 
- $content =  RT::Test->file_content("t/data/emails/nested-rfc-822");
+my $nested_rfc822_email = File::Spec->catfile($emaildatadir, 'nested-rfc-822');
+$content =  RT::Test->file_content($nested_rfc822_email);
 ok ($content, "Loaded nested-rfc-822 to test");
 
 $parser->ParseMIMEEntityFromScalar($content);
@@ -413,7 +425,8 @@
 
 # {{{ test a multipart alternative containing a uuencoded mesage generated by lotus notes
 
- $content =  RT::Test->file_content("t/data/emails/notes-uuencoded");
+ my $uuencoded_email = File::Spec->catfile($emaildatadir, 'notes-uuencoded');
+ $content =  RT::Test->file_content($uuencoded_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
 
@@ -438,7 +451,9 @@
 
 # {{{ test a multipart that crashes the file-based mime-parser works
 
- $content =  RT::Test->file_content("t/data/emails/crashes-file-based-parser");
+ my $crashes_file_based_parser_email = File::Spec->catfile($emaildatadir,
+     'crashes-file-based-parser');
+ $content = RT::Test->file_content($crashes_file_based_parser_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
 
@@ -465,7 +480,8 @@
 
 # {{{ test a multi-line RT-Send-CC header
 
- $content =  RT::Test->file_content("t/data/emails/rt-send-cc");
+ my $rt_send_cc_email = File::Spec->catfile($emaildatadir, "rt-send-cc");
+ $content =  RT::Test->file_content($rt_send_cc_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
 
@@ -490,7 +506,9 @@
 
 diag q{regression test for #5248 from rt3.fsck.com} if $ENV{TEST_VERBOSE};
 {
-    my $content = RT::Test->file_content("t/data/emails/subject-with-folding-ws");
+    my $subject_folding_email = File::Spec->catfile($emaildatadir,
+        'subject-with-folding-ws');
+    my $content = RT::Test->file_content($subject_folding_email);
     my ($status, $msg, $ticket) = RT::Interface::Email::Gateway(
         { message => $content, queue => 1, action => 'correspond' }
     );
@@ -501,7 +519,9 @@
 
 diag q{regression test for #5248 from rt3.fsck.com} if $ENV{TEST_VERBOSE};
 {
-    my $content = RT::Test->file_content("t/data/emails/very-long-subject");
+    my $long_subject_email = File::Spec->catfile($emaildatadir,
+        'very-long-subject');
+    my $content = RT::Test->file_content($long_subject_email);
     my ($status, $msg, $ticket) = RT::Interface::Email::Gateway(
         { message => $content, queue => 1, action => 'correspond' }
     );


More information about the Rt-commit mailing list