Skip to content

Commit

Permalink
Item10516: Fix the unit test to use Foswiki::Sandbox::sanitizeAttachm…
Browse files Browse the repository at this point in the history
…entName() to guess the name the file will be renamed to.

git-svn-id: http://svn.foswiki.org/branches/Release01x01@11168 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OlivierRaginel authored and OlivierRaginel committed Mar 21, 2011
1 parent 1870cc1 commit ea21e66
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions UnitTestContrib/test/unit/UploadScriptTests.pm
Expand Up @@ -209,9 +209,10 @@ sub test_illegal_upload {
my $this = shift;
local $/;
my $data = 'asdfasdf';
my ($goodfilename, $badfilename) = Foswiki::Sandbox::sanitizeAttachmentName( 'F$%^&&**()_ .php' );
try {
$this->do_upload(
'F$%^&&**()_ .php',
$badfilename,
$data,
hidefile => 0,
filecomment => 'Elucidate the goose',
Expand All @@ -222,7 +223,7 @@ sub test_illegal_upload {
}
catch Foswiki::OopsException with {
my $e = shift;
$this->assert_str_equals( "F__.php.txt", $e->{params}[1] );
$this->assert_str_equals( $goodfilename, $e->{params}[1] );
$this->assert_str_equals( "upload_name_changed", $e->{def} );
};
}
Expand All @@ -231,9 +232,10 @@ sub test_illegal_propschange {
my $this = shift;
local $/;
my $data = 'asdfasdf';
my ($goodfilename, $badfilename) = Foswiki::Sandbox::sanitizeAttachmentName( 'F$%^&&**()_ .php' );
try {
$this->do_upload(
'F$%^&&**()_ .php',
$badfilename,
$data,
hidefile => 0,
filecomment => 'Elucidate the goose',
Expand All @@ -244,12 +246,12 @@ sub test_illegal_propschange {
}
catch Foswiki::OopsException with {
my $e = shift;
$this->assert_str_equals( "F__.php.txt", $e->{params}[1] );
$this->assert_str_equals( $goodfilename, $e->{params}[1] );
$this->assert_str_equals( "upload_name_changed", $e->{def} );
};
try {
$this->do_upload(
'F$%^&&**()_ .php',
$badfilename,
$data,
hidefile => 1,
filecomment => 'Educate the goose',
Expand All @@ -260,7 +262,7 @@ sub test_illegal_propschange {
}
catch Foswiki::OopsException with {
my $e = shift;
$this->assert_str_equals( "F__.php.txt", $e->{params}[1] );
$this->assert_str_equals( $goodfilename, $e->{params}[1] );
$this->assert_str_equals( "upload_name_changed", $e->{def} );
};
}
Expand Down

0 comments on commit ea21e66

Please sign in to comment.