[Rt-commit] r8932 - rt/branches/3.7-EXPERIMENTAL/t/mail

ruz at bestpractical.com ruz at bestpractical.com
Wed Sep 5 07:12:36 EDT 2007


Author: ruz
Date: Wed Sep  5 07:12:36 2007
New Revision: 8932

Modified:
   rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t
   rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-reverification.t

Log:
* more on tests simplification

Modified: rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t	Wed Sep  5 07:12:36 2007
@@ -58,22 +58,11 @@
     }
 }
 
-sub get_contents {
-    my $eid = shift;
-
-    my ($file) = glob("t/data/mails/gnupg-basic-set/$eid-*");
-    defined $file
-        or do { diag "Unable to find t/data/mails/gnupg-basic-set/$eid-*"; return };
-
-    return RT::Test->file_content( $file );
-}
-
 sub email_ok {
     my ($eid, $usage, $format, $attachment) = @_;
     diag "email_ok $eid: $usage, $format, $attachment" if $ENV{'TEST_VERBOSE'};
 
-    my $mail = get_contents($eid)
-        or return 0;
+    my $mail = RT::Test->file_content($eid);
 
     my ($status, $id) = RT::Test->send_via_mailgate($mail);
     is ($status >> 8, 0, "$eid: The mail gateway exited normally");

Modified: rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-reverification.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-reverification.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-reverification.t	Wed Sep  5 07:12:36 2007
@@ -49,7 +49,7 @@
     my ($eid) = ($file =~ m{(\d+)[^/\\]+$});
     ok $eid, 'figured id of a file';
 
-    my $email_content = get_contents( $file );
+    my $email_content = RT::Test->file_content( $file );
     ok $email_content, "$eid: got content of email";
 
     my ($status, $id) = RT::Test->send_via_mailgate( $email_content );
@@ -84,12 +84,3 @@
     );
 }
 
-sub get_contents {
-    my $file = shift;
-
-    open my $mailhandle, '<', $file
-        or do { diag "Unable to read $file: $!"; return };
-
-    return do { local $/; <$mailhandle> };
-}
-


More information about the Rt-commit mailing list