[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-451-g4271638

? sunnavy sunnavy at bestpractical.com
Thu Nov 11 02:56:08 EST 2010


The branch, 3.9-trunk has been updated
       via  427163819d48f552798b9b69f25ed22fdf001ebe (commit)
      from  b6f7262398ebed28405a8b115a4af9642699db5b (commit)

Summary of changes:
 t/web/ticket_forward.t |   56 ++++++++++++++++++++++++++++++------------------
 1 files changed, 35 insertions(+), 21 deletions(-)

- Log -----------------------------------------------------------------
commit 427163819d48f552798b9b69f25ed22fdf001ebe
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Nov 11 15:54:08 2010 +0800

    attachment test for forward ticket/txn

diff --git a/t/web/ticket_forward.t b/t/web/ticket_forward.t
index eaacf1b..83e1908 100644
--- a/t/web/ticket_forward.t
+++ b/t/web/ticket_forward.t
@@ -3,7 +3,15 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 19;
+use RT::Test tests => 23;
+use File::Temp 'tempfile';
+use File::Spec;
+my ( $att_fh, $att_file ) =
+  tempfile( 'rttestXXXXXX', SUFFIX => '.txt', UNLINK => 1, TMPDIR => 1 );
+print $att_fh "this is an attachment";
+close $att_fh;
+my $att_name = ( File::Spec->splitpath($att_file) )[-1];
+
 my ( $baseurl, $m ) = RT::Test->started_ok;
 ok $m->login, 'logged in as root';
 
@@ -11,10 +19,11 @@ RT::Test->set_mail_catcher;
 $m->get_ok( $baseurl . '/Ticket/Create.html?Queue=1' );
 
 $m->submit_form(
-    form_name   => 'TicketCreate',
-    fields      => {
+    form_name => 'TicketCreate',
+    fields    => {
         Subject => 'test forward',
         Content => 'this is content',
+        Attach  => $att_file,
     },
 );
 $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
@@ -22,35 +31,38 @@ RT::Test->clean_caught_mails;
 
 diag "Foward Ticket" if $ENV{TEST_VERBOSE};
 {
-    $m->follow_link_ok( { id => 'page-actions-forward'},
-        'follow 1st Forward to forward ticket' );
+    $m->follow_link_ok(
+        { id => 'page-actions-forward' },
+        'follow 1st Forward to forward ticket'
+    );
 
     $m->submit_form(
-        form_name   => 'ForwardMessage',
-        fields      => {
-            To  => 'rt-test, rt-to at example.com',
-            Cc  => 'rt-cc at example.com',
+        form_name => 'ForwardMessage',
+        fields    => {
+            To => 'rt-test, rt-to at example.com',
+            Cc => 'rt-cc at example.com',
         },
         button => 'ForwardAndReturn'
     );
     $m->content_contains( 'Send email successfully', 'sent mail msg' );
     $m->content_contains(
-'Forwarded Ticket to rt-test, rt-to at example.com, rt-cc at example.com',
-        'txn msg'
-    );
+        'Forwarded Ticket to rt-test, rt-to at example.com, rt-cc at example.com',
+        'txn msg' );
     my ($mail) = RT::Test->fetch_caught_mails;
-    like( $mail, qr!Subject: test forward!, 'Subject field' );
+    like( $mail, qr!Subject: test forward!,           'Subject field' );
     like( $mail, qr!To: rt-test, rt-to\@example.com!, 'To field' );
-    like( $mail, qr!Cc: rt-cc\@example.com!, 'Cc field' );
-    like( $mail, qr!This is a forward of ticket!, 'content' );
+    like( $mail, qr!Cc: rt-cc\@example.com!,          'Cc field' );
+    like( $mail, qr!This is a forward of ticket!,     'content' );
+    like( $mail, qr!this is an attachment!,           'att content' );
+    like( $mail, qr!$att_name!,                       'att file name' );
 }
 
 diag "Foward Transaction" if $ENV{TEST_VERBOSE};
 {
     $m->follow_link_ok( { text => 'Forward', n => 2 }, 'follow 2nd Forward' );
     $m->submit_form(
-        form_name   => 'ForwardMessage',
-        fields      => {
+        form_name => 'ForwardMessage',
+        fields    => {
             To  => 'rt-test, rt-to at example.com',
             Cc  => 'rt-cc at example.com',
             Bcc => 'rt-bcc at example.com'
@@ -63,10 +75,12 @@ qr/Forwarded Transaction #\d+ to rt-test, rt-to\@example.com, rt-cc\@example.com
         'txn msg'
     );
     my ($mail) = RT::Test->fetch_caught_mails;
-    like( $mail, qr!Subject: test forward!, 'Subject field' );
-    like( $mail, qr!To: rt-test, rt-to\@example.com!, 'To field' );
-    like( $mail, qr!Cc: rt-cc\@example.com!, 'Cc field' );
-    like( $mail, qr!Bcc: rt-bcc\@example.com!, 'Bcc field' );
+    like( $mail, qr!Subject: test forward!,            'Subject field' );
+    like( $mail, qr!To: rt-test, rt-to\@example.com!,  'To field' );
+    like( $mail, qr!Cc: rt-cc\@example.com!,           'Cc field' );
+    like( $mail, qr!Bcc: rt-bcc\@example.com!,         'Bcc field' );
     like( $mail, qr!This is a forward of transaction!, 'content' );
+    like( $mail, qr!$att_name!,                        'att file name' );
+    like( $mail, qr!this is an attachment!,            'att content' );
 }
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list