X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fweb%2Fattachment_encoding.t;h=bfbf245908e5fc7b77603cd605b884a881c70763;hb=6587f6ba7d047ddc1686c080090afe7d53365bd4;hp=9ba567746629332eaa0c7e1735b4cca611594f80;hpb=47153aae5c2fc00316654e7277fccd45f72ff611;p=freeside.git diff --git a/rt/t/web/attachment_encoding.t b/rt/t/web/attachment_encoding.t index 9ba567746..bfbf24590 100644 --- a/rt/t/web/attachment_encoding.t +++ b/rt/t/web/attachment_encoding.t @@ -3,13 +3,11 @@ use strict; use warnings; -use RT::Test tests => 28; +use RT::Test tests => 32; use Encode; my ( $baseurl, $m ) = RT::Test->started_ok; ok $m->login, 'logged in as root'; -$RT::Test::SKIP_REQUEST_WORK_AROUND = 1; - use utf8; use File::Spec; @@ -19,7 +17,7 @@ diag 'test without attachments' if $ENV{TEST_VERBOSE}; { $m->get_ok( $baseurl . '/Ticket/Create.html?Queue=1' ); - $m->form_number(3); + $m->form_name('TicketModify'); $m->submit_form( form_number => 3, fields => { Subject => '标题', Content => '测试' }, @@ -47,7 +45,7 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE}; { my $file = - File::Spec->catfile( File::Spec->tmpdir, 'rt_attachemnt_abcde.txt' ); + File::Spec->catfile( RT::Test->temp_directory, encode_utf8 '附件.txt' ); open( my $fh, '>', $file ) or die $!; binmode $fh, ':utf8'; print $fh '附件'; @@ -55,12 +53,14 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE}; $m->get_ok( $baseurl . '/Ticket/Create.html?Queue=1' ); - $m->form_number(3); + $m->form_name('TicketModify'); $m->submit_form( form_number => 3, fields => { Subject => '标题', Content => '测试', Attach => $file }, ); $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' ); + $m->content_contains( '附件.txt', 'attached filename' ); + $m->content_lacks( encode_utf8 '附件.txt', 'no double encoded attached filename' ); $m->follow_link_ok( { text => 'with headers' }, '-> /Ticket/Attachment/WithHeaders/...' ); @@ -82,7 +82,7 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE}; $m->back; $m->back; - $m->follow_link_ok( { text_regex => qr/by Enoch Root/ }, + $m->follow_link_ok( { text => 'Download 附件.txt' }, '-> /Ticket/Attachment/...' ); $m->content_contains( '附件', 'has content 附件' ); @@ -100,4 +100,3 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE}; unlink $file; } -