X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fweb%2Fticket_forward.t;h=439242d48976245fd4c5b45ee60518d00e5adbc6;hb=e131b1f71f08b69abb832c1687d1f29682d171f8;hp=adf4d6f6983eca4778bb6d6cfa068202b289cef7;hpb=d05d7346bb2387fd9d0354923d577275c5c7f019;p=freeside.git diff --git a/rt/t/web/ticket_forward.t b/rt/t/web/ticket_forward.t index adf4d6f69..439242d48 100644 --- a/rt/t/web/ticket_forward.t +++ b/rt/t/web/ticket_forward.t @@ -36,19 +36,21 @@ diag "Forward Ticket" if $ENV{TEST_VERBOSE}; $m->submit_form( form_name => 'ForwardMessage', fields => { - To => 'rt-test, rt-to@example.com', - Cc => 'rt-cc@example.com', + To => '"Foo" , rt-too@example.com', + Cc => 'rt-cc@example.com', + Bcc => 'root', }, button => 'ForwardAndReturn' ); - $m->content_contains( 'Sent email successfully', 'sent mail msg' ); $m->content_contains( - 'Forwarded Ticket to rt-test, rt-to@example.com, rt-cc@example.com', + 'Forwarded Ticket to Foo <rt-foo@example.com>, <rt-too@example.com>, <rt-cc@example.com>, root (Enoch Root)', '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!To: .*?rt-foo\@example.com!i, 'To field' ); + like( $mail, qr!To: .*?rt-too\@example.com!i, 'To field' ); like( $mail, qr!Cc: rt-cc\@example.com!i, 'Cc field' ); + like( $mail, qr!Bcc: root\@localhost!i, 'Bcc 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' ); @@ -60,22 +62,22 @@ diag "Forward Transaction" if $ENV{TEST_VERBOSE}; $m->submit_form( form_name => 'ForwardMessage', fields => { - To => 'rt-test, rt-to@example.com', + To => 'rt-to@example.com, rt-too@example.com', Cc => 'rt-cc@example.com', - Bcc => 'rt-bcc@example.com' + Bcc => 'root' }, button => 'ForwardAndReturn' ); - $m->content_contains( 'Sent email successfully', 'sent mail msg' ); $m->content_like( -qr/Forwarded Transaction #\d+ to rt-test, rt-to\@example.com, rt-cc\@example.com, rt-bcc\@example.com/, +qr/Forwarded .*?Transaction #\d+.*? to <rt-to\@example\.com>, <rt-too\@example\.com>, <rt-cc\@example\.com>, root (Enoch Root)/, '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!To: .*rt-to\@example.com!i, 'To field' ); + like( $mail, qr!To: .*rt-too\@example.com!i, 'To field' ); like( $mail, qr!Cc: rt-cc\@example.com!i, 'Cc field' ); - like( $mail, qr!Bcc: rt-bcc\@example.com!i, 'Bcc field' ); + like( $mail, qr!Bcc: root\@localhost!i, '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' ); @@ -93,9 +95,8 @@ diag "Forward Ticket without content" if $ENV{TEST_VERBOSE}; fields => { To => 'rt-test@example.com', }, button => 'ForwardAndReturn' ); - $m->content_contains( 'Sent email successfully', 'sent mail msg' ); my ($mail) = RT::Test->fetch_caught_mails; - like( $mail, qr/Subject: Fwd: \[example\.com #\d\] test forward without content/, 'Subject field' ); + like( $mail, qr/Subject: \[example\.com #\d\] Fwd: test forward without content/, 'Subject field' ); like( $mail, qr/To: rt-test\@example\.com/, 'To field' ); like( $mail, qr/This is a forward of ticket #\d/, 'content' ); } @@ -107,7 +108,7 @@ diag "Forward Transaction with attachments but empty content" if $ENV{TEST_VERBO $m->form_name('TicketCreate'); my $attach = $m->current_form->find_input('Attach'); - $attach->filename("awesome.patch"); + $attach->filename('awesome.pátch'); $attach->headers('Content-Type' => 'text/x-diff'); $m->set_fields( Subject => 'test forward, empty content but attachments', @@ -122,8 +123,8 @@ diag "Forward Transaction with attachments but empty content" if $ENV{TEST_VERBO Attach => RT::Test::get_relocatable_file('bpslogo.png', '..', 'data'), # an image! ); $m->submit; - $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' ); - $m->content_like( qr/awesome\.patch/, 'uploaded patch file' ); + $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' ); + $m->content_like( qr/awesome.p\%C3\%A1tch/, 'uploaded patch file' ); $m->content_like( qr/text\/x-diff/, 'uploaded patch file content type' ); $m->content_like( qr/bpslogo\.png/, 'uploaded image file' ); $m->content_like( qr/image\/png/, 'uploaded image file content type' ); @@ -137,13 +138,12 @@ diag "Forward Transaction with attachments but empty content" if $ENV{TEST_VERBO }, button => 'ForwardAndReturn' ); - $m->content_contains( 'Sent email successfully', 'sent mail msg' ); - $m->content_like( qr/Forwarded Transaction #\d+ to rt-test\@example\.com/, 'txn msg' ); + $m->content_like( qr/Forwarded .*?Transaction #\d+.*? to <rt-test\@example\.com>/, 'txn msg' ); my ($mail) = RT::Test->fetch_caught_mails; like( $mail, qr/Subject: test forward, empty content but attachments/, 'Subject field' ); like( $mail, qr/To: rt-test\@example.com/, 'To field' ); like( $mail, qr/This is a forward of transaction/, 'content' ); - like( $mail, qr/awesome\.patch/, 'att file name' ); + like( $mail, qr/filename\*\=\"UTF\-8\'\'awesome.p\%C3\%A1tch\"/, 'att file name' ); like( $mail, qr/this is an attachment/, 'att content' ); like( $mail, qr/text\/x-diff/, 'att content type' ); like( $mail, qr/bpslogo\.png/, 'att image file name' ); @@ -153,7 +153,7 @@ diag "Forward Transaction with attachments but empty content" if $ENV{TEST_VERBO diag "Forward Transaction with attachments but no 'content' part" if $ENV{TEST_VERBOSE}; { my $mime = MIME::Entity->build( - From => 'test@example.com', + From => '"Tést" ', Subject => 'attachments for everyone', Type => 'multipart/mixed', ); @@ -195,9 +195,8 @@ diag "Forward Transaction with attachments but no 'content' part" if $ENV{TEST_V }, button => 'ForwardAndReturn' ); - $m->content_contains( 'Sent email successfully', 'sent mail msg' ); - $m->content_like( qr/Forwarded Transaction #\d+ to rt-test\@example\.com/, 'txn msg' ); - + $m->content_like( qr/Forwarded .*?Transaction #\d+.*? to <rt-test\@example\.com>/, 'txn msg' ); + # Forward ticket $m->follow_link_ok( { text => 'Forward', n => 1 }, 'follow 1st Forward' ); $m->submit_form( @@ -207,15 +206,15 @@ diag "Forward Transaction with attachments but no 'content' part" if $ENV{TEST_V }, button => 'ForwardAndReturn' ); - $m->content_contains( 'Sent email successfully', 'sent mail msg' ); - $m->content_like( qr/Forwarded Ticket to rt-test\@example\.com/, 'txn msg' ); + $m->content_like( qr/Forwarded Ticket to <rt-test\@example\.com>/, 'txn msg' ); my ($forward_txn, $forward_ticket) = RT::Test->fetch_caught_mails; - my $tag = qr/Fwd: \[example\.com #\d+\]/; + my $tag = qr/\[example\.com #\d+\] Fwd:/; like( $forward_txn, qr/Subject: $tag attachments for everyone/, 'Subject field is from txn' ); like( $forward_txn, qr/This is a forward of transaction/, 'forward description' ); like( $forward_ticket, qr/Subject: $tag test forward, attachments but no "content"/, 'Subject field is from ticket' ); like( $forward_ticket, qr/This is a forward of ticket/, 'forward description' ); + like( $forward_ticket, qr/From: \=\?UTF-8\?.* \/i ); for my $mail ($forward_txn, $forward_ticket) { like( $mail, qr/To: rt-test\@example.com/, 'To field' ); @@ -259,7 +258,26 @@ diag "Forward Ticket Template with a Subject: line" if $ENV{TEST_VERBOSE}; ); my ($mail) = RT::Test->fetch_caught_mails; - like($mail, qr/Subject: OVERRIDING SUBJECT/); + like($mail, qr/Subject: \[example.com #\d+\] OVERRIDING SUBJECT/); +} + +diag "Forward Transaction with non-ascii subject" if $ENV{TEST_VERBOSE}; +{ + $m->follow_link_ok( { text => 'Forward', n => 2 }, 'follow 2nd Forward' ); + my $subject = Encode::decode("UTF-8", 'test non-ascii äöü'); + $m->submit_form( + form_name => 'ForwardMessage', + fields => { + Subject => $subject, + To => 'rt-to@example.com', + }, + button => 'ForwardAndReturn' + ); + my ($mail) = RT::Test->fetch_caught_mails; + if ( $mail =~ /Subject: (.+)/ ) { + like( Encode::decode("UTF-8", RT::I18N::DecodeMIMEWordsToUTF8( $1, 'Subject' )), qr/$subject/, 'non-ascii subject' ); + } + $m->content_contains( $subject, 'non-ascii subject got displayed correctly' ); } undef $m;