From c56d2b9403556cdcdc8a814c075bcb55df6514ee Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 21 May 2010 13:37:42 -0700 Subject: [PATCH] Fix some Gallery and GalleryAlbum tests. --- t/Asset/Wobject/Gallery/00base.t | 15 ++++----------- t/Asset/Wobject/GalleryAlbum/00base.t | 14 +++----------- t/Asset/Wobject/GalleryAlbum/ajax.t | 11 +++-------- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/t/Asset/Wobject/Gallery/00base.t b/t/Asset/Wobject/Gallery/00base.t index bdce13580..bb1d380c8 100644 --- a/t/Asset/Wobject/Gallery/00base.t +++ b/t/Asset/Wobject/Gallery/00base.t @@ -40,6 +40,8 @@ my $gallery }); $versionTag->commit; +WebGUI::Test->addToCleanup($versionTag); +$gallery->cloneFromDb; is( Scalar::Util::blessed($gallery), "WebGUI::Asset::Wobject::Gallery", @@ -61,14 +63,5 @@ isa_ok( my $properties = $gallery->get; $gallery->purge; -is( - WebGUI::Asset->newById($session, $properties->{assetId}), undef, - "Gallery no longer able to be instanciated", -); - - -#---------------------------------------------------------------------------- -# Cleanup -END { - $versionTag->rollback(); -} +eval { WebGUI::Asset->newById($session, $properties->{assetId}); }; +ok( Exception::Class->caught(), 'Gallery no longer able to be instanciated after purge'); diff --git a/t/Asset/Wobject/GalleryAlbum/00base.t b/t/Asset/Wobject/GalleryAlbum/00base.t index 8414f54d5..88827f0ab 100644 --- a/t/Asset/Wobject/GalleryAlbum/00base.t +++ b/t/Asset/Wobject/GalleryAlbum/00base.t @@ -51,6 +51,7 @@ my $album }); $versionTag->commit; +WebGUI::Test->addToCleanup($versionTag); is( Scalar::Util::blessed($album), "WebGUI::Asset::Wobject::GalleryAlbum", @@ -66,14 +67,5 @@ isa_ok( my $properties = $album->get; $album->purge; -is( - WebGUI::Asset->newById($session, $properties->{assetId}), undef, - "Album no longer able to be instanciated", -); - - -#---------------------------------------------------------------------------- -# Cleanup -END { - $versionTag->rollback(); -} +eval { WebGUI::Asset->newById($session, $properties->{assetId}); }; +ok( Exception::Class->caught(), 'Album no longer able to be instanciated'); diff --git a/t/Asset/Wobject/GalleryAlbum/ajax.t b/t/Asset/Wobject/GalleryAlbum/ajax.t index 679137595..718aff5f8 100644 --- a/t/Asset/Wobject/GalleryAlbum/ajax.t +++ b/t/Asset/Wobject/GalleryAlbum/ajax.t @@ -77,6 +77,7 @@ for (my $i = 0; $i < 5; $i++) # Commit all changes $versionTag->commit; +WebGUI::Test->addToCleanup($versionTag); # Make album default asset $session->asset( $album ); @@ -95,7 +96,7 @@ use_ok("WebGUI::Asset::Wobject::GalleryAlbum"); #---------------------------------------------------------------------------- # Test calling without arguments -diag("general testing"); +note("general testing"); # Provide no arguments at all $result = callAjaxService({ }); @@ -105,7 +106,7 @@ ok( $result->{ err } != 0 && $result->{ errMessage }, "Error after call without #---------------------------------------------------------------------------- # Test moveFile action with incomplete of invalid arguments -diag("moveFile action"); +note("moveFile action"); # Omit target $result = callAjaxService({ @@ -256,9 +257,3 @@ sub callAjaxService { # Call ajax service function and decode reply return decode_json( $album->www_ajax() ); } - -#---------------------------------------------------------------------------- -# Cleanup -END { - $versionTag->rollback(); -}