[Rt-commit] r8930 - in rt/branches/3.7-EXPERIMENTAL/t: mail

ruz at bestpractical.com ruz at bestpractical.com
Wed Sep 5 07:02:30 EDT 2007


Author: ruz
Date: Wed Sep  5 07:02:29 2007
New Revision: 8930

Modified:
   rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-incoming.t
   rt/branches/3.7-EXPERIMENTAL/t/mail/sendmail.t
   rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t

Log:
* use new function

Modified: rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-incoming.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-incoming.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-incoming.t	Wed Sep  5 07:02:29 2007
@@ -306,7 +306,7 @@
 $buf
 EOF
 RT::Test->close_mailgate_ok($mail);
-my $mails = file_content_unlink('t/mailbox');
+my $mails = RT::Test->file_content('t/mailbox', 'unlink' => 1);
 my @mail = grep {/\S/} split /%% split me! %%/, $mails;
 is(@mail, 1, 'caught outgoing mail.');
 }
@@ -327,14 +327,3 @@
     return $tick;
 }
 
-sub file_content_unlink
-{
-    my $path = shift;
-    diag "reading content of '$path'" if $ENV{'TEST_VERBOSE'};
-    open my $fh, "<:raw", $path or die "couldn't open file '$path': $!";
-    local $/;
-    my $content = <$fh>;
-    close $fh;
-    unlink $path;
-    return $content;
-}

Modified: rt/branches/3.7-EXPERIMENTAL/t/mail/sendmail.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/mail/sendmail.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/mail/sendmail.t	Wed Sep  5 07:02:29 2007
@@ -38,15 +38,6 @@
 sub count_txns { return $_[0]->Transactions->Count }
 sub count_attachs { return first_txn($_[0])->Attachments->Count }
 
-sub file_content
-{
-    my $path = shift;
-    diag "reading content of '$path'" if $ENV{'TEST_VERBOSE'};
-    open my $fh, "<:raw", $path or die "couldn't open file '$path': $!";
-    local $/;
-    return scalar <$fh>;
-}
-
 # instrument SendEmail to pass us what it's about to send.
 # create a regular ticket
 
@@ -54,7 +45,7 @@
 
 
 # Let's test to make sure a multipart/report is processed correctly
-my $content =  file_content("$RT::BasePath/lib/t/data/multipart-report");
+my $content =  RT::Test->file_content("$RT::BasePath/lib/t/data/multipart-report");
 # be as much like the mail gateway as possible.
 use RT::Interface::Email;
 my %args =        (message => $content, queue => 1, action => 'correspond');

Modified: rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/web/crypt-gnupg.t	Wed Sep  5 07:02:29 2007
@@ -87,7 +87,7 @@
 
 $m->get($baseurl); # ensure that the mail has been processed
 
-my $mails = file_content_unlink('t/mailbox');
+my $mails = RT::Test->file_content( 't/mailbox', 'unlink' => 1 );
 my @mail = grep {/\S/} split /%% split me! %%/, $mails;
 ok(@mail, "got some mail");
 
@@ -162,7 +162,7 @@
 
 $m->get($baseurl); # ensure that the mail has been processed
 
-$mails = file_content_unlink('t/mailbox');
+$mails = RT::Test->file_content( 't/mailbox', 'unlink' => 1 );
 @mail = grep {/\S/} split /%% split me! %%/, $mails;
 ok(@mail, "got some mail");
 for my $mail (@mail) {
@@ -240,7 +240,7 @@
 
 $m->get($baseurl); # ensure that the mail has been processed
 
-$mails = file_content_unlink('t/mailbox');
+$mails = RT::Test->file_content( 't/mailbox', 'unlink' => 1 );
 @mail = grep {/\S/} split /%% split me! %%/, $mails;
 ok(@mail, "got some mail");
 for my $mail (@mail) {
@@ -312,7 +312,7 @@
 
 $m->get($baseurl); # ensure that the mail has been processed
 
-$mails = file_content_unlink('t/mailbox');
+$mails = RT::Test->file_content( 't/mailbox', 'unlink' => 1 );
 @mail = grep {/\S/} split /%% split me! %%/, $mails;
 ok(@mail, "got some mail");
 for my $mail (@mail) {
@@ -365,18 +365,6 @@
     like($attachments[0]->Content, qr/$RT::rtname/, "RT's mail includes this instance's name");
 }
 
-sub file_content_unlink
-{
-    my $path = shift;
-    diag "reading content of '$path'" if $ENV{'TEST_VERBOSE'};
-    open my $fh, "<:raw", $path or die "couldn't open file '$path': $!";
-    local $/;
-    my $content = <$fh>;
-    close $fh;
-    unlink $path;
-    return $content;
-}
-
 sub strip_headers
 {
     my $mail = shift;


More information about the Rt-commit mailing list