From af271b9f26fc327c852bb2628578ce67916e6dcb Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Wed, 26 Dec 2007 00:39:08 +0000 Subject: [PATCH] fixed a bunch of GalleryAlbum/Photo tests --- lib/WebGUI/Asset/File/Image/Photo.pm | 28 ++- lib/WebGUI/Asset/Wobject/GalleryAlbum.pm | 5 +- lib/WebGUI/Friends.pm | 8 +- lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm | 4 + lib/WebGUI/i18n/English/Asset_Photo.pm | 5 + t/Asset/File/Image/Photo/comment.t | 6 +- t/Asset/File/Image/Photo/makeResolutions.t | 219 ++++++++---------- t/Asset/File/Image/Photo/permissions.t | 162 +++++-------- t/Asset/File/Image/Photo/setFile.t | 7 +- t/Asset/Wobject/Gallery/00base.t | 6 +- t/Asset/Wobject/GalleryAlbum/delete.t | 3 +- t/Asset/Wobject/GalleryAlbum/view.t | 18 +- t/Storage/Image.t | 2 +- 13 files changed, 225 insertions(+), 248 deletions(-) diff --git a/lib/WebGUI/Asset/File/Image/Photo.pm b/lib/WebGUI/Asset/File/Image/Photo.pm index 9216359f3..22670d1d3 100644 --- a/lib/WebGUI/Asset/File/Image/Photo.pm +++ b/lib/WebGUI/Asset/File/Image/Photo.pm @@ -17,7 +17,7 @@ package WebGUI::Asset::File::Image::Photo; use strict; use base 'WebGUI::Asset::File::Image'; -use Carp qw( croak ); +use Carp qw( carp croak ); use Image::ExifTool qw( :Public ); use JSON; use Tie::IxHash; @@ -38,6 +38,18 @@ WebGUI::Asset::File::Image::Photo use WebGUI::Asset::File::Image::Photo +=head1 DIAGNOSTICS + +=head2 Geometry '...' is invalid. Skipping. + +makeResolutions will not pass invalid geometries to WebGUI::Storage::Image::resize(). +Valid geometries are one of the following forms: + + ^\d+$ + ^\d*x\d*$ + +These geometries are exactly as understood by ImageMagick. + =head1 METHODS These methods are available from this class: @@ -232,9 +244,10 @@ sub canView { my $album = $self->getParent; return 0 unless $album->canView($userId); - if ($self->isFriendsOnly) { + if ($self->isFriendsOnly && $userId != $self->get("ownerUserId") ) { + my $owner = WebGUI::User->new( $self->session, $self->get("ownerUserId") ); return 0 - unless WebGUI::Friends->new($self->session, $self->get("ownerUserId"))->isFriend($userId); + unless WebGUI::Friends->new($self->session, $owner)->isFriend($userId); } # Passed all checks @@ -499,6 +512,10 @@ sub makeResolutions { for my $res ( @$resolutions ) { # carp if resolution is bad + if ( $res !~ /^\d+$/ && $res !~ /^\d*x\d*/ ) { + carp "Geometry '$res' is invalid. Skipping."; + next; + } my $newFilename = $res . ".jpg"; $storage->copyFile( $self->get("filename"), $newFilename ); $storage->resize( $newFilename, $res ); @@ -712,6 +729,7 @@ sub www_addCommentSave { return $session->privilege->insufficient unless $self->canComment; + my $i18n = __PACKAGE__->i18n( $session ); my $form = $self->session->form; my $properties = { @@ -724,7 +742,9 @@ sub www_addCommentSave { $self->setComment( "new", $properties ); - return $self->www_view; + return $self->processStyle( + sprintf $i18n->get('comment message'), $self->getUrl, + ); } #---------------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm index a404f5b7c..15b72da20 100644 --- a/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm +++ b/lib/WebGUI/Asset/Wobject/GalleryAlbum.pm @@ -717,10 +717,13 @@ sub www_deleteConfirm { return $self->session->privilege->insufficient unless $self->canEdit; my $gallery = $self->getParent; + my $i18n = __PACKAGE__->i18n( $self->session ); $self->purge; - return $gallery->www_view; + return $self->processStyle( + sprintf $i18n->get('delete message'), $self->getParent->getUrl, + ); } #---------------------------------------------------------------------------- diff --git a/lib/WebGUI/Friends.pm b/lib/WebGUI/Friends.pm index f86de822e..1d76b5879 100644 --- a/lib/WebGUI/Friends.pm +++ b/lib/WebGUI/Friends.pm @@ -185,10 +185,10 @@ attached to the session. =cut sub new { - my $class = shift; - my $session = shift; - my $user = shift || $session->user; - my $self = register($class); + my $class = shift; + my $session = shift; + my $user = shift || $session->user; + my $self = register($class); $session{id $self} = $session; $user{id $self} = $user; return $self; diff --git a/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm b/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm index 833558c6a..c6419d22b 100644 --- a/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm +++ b/lib/WebGUI/i18n/English/Asset_GalleryAlbum.pm @@ -23,6 +23,10 @@ our $I18N = { message => 'Album settings saved. Return to Album', lastUpdated => 0, }, + 'delete message' => { + message => 'Album has been deleted. Return to Gallery', + lastUpdated => 0, + }, 'help common title' => { message => '', diff --git a/lib/WebGUI/i18n/English/Asset_Photo.pm b/lib/WebGUI/i18n/English/Asset_Photo.pm index bca896348..e5a7bf11b 100644 --- a/lib/WebGUI/i18n/English/Asset_Photo.pm +++ b/lib/WebGUI/i18n/English/Asset_Photo.pm @@ -16,6 +16,11 @@ our $I18N = { lastUpdated => 0, }, + 'comment message' => { + message => q{Your comment has been added. Back to Photo.}, + lastUpdated => 0, + }, + 'help commentForm title' => { message => 'Photo -- Comment Form', lastUpdated => 0, diff --git a/t/Asset/File/Image/Photo/comment.t b/t/Asset/File/Image/Photo/comment.t index 93d584292..cdb576e96 100644 --- a/t/Asset/File/Image/Photo/comment.t +++ b/t/Asset/File/Image/Photo/comment.t @@ -246,12 +246,12 @@ like( #---------------------------------------------------------------------------- # Test www_addCommentSave functionality $html = WebGUI::Test->getPage($photo, "www_addCommentSave", { - userId => 1, + userId => 3, formParams => { bodyText => "YES!", }, }); - +my $successMessage = sprintf($i18n->get("comment message"), $photo->getUrl); like( - $html, $i18n->get("www_addCommentSave success"), + $html, qr/$successMessage/, "www_addCommentSave -- page shows success message", ); diff --git a/t/Asset/File/Image/Photo/makeResolutions.t b/t/Asset/File/Image/Photo/makeResolutions.t index 1721479f9..15dd92986 100644 --- a/t/Asset/File/Image/Photo/makeResolutions.t +++ b/t/Asset/File/Image/Photo/makeResolutions.t @@ -19,6 +19,7 @@ use Scalar::Util qw( blessed ); use WebGUI::Test; use WebGUI::Session; use Test::More; +use Test::Deep; my $graphicsClass; BEGIN { if (eval { require Image::Magick; 1 }) { @@ -32,9 +33,6 @@ use WebGUI::Asset::File::Image::Photo; #---------------------------------------------------------------------------- # Init - -plan tests => 15; - my $session = WebGUI::Test->session; my $node = WebGUI::Asset->getImportNode($session); my @versionTags = (); @@ -42,119 +40,6 @@ push @versionTags, WebGUI::VersionTag->getWorking($session); $versionTags[-1]->set({name=>"Photo Test"}); my ($gallery, $album, $photo); - -#---------------------------------------------------------------------------- -# Photo not added under a Photo Gallery asset does NOT generate any -# default resolutions -$photo - = $node->addChild({ - className => "WebGUI::Asset::File::Image::Photo", - }, - undef, - undef, - { - skipAutoCommitWorkflows => 1, - }); - -$versionTags[-1]->commit; - -$photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') ); - -ok( - eval{ $photo->makeResolutions(); 1 }, - "makeResolutions succeeds when photo not under photo gallery and no resolutions to make", -); - -is_deeply( - $photo->getStorageLocation->getFiles, ['page_title.jpg'], - "makeResolutions does not make any extra resolutions when photo not under photo gallery", -); - -#---------------------------------------------------------------------------- -# makeResolutions allows API to specify resolutions to make as array reference -# argument -push @versionTags, WebGUI::VersionTag->getWorking($session); -$photo - = $node->addChild({ - className => "WebGUI::Asset::File::Image::Photo", - }, - undef, - undef, - { - skipAutoCommitWorkflows => 1, - }); -$versionTags[-1]->commit; - -$photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') ); - -ok( - !eval{ $photo->makeResolutions('100x100','200x200'); 1 }, - "makeResolutions fails when first argument is not array reference", -); - -ok( - eval{ $photo->makeResolutions(['100x100','200x200']); 1 }, - "makeResolutions succeeds when first argument is array reference of resolutions to make", -); - -is_deeply( - [ sort({ $a cmp $b} @{ $photo->getStorageLocation->getFiles }) ], - ['100x100.jpg', '200x200.jpg', 'page_title.jpg'], - "makeResolutions makes all the required resolutions with the appropriate names.", -); - -TODO: { - local $TODO = 'Test to ensure the files are created with correct resolution and density'; -} - -#---------------------------------------------------------------------------- -# makeResolutions throws a warning on an invalid resolution but keeps going -push @versionTags, WebGUI::VersionTag->getWorking($session); -$photo - = $node->addChild({ - className => "WebGUI::Asset::File::Image::Photo", - }, - undef, - undef, - { - skipAutoCommitWorkflows => 1, - }); -$versionTags[-1]->commit; -$photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') ); -{ # localize our signal handler - my @warnings; - local $SIG{__WARN__} = sub { push @warnings, $_[0]; }; - - ok( - eval{ $photo->makeResolutions(['abc','200','3d400']); 1 }, - "makeResolutions succeeds when invalid resolutions are given", - ); - - is( - scalar @warnings, 2, - "makeResolutions throws a warning for each invalid resolution given", - ); - - like( - $warnings[0], qr/abc/, - "makeResolutions throws a warning for the correct invalid resolution 'abc'", - ); - - like( - $warnings[1], qr/3d400/, - "makeResolutions throws a warning for the correct invalid resolution '3d400'", - ); - - is_deeply( - [ sort({ $a cmp $b} @{ $photo->getStorageLocation->getFiles }) ], - ['200.jpg', 'page_title.jpg'], - "makeResolutions still makes valid resolutions when invalid resolutions given", - ); -} - -#---------------------------------------------------------------------------- -# makeResolutions gets default resolutions from a parent Photo Gallery asset -push @versionTags, WebGUI::VersionTag->getWorking($session); $gallery = $node->addChild({ className => "WebGUI::Asset::Wobject::Gallery", @@ -169,6 +54,13 @@ $album { skipAutoCommitWorkflows => 1, }); + +#---------------------------------------------------------------------------- +# Tests +plan tests => 13; + +#---------------------------------------------------------------------------- +# makeResolutions gets default resolutions from a parent Photo Gallery asset $photo = $album->addChild({ className => "WebGUI::Asset::File::Image::Photo", @@ -180,15 +72,17 @@ $photo }); $versionTags[-1]->commit; $photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') ); +$photo->update({ filename => 'page_title.jpg' }); ok( eval{ $photo->makeResolutions; 1 }, "makeResolutions succeeds when photo under photo gallery and no resolution given", ); +diag( $@ ); -is_deeply( - [ sort({ $a cmp $b} @{ $photo->getStorageLocation->getFiles }) ], - [ '1024x768.jpg', '1600x1200.jpg', '640x480.jpg', '800x600.jpg', 'page_title.jpg' ], +cmp_deeply( + $photo->getStorageLocation->getFiles, + bag( '1024x768.jpg', '1600x1200.jpg', '640x480.jpg', '800x600.jpg', 'page_title.jpg' ), "makeResolutions makes all the required resolutions with the appropriate names.", ); @@ -225,6 +119,46 @@ $photo }); $versionTags[-1]->commit; $photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') ); +$photo->update({ filename => 'page_title.jpg' }); + +ok( + !eval{ $photo->makeResolutions('100x100','200x200'); 1 }, + "makeResolutions fails when first argument is not array reference", +); + +ok( + eval{ $photo->makeResolutions(['100x100','200x200']); 1 }, + "makeResolutions succeeds when first argument is array reference of resolutions to make", +); +diag( $@ ); + +is_deeply( + [ sort({ $a cmp $b} @{ $photo->getStorageLocation->getFiles }) ], + ['100x100.jpg', '200x200.jpg', 'page_title.jpg'], + "makeResolutions makes all the required resolutions with the appropriate names.", +); + +TODO: { + local $TODO = 'Test to ensure the files are created with correct resolution and density'; +} + +#---------------------------------------------------------------------------- +# makeResolutions allows API to specify resolutions to make as array reference +# argument +push @versionTags, WebGUI::VersionTag->getWorking($session); +$photo + = $node->addChild({ + className => "WebGUI::Asset::File::Image::Photo", + }, + undef, + undef, + { + skipAutoCommitWorkflows => 1, + }); +$versionTags[-1]->commit; + +$photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') ); +$photo->update({ filename => 'page_title.jpg' }); ok( !eval{ $photo->makeResolutions('100x100','200x200'); 1 }, @@ -246,6 +180,53 @@ TODO: { local $TODO = 'Test to ensure the files are created with correct resolution and density'; } +#---------------------------------------------------------------------------- +# makeResolutions throws a warning on an invalid resolution but keeps going +push @versionTags, WebGUI::VersionTag->getWorking($session); +$photo + = $node->addChild({ + className => "WebGUI::Asset::File::Image::Photo", + }, + undef, + undef, + { + skipAutoCommitWorkflows => 1, + }); +$versionTags[-1]->commit; +$photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') ); +$photo->update({ filename => 'page_title.jpg' }); +{ # localize our signal handler + my @warnings; + local $SIG{__WARN__} = sub { push @warnings, $_[0]; }; + + ok( + eval{ $photo->makeResolutions(['abc','200','3d400']); 1 }, + "makeResolutions succeeds when invalid resolutions are given", + ); + diag( $@ ); + + is( + scalar @warnings, 2, + "makeResolutions throws a warning for each invalid resolution given", + ); + + like( + $warnings[0], qr/abc/, + "makeResolutions throws a warning for the correct invalid resolution 'abc'", + ); + + like( + $warnings[1], qr/3d400/, + "makeResolutions throws a warning for the correct invalid resolution '3d400'", + ); + + is_deeply( + [ sort({ $a cmp $b} @{ $photo->getStorageLocation->getFiles }) ], + ['200.jpg', 'page_title.jpg'], + "makeResolutions still makes valid resolutions when invalid resolutions given", + ); +} + #---------------------------------------------------------------------------- # Cleanup END { diff --git a/t/Asset/File/Image/Photo/permissions.t b/t/Asset/File/Image/Photo/permissions.t index 8b08a0a73..88160f145 100644 --- a/t/Asset/File/Image/Photo/permissions.t +++ b/t/Asset/File/Image/Photo/permissions.t @@ -19,33 +19,40 @@ use WebGUI::Test; use WebGUI::Session; use WebGUI::Friends; use Test::More; +use WebGUI::Test::Maker::Permission; #---------------------------------------------------------------------------- # Init my $session = WebGUI::Test->session; my $node = WebGUI::Asset->getImportNode($session); +my $maker = WebGUI::Test::Maker::Permission->new; $session->user({ userId => 3 }); my @versionTags = (); push @versionTags, WebGUI::VersionTag->getWorking($session); $versionTags[-1]->set({name=>"Photo Test, add Gallery, Album and 1 Photo"}); +# Add a new user to the test user's friends list my $friend = WebGUI::User->new($session, "new"); WebGUI::Friends->new($session)->add( [ $friend->userId ] ); +# Add a new registered user +my $notFriend = WebGUI::User->new( $session, "new" ); + my $gallery = $node->addChild({ className => "WebGUI::Asset::Wobject::Gallery", - groupIdView => "7", - groupIdEdit => "3", + groupIdView => "2", # Registered Users + groupIdEdit => "3", # Admins + groupIdComment => "2", # Registered Users ownerUserId => $session->user->userId, }); my $album = $gallery->addChild({ className => "WebGUI::Asset::Wobject::GalleryAlbum", - groupIdView => "", - groupIdEdit => "", + groupIdView => "2", # Registered Users + groupIdEdit => "3", # Admins ownerUserId => $session->user->userId, }, undef, @@ -54,125 +61,78 @@ my $album skipAutoCommitWorkflows => 1, }); -#---------------------------------------------------------------------------- -# Tests -plan tests => 28; - -#---------------------------------------------------------------------------- -# Everyone can view, Admins can edit, Owned by current user - my $photo = $album->addChild({ className => "WebGUI::Asset::File::Image::Photo", - groupIdView => "7", - groupIdEdit => "3", - ownerUserId => $session->user->userId, + friendsOnly => 0, }, undef, undef, { skipAutoCommitWorkflows => 1, }); - $versionTags[-1]->commit; -ok( $photo->canView(1), "Visitor can view" ); -ok( !$photo->canEdit(1), "Visitor cannot edit" ); -ok( $photo->canView(2), "Registered users can view" ); -ok( !$photo->canEdit(2), "Registered users cannot edit" ); -ok( $photo->canView, "Current user can view" ); -ok( $photo->canEdit, "Current user can edit" ); - #---------------------------------------------------------------------------- -# Admins can view, Admins can edit, Owned by Admin, current user is Visitor -my $oldUser = $session->user; -$session->user( { user => WebGUI::User->new($session, "1") } ); -push @versionTags, WebGUI::VersionTag->getWorking($session); -$versionTags[-1]->set({name=>"Adding new photo"}); -$photo - = $album->addChild({ - className => "WebGUI::Asset::File::Image::Photo", - groupIdView => "3", - groupIdEdit => "3", - ownerUserId => "3", - }, - undef, - undef, - { - skipAutoCommitWorkflows => 1, - }); -$versionTags[-1]->commit; - -ok( !$photo->canView, "Visitors cannot view" ); -ok( !$photo->canEdit, "Visitors cannot edit" ); -ok( !$photo->canView(2), "Registered Users cannot view" ); -ok( !$photo->canEdit(2), "Registered Users cannot edit" ); -ok( $photo->canView(3), "Admins can view" ); -ok( $photo->canEdit(3), "Admins can edit" ); -$session->user( { user => $oldUser } ); +# Tests +plan tests => 40; #---------------------------------------------------------------------------- -# Photo without specific view/edit inherits from gallery properties -push @versionTags, WebGUI::VersionTag->getWorking($session); -$versionTags[-1]->set({name=>"Adding new photo #2"}); -$photo - = $album->addChild({ - className => "WebGUI::Asset::File::Image::Photo", - groupIdView => "", - groupIdEdit => "", - ownerUserId => $session->user->userId, - }, - undef, - undef, - { - skipAutoCommitWorkflows => 1, - }); -$versionTags[-1]->commit; - -ok( $photo->canView(1), "Visitors can view" ); -ok( !$photo->canEdit(1), "Visitors cannot edit" ); -ok( $photo->canView(2), "Registered Users can view" ); -ok( !$photo->canEdit(2), "Registered Users cannot edit" ); -ok( $photo->canView, "Owner can view" ); -ok( $photo->canEdit, "Owner can edit" ); -ok( $photo->canView(3), "Admin can view" ); -ok( $photo->canEdit(3), "Admin can edit" ); +# Photo inherits view from parent Album +$maker->prepare({ + object => $photo, + method => 'canView', + pass => [ '3', $friend, $notFriend ], + fail => [ '1', ], +})->run; #---------------------------------------------------------------------------- -# Friends are allowed to view friendsOnly photos -push @versionTags, WebGUI::VersionTag->getWorking($session); -$versionTags[-1]->set({name=>"Adding new photo #3"}); -$photo - = $album->addChild({ - className => "WebGUI::Asset::File::Image::Photo", - groupIdEdit => "", - ownerUserId => $session->user->userId, - }, - undef, - undef, - { - skipAutoCommitWorkflows => 1, - }); -$versionTags[-1]->commit; +# Photo can only be edited by owner or those who can edit the parent album +$maker->prepare({ + object => $photo, + method => 'canEdit', + pass => [ '3', ], + fail => [ '1', $notFriend, $friend, ], +})->run; -ok( !$photo->canView(1), "Visitors cannot view" ); -ok( !$photo->canEdit(1), "Visitors cannot edit" ); -ok( !$photo->canView(2), "Registered Users cannot view" ); -ok( !$photo->canEdit(2), "Registered Users cannot edit" ); -ok( $photo->canView, "Owner can view" ); -ok( $photo->canEdit, "Owner can edit" ); -ok( $photo->canView(3), "Admin can view" ); -ok( $photo->canEdit(3), "Admin can edit" ); +#---------------------------------------------------------------------------- +# Photo can be commented on by those who can view and can comment on the +# parent album and gallery. +$maker->prepare({ + object => $photo, + method => 'canComment', + pass => [ '3', $friend, $notFriend ], + fail => [ '1', ], +})->run; +#---------------------------------------------------------------------------- +# Photo set as friends only can only be viewed by owner's friends +$photo->update({ friendsOnly => 1, }); +$maker->prepare({ + object => $photo, + method => 'canView', + pass => [ '3', $friend ], + fail => [ '1', $notFriend ], +})->run; + +#---------------------------------------------------------------------------- +# Photo can be commented on by those who can view and can comment on the +# parent album and gallery. +$maker->prepare({ + object => $photo, + method => 'canComment', + pass => [ '3', $friend ], + fail => [ '1', $notFriend ], +})->run; + +$photo->update({ friendsOnly => 0, }); #---------------------------------------------------------------------------- # Cleanup END { - WebGUI::Friends->new($session)->delete( [ $friend->userId ] ); - $friend->delete; - foreach my $versionTag (@versionTags) { + for my $versionTag ( @versionTags ) { $versionTag->rollback; } + $friend->delete; + $notFriend->delete; } - - diff --git a/t/Asset/File/Image/Photo/setFile.t b/t/Asset/File/Image/Photo/setFile.t index adc51018e..4da00c8fa 100644 --- a/t/Asset/File/Image/Photo/setFile.t +++ b/t/Asset/File/Image/Photo/setFile.t @@ -18,6 +18,7 @@ use Scalar::Util qw( blessed ); use WebGUI::Test; use WebGUI::Session; use Test::More; +use Test::Deep; use WebGUI::Asset::File::Image::Photo; #---------------------------------------------------------------------------- @@ -60,9 +61,9 @@ plan tests => 2; $photo->setFile( WebGUI::Test->getTestCollateralPath('page_title.jpg') ); my $storage = $photo->getStorageLocation; -is_deeply( - $storage->getFiles, ['page_title.jpg'], - "Storage location contains only the file we added", +cmp_deeply( + $storage->getFiles, bag('page_title.jpg','1024x768.jpg'), + "Storage location contains the resolution file", ); ok( diff --git a/t/Asset/Wobject/Gallery/00base.t b/t/Asset/Wobject/Gallery/00base.t index d214e5570..49b49e29b 100644 --- a/t/Asset/Wobject/Gallery/00base.t +++ b/t/Asset/Wobject/Gallery/00base.t @@ -12,7 +12,7 @@ use FindBin; use strict; use lib "$FindBin::Bin/../../../lib"; -## The goal of this test is to test the creation and deletion of album assets +## The goal of this test is to test the creation and deletion of gallery assets use Scalar::Util qw( blessed ); use WebGUI::Test; @@ -24,7 +24,7 @@ use Test::More; my $session = WebGUI::Test->session; my $node = WebGUI::Asset->getImportNode($session); my $versionTag = WebGUI::VersionTag->getWorking($session); -$versionTag->set({name=>"Album Test"}); +$versionTag->set({name=>"Gallery Test"}); #---------------------------------------------------------------------------- # Tests @@ -57,7 +57,7 @@ $gallery->purge; is( WebGUI::Asset->newByDynamicClass($session, $properties->{assetId}), undef, - "Album no longer able to be instanciated", + "Gallery no longer able to be instanciated", ); diff --git a/t/Asset/Wobject/GalleryAlbum/delete.t b/t/Asset/Wobject/GalleryAlbum/delete.t index b913e9fa6..1e30783e3 100644 --- a/t/Asset/Wobject/GalleryAlbum/delete.t +++ b/t/Asset/Wobject/GalleryAlbum/delete.t @@ -25,13 +25,14 @@ use Test::More; # Init my $maker = WebGUI::Test::Maker::HTML->new; my $session = WebGUI::Test->session; +$session->user({ userId => 3 }); my $node = WebGUI::Asset->getImportNode($session); my $versionTag = WebGUI::VersionTag->getWorking($session); $versionTag->set({name=>"Album Test"}); my $gallery = $node->addChild({ className => "WebGUI::Asset::Wobject::Gallery", - groupIdAddComment => 2, # Registered Users + groupIdComment => 2, # Registered Users groupIdAddFile => 2, # Registered Users groupIdView => 7, # Everyone groupIdEdit => 3, # Admins diff --git a/t/Asset/Wobject/GalleryAlbum/view.t b/t/Asset/Wobject/GalleryAlbum/view.t index 03f933168..e20dcac5b 100644 --- a/t/Asset/Wobject/GalleryAlbum/view.t +++ b/t/Asset/Wobject/GalleryAlbum/view.t @@ -87,7 +87,7 @@ cmp_deeply( $album->getTemplateVars, superhashof( { %{$album->get}, url => $albu my $expected = { "url_addPhoto" => all( - re( qr/className=WebGUI::Asset::File::Image::Photo/ ), + re( qr/class=WebGUI::Asset::File::Image::Photo/ ), re( qr/func=add/ ), re( $album->getUrl ), ), @@ -129,13 +129,15 @@ cmp_deeply( #---------------------------------------------------------------------------- # Test www_view() for those without permission to view -$maker->prepare({ - object => $album, - method => "www_view", - test_privilege => "insufficient", -}); -$maker->run; - +SKIP: { + skip "test_privilege doesn't work yet", 1; + $maker->prepare({ + object => $album, + method => "www_view", + test_privilege => "insufficient", + }); + $maker->run; +} #---------------------------------------------------------------------------- # Cleanup END { diff --git a/t/Storage/Image.t b/t/Storage/Image.t index 390d3357d..00ca8bcb1 100644 --- a/t/Storage/Image.t +++ b/t/Storage/Image.t @@ -255,7 +255,7 @@ foreach my $testImage (@testImages) { cmp_bag( [ $sizeTest->getSizeInPixels($filename) ], [ @{ $testImage }{qw/origHeight origWidth/} ], - "$testImage was not resized" + "$filename was not resized" ); }