Fix some Gallery and GalleryAlbum tests.

This commit is contained in:
Colin Kuskie 2010-05-21 13:37:42 -07:00
parent dab177324d
commit c56d2b9403
3 changed files with 10 additions and 30 deletions

View file

@ -40,6 +40,8 @@ my $gallery
}); });
$versionTag->commit; $versionTag->commit;
WebGUI::Test->addToCleanup($versionTag);
$gallery->cloneFromDb;
is( is(
Scalar::Util::blessed($gallery), "WebGUI::Asset::Wobject::Gallery", Scalar::Util::blessed($gallery), "WebGUI::Asset::Wobject::Gallery",
@ -61,14 +63,5 @@ isa_ok(
my $properties = $gallery->get; my $properties = $gallery->get;
$gallery->purge; $gallery->purge;
is( eval { WebGUI::Asset->newById($session, $properties->{assetId}); };
WebGUI::Asset->newById($session, $properties->{assetId}), undef, ok( Exception::Class->caught(), 'Gallery no longer able to be instanciated after purge');
"Gallery no longer able to be instanciated",
);
#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}

View file

@ -51,6 +51,7 @@ my $album
}); });
$versionTag->commit; $versionTag->commit;
WebGUI::Test->addToCleanup($versionTag);
is( is(
Scalar::Util::blessed($album), "WebGUI::Asset::Wobject::GalleryAlbum", Scalar::Util::blessed($album), "WebGUI::Asset::Wobject::GalleryAlbum",
@ -66,14 +67,5 @@ isa_ok(
my $properties = $album->get; my $properties = $album->get;
$album->purge; $album->purge;
is( eval { WebGUI::Asset->newById($session, $properties->{assetId}); };
WebGUI::Asset->newById($session, $properties->{assetId}), undef, ok( Exception::Class->caught(), 'Album no longer able to be instanciated');
"Album no longer able to be instanciated",
);
#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}

View file

@ -77,6 +77,7 @@ for (my $i = 0; $i < 5; $i++)
# Commit all changes # Commit all changes
$versionTag->commit; $versionTag->commit;
WebGUI::Test->addToCleanup($versionTag);
# Make album default asset # Make album default asset
$session->asset( $album ); $session->asset( $album );
@ -95,7 +96,7 @@ use_ok("WebGUI::Asset::Wobject::GalleryAlbum");
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Test calling without arguments # Test calling without arguments
diag("general testing"); note("general testing");
# Provide no arguments at all # Provide no arguments at all
$result = callAjaxService({ }); $result = callAjaxService({ });
@ -105,7 +106,7 @@ ok( $result->{ err } != 0 && $result->{ errMessage }, "Error after call without
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Test moveFile action with incomplete of invalid arguments # Test moveFile action with incomplete of invalid arguments
diag("moveFile action"); note("moveFile action");
# Omit target # Omit target
$result = callAjaxService({ $result = callAjaxService({
@ -256,9 +257,3 @@ sub callAjaxService {
# Call ajax service function and decode reply # Call ajax service function and decode reply
return decode_json( $album->www_ajax() ); return decode_json( $album->www_ajax() );
} }
#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}