replace BAIL_OUT with a skip. It is okay to nest skips

This commit is contained in:
Colin Kuskie 2008-04-23 22:42:42 +00:00
parent 29fb2b1385
commit aa7b0b9839

View file

@ -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" ); SKIP: {
#---------------------------------------------------------------------------- use_ok( 'Test::WWW::Mechanize' ) or skip( "Cannot continue without Test::WWW::Mechanize", 5 );
# 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") ); # Test permissions for new photos
$mech->content_lacks( 'value="editSave"' ); $mech = Test::WWW::Mechanize->new;
#---------------------------------------------------------------------------- # Save a new photo
# Test creating a new Photo $mech->get( $baseUrl . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
SKIP: { $mech->content_lacks( 'value="editSave"' );
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' ) #----------------------------------------------------------------------------
or BAIL_OUT( "Couldn't open test collateral 'lamp.jpg' for reading: $!" ); # Test creating a new Photo
my $properties = { SKIP: {
title => 'Photo Title' . time, skip "File control needs to be fixed to be more 508-compliant before this can be used", 4;
synopsis => '<p>Photo Synopsis' . time . '</p>', $mech = getMechLogin( $baseUrl, $user, $identifier );
newFile_file => $file, $mech->get_ok( $baseUrl . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
};
$mech->submit_form_ok( open my $file, '<', WebGUI::Test->getTestCollateralPath( 'lamp.jpg' )
{ or die( "Couldn't open test collateral 'lamp.jpg' for reading: $!" );
form_number => 1, my $properties = {
fields => $properties, title => 'Photo Title' . time,
}, synopsis => '<p>Photo Synopsis' . time . '</p>',
'Submit new Photo' newFile_file => $file,
); };
# Add properties that should be default and remove those that should be different $mech->submit_form_ok(
delete $properties->{ newFile_file }; {
$properties = { form_number => 1,
%{ $properties }, fields => $properties,
ownerUserId => $user->userId, },
filename => 'lamp.jpg', 'Submit new Photo'
}; );
# Make sure properties were saved # Add properties that should be default and remove those that should be different
my $photo = WebGUI::Asset->newByDynamicClass( $session, $album->getFileIds->[0] ); delete $properties->{ newFile_file };
cmp_deeply( $photo->get, superhashof( $properties ), "Photo properties saved correctly" ); $properties = {
%{ $properties },
ownerUserId => $user->userId,
filename => 'lamp.jpg',
};
# First File in an album should update assetIdThumbnail # Make sure properties were saved
my $album = WebGUI::Asset->newByDynamicClass( $session, $album->getId ); my $photo = WebGUI::Asset->newByDynamicClass( $session, $album->getFileIds->[0] );
is( cmp_deeply( $photo->get, superhashof( $properties ), "Photo properties saved correctly" );
$album->get('assetIdThumbnail'), $photo->getId,
"Album assetIdThumbnail gets set by first File added", # 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",
);
}
} }
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------