replace BAIL_OUT with a skip. It is okay to nest skips
This commit is contained in:
parent
29fb2b1385
commit
aa7b0b9839
1 changed files with 46 additions and 43 deletions
|
|
@ -69,57 +69,60 @@ my $photo;
|
||||||
|
|
||||||
plan tests => 6; # Increment this number for each test you create
|
plan tests => 6; # Increment this number for each test you create
|
||||||
|
|
||||||
use_ok( 'Test::WWW::Mechanize' ) or BAIL_OUT( "Cannot continue without Test::WWW::Mechanize" );
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Test permissions for new photos
|
|
||||||
$mech = Test::WWW::Mechanize->new;
|
|
||||||
|
|
||||||
# Save a new photo
|
|
||||||
$mech->get( $baseUrl . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
|
|
||||||
$mech->content_lacks( 'value="editSave"' );
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
# Test creating a new Photo
|
|
||||||
SKIP: {
|
SKIP: {
|
||||||
skip "File control needs to be fixed to be more 508-compliant before this can be used", 4;
|
|
||||||
$mech = getMechLogin( $baseUrl, $user, $identifier );
|
|
||||||
$mech->get_ok( $baseUrl . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
|
|
||||||
|
|
||||||
open my $file, '<', WebGUI::Test->getTestCollateralPath( 'lamp.jpg' )
|
use_ok( 'Test::WWW::Mechanize' ) or skip( "Cannot continue without Test::WWW::Mechanize", 5 );
|
||||||
or BAIL_OUT( "Couldn't open test collateral 'lamp.jpg' for reading: $!" );
|
|
||||||
my $properties = {
|
|
||||||
title => 'Photo Title' . time,
|
|
||||||
synopsis => '<p>Photo Synopsis' . time . '</p>',
|
|
||||||
newFile_file => $file,
|
|
||||||
};
|
|
||||||
|
|
||||||
$mech->submit_form_ok(
|
#----------------------------------------------------------------------------
|
||||||
{
|
# Test permissions for new photos
|
||||||
form_number => 1,
|
$mech = Test::WWW::Mechanize->new;
|
||||||
fields => $properties,
|
|
||||||
},
|
|
||||||
'Submit new Photo'
|
|
||||||
);
|
|
||||||
|
|
||||||
# Add properties that should be default and remove those that should be different
|
# Save a new photo
|
||||||
delete $properties->{ newFile_file };
|
$mech->get( $baseUrl . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
|
||||||
$properties = {
|
$mech->content_lacks( 'value="editSave"' );
|
||||||
%{ $properties },
|
|
||||||
ownerUserId => $user->userId,
|
|
||||||
filename => 'lamp.jpg',
|
|
||||||
};
|
|
||||||
|
|
||||||
# Make sure properties were saved
|
#----------------------------------------------------------------------------
|
||||||
my $photo = WebGUI::Asset->newByDynamicClass( $session, $album->getFileIds->[0] );
|
# Test creating a new Photo
|
||||||
cmp_deeply( $photo->get, superhashof( $properties ), "Photo properties saved correctly" );
|
SKIP: {
|
||||||
|
skip "File control needs to be fixed to be more 508-compliant before this can be used", 4;
|
||||||
|
$mech = getMechLogin( $baseUrl, $user, $identifier );
|
||||||
|
$mech->get_ok( $baseUrl . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
|
||||||
|
|
||||||
# First File in an album should update assetIdThumbnail
|
open my $file, '<', WebGUI::Test->getTestCollateralPath( 'lamp.jpg' )
|
||||||
my $album = WebGUI::Asset->newByDynamicClass( $session, $album->getId );
|
or die( "Couldn't open test collateral 'lamp.jpg' for reading: $!" );
|
||||||
is(
|
my $properties = {
|
||||||
$album->get('assetIdThumbnail'), $photo->getId,
|
title => 'Photo Title' . time,
|
||||||
"Album assetIdThumbnail gets set by first File added",
|
synopsis => '<p>Photo Synopsis' . time . '</p>',
|
||||||
);
|
newFile_file => $file,
|
||||||
|
};
|
||||||
|
|
||||||
|
$mech->submit_form_ok(
|
||||||
|
{
|
||||||
|
form_number => 1,
|
||||||
|
fields => $properties,
|
||||||
|
},
|
||||||
|
'Submit new Photo'
|
||||||
|
);
|
||||||
|
|
||||||
|
# Add properties that should be default and remove those that should be different
|
||||||
|
delete $properties->{ newFile_file };
|
||||||
|
$properties = {
|
||||||
|
%{ $properties },
|
||||||
|
ownerUserId => $user->userId,
|
||||||
|
filename => 'lamp.jpg',
|
||||||
|
};
|
||||||
|
|
||||||
|
# Make sure properties were saved
|
||||||
|
my $photo = WebGUI::Asset->newByDynamicClass( $session, $album->getFileIds->[0] );
|
||||||
|
cmp_deeply( $photo->get, superhashof( $properties ), "Photo properties saved correctly" );
|
||||||
|
|
||||||
|
# First File in an album should update assetIdThumbnail
|
||||||
|
my $album = WebGUI::Asset->newByDynamicClass( $session, $album->getId );
|
||||||
|
is(
|
||||||
|
$album->get('assetIdThumbnail'), $photo->getId,
|
||||||
|
"Album assetIdThumbnail gets set by first File added",
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue