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

spang at bestpractical.com spang at bestpractical.com
Thu Jul 3 15:35:57 EDT 2008


Author: spang
Date: Thu Jul  3 15:35:55 2008
New Revision: 13781

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

Log:
 r43581 at loki:  spang | 2008-07-03 16:40:12 +0100
 make sendmail.t use new RT::Test functions


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 15:35:55 2008
@@ -43,14 +43,9 @@
 
 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 $multipart_report_email = File::Spec->catfile($emaildatadir, "multipart-report");
+my $multipart_report_email = RT::Test::get_relocateable_file('multipart-report',
+    qw(data emails));
 my $content =  RT::Test->file_content($multipart_report_email);
 # be as much like the mail gateway as possible.
 use RT::Interface::Email;
@@ -106,8 +101,8 @@
 # create an iso 8859-1 ticket
 @scrips_fired = ();
 
-my $iso_8859_1_ticket_email = File::Spec->catfile($emaildatadir,
-    "new-ticket-from-iso-8859-1");
+my $iso_8859_1_ticket_email = RT::Test::get_relocateable_file(
+    'new-ticket-from-iso-8859-1', qw(data emails));
 $content =  RT::Test->file_content($iso_8859_1_ticket_email);
 
 
@@ -250,7 +245,8 @@
 
 # {{{ test a multipart alternative containing a text-html part with an umlaut
 
- my $alt_umlaut_email = File::Spec->catfile($emaildatadir, 'multipart-alternative-with-umlaut');
+ my $alt_umlaut_email = RT::Test::get_relocateable_file(
+     'multipart-alternative-with-umlaut', qw(data emails));
  $content =  RT::Test->file_content($alt_umlaut_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
@@ -279,7 +275,8 @@
 # }}}
 
 # {{{ test a text-html message with an umlaut
- my $text_html_email = File::Spec->catfile($emaildatadir, "text-html-with-umlaut");
+ my $text_html_email = RT::Test::get_relocateable_file('text-html-with-umlaut',
+     qw(data emails));
  $content =  RT::Test->file_content($text_html_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
@@ -315,7 +312,8 @@
 # }}}
 
 # {{{ test a text-html message with russian characters
- my $russian_email = File::Spec->catfile($emaildatadir, "text-html-in-russian");
+ my $russian_email = RT::Test::get_relocateable_file('text-html-in-russian',
+     qw(data emails));
  $content =  RT::Test->file_content($russian_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
@@ -342,8 +340,8 @@
 
 RT->Config->Set( EmailInputEncodings => 'koi8-r', RT->Config->Get('EmailInputEncodings') );
 RT->Config->Set( EmailOutputEncoding => 'koi8-r' );
-my $russian_subject_email = File::Spec->catfile($emaildatadir,
-    'russian-subject-no-content-type');
+my $russian_subject_email = RT::Test::get_relocateable_file(
+    'russian-subject-no-content-type', qw(data emails));
 $content = RT::Test->file_content($russian_subject_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
@@ -385,7 +383,8 @@
 
 # {{{ test a message containing a nested RFC 822 message
 
-my $nested_rfc822_email = File::Spec->catfile($emaildatadir, 'nested-rfc-822');
+my $nested_rfc822_email = RT::Test::get_relocateable_file('nested-rfc-822',
+    qw(data emails));
 $content =  RT::Test->file_content($nested_rfc822_email);
 ok ($content, "Loaded nested-rfc-822 to test");
 
@@ -425,7 +424,8 @@
 
 # {{{ test a multipart alternative containing a uuencoded mesage generated by lotus notes
 
- my $uuencoded_email = File::Spec->catfile($emaildatadir, 'notes-uuencoded');
+ my $uuencoded_email = RT::Test::get_relocateable_file('notes-uuencoded',
+     qw(data emails));
  $content =  RT::Test->file_content($uuencoded_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
@@ -451,8 +451,8 @@
 
 # {{{ test a multipart that crashes the file-based mime-parser works
 
- my $crashes_file_based_parser_email = File::Spec->catfile($emaildatadir,
-     'crashes-file-based-parser');
+ my $crashes_file_based_parser_email = RT::Test::get_relocateable_file(
+     'crashes-file-based-parser', qw(data emails));
  $content = RT::Test->file_content($crashes_file_based_parser_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
@@ -480,7 +480,8 @@
 
 # {{{ test a multi-line RT-Send-CC header
 
- my $rt_send_cc_email = File::Spec->catfile($emaildatadir, "rt-send-cc");
+ my $rt_send_cc_email = RT::Test::get_relocateable_file('rt-send-cc',
+     qw(data emails));
  $content =  RT::Test->file_content($rt_send_cc_email);
 
 $parser->ParseMIMEEntityFromScalar($content);
@@ -506,8 +507,8 @@
 
 diag q{regression test for #5248 from rt3.fsck.com} if $ENV{TEST_VERBOSE};
 {
-    my $subject_folding_email = File::Spec->catfile($emaildatadir,
-        'subject-with-folding-ws');
+    my $subject_folding_email = RT::Test::get_relocateable_file(
+        'subject-with-folding-ws', qw(data emails));
     my $content = RT::Test->file_content($subject_folding_email);
     my ($status, $msg, $ticket) = RT::Interface::Email::Gateway(
         { message => $content, queue => 1, action => 'correspond' }
@@ -519,8 +520,8 @@
 
 diag q{regression test for #5248 from rt3.fsck.com} if $ENV{TEST_VERBOSE};
 {
-    my $long_subject_email = File::Spec->catfile($emaildatadir,
-        'very-long-subject');
+    my $long_subject_email = RT::Test::get_relocateable_file('very-long-subject',
+        qw(data emails));
     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