Storage/Image.t tests failing due to being run as root user. Add SKIP to enable test for non-users only

This commit is contained in:
Colin Kuskie 2007-11-30 16:26:22 +00:00
parent 377386f239
commit 241bb7ebac

View file

@ -125,10 +125,18 @@ is($WebGUI::Test::logger_error, q/Can't generate a thumbnail when you haven't sp
is($thumbStore->generateThumbnail('file.txt'), 0, 'generateThumbnail returns 0 if you try to thumbnail a non-image file');
is($WebGUI::Test::logger_warns, q/Can't generate a thumbnail for something that's not an image./, 'generateThumbnail logs a warning message for thumbnailing a non-image file.');
chmod 0, $thumbStore->getPath('square.png');
ok(! -r $thumbStore->getPath('square.png'), 'Made square.png not readable');
is($thumbStore->generateThumbnail('square.png'), 0, 'generateThumbnail returns 0 if there are errors reading the file');
like($WebGUI::Test::logger_error, qr/^Couldn't read image for thumbnail creation: (.+)$/, 'generateThumbnail when it cannot read the file for thumbnailing');
chmod 0644, $thumbStore->getPath('square.png');
SKIP: {
skip "Root will cause this test to fail since it does not obey file permissions", 1
if $< == 0;
ok(! -r $thumbStore->getPath('square.png'), 'Made square.png not readable');
is($thumbStore->generateThumbnail('square.png'), 0,
'generateThumbnail returns 0 if there are errors reading the file');
like($WebGUI::Test::logger_error, qr/^Couldn't read image for thumbnail creation: (.+)$/,
'generateThumbnail when it cannot read the file for thumbnailing');
chmod oct(644), $thumbStore->getPath('square.png');
}
ok(-r $thumbStore->getPath('square.png'), 'Made square.png readable again');
ok($thumbStore->generateThumbnail('square.png', 50), 'generateThumbnail returns true when there are no problems');
ok(-e $thumbStore->getPath('thumb-square.png'), 'thumbnail exists in right place with correct name');