From 241bb7ebacb47940a99d6b70a89b68ba49e929fd Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 30 Nov 2007 16:26:22 +0000 Subject: [PATCH] Storage/Image.t tests failing due to being run as root user. Add SKIP to enable test for non-users only --- t/Storage/Image.t | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/t/Storage/Image.t b/t/Storage/Image.t index 60ea83054..d0b5543dd 100644 --- a/t/Storage/Image.t +++ b/t/Storage/Image.t @@ -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');