From 404258f7c61d53cd08c203d4ff81028c08d51ac3 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 21 Apr 2008 19:10:19 +0000 Subject: [PATCH] All test sessions are automatically outfitted with a PseudoRequest object. Check to see if there is an exportPath defined in the config file, if not, safely skip all of the tests. --- t/Asset/AssetExportHtml.t | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/t/Asset/AssetExportHtml.t b/t/Asset/AssetExportHtml.t index d713c87db..938c1d114 100644 --- a/t/Asset/AssetExportHtml.t +++ b/t/Asset/AssetExportHtml.t @@ -33,17 +33,26 @@ use Test::Deep; #---------------------------------------------------------------------------- # Init my $session = WebGUI::Test->session; -$session->{_request} = WebGUI::PseudoRequest->new(); - #---------------------------------------------------------------------------- # Tests -plan tests => 145; # Increment this number for each test you create +my $configExportPath = $session->config->get('exportPath'); + +my $testRan = 1; + +if ($configExportPath) { + plan tests => 145; # Increment this number for each test you create +} +else { + $testRan = 0; + plan skip_all => 'No exportPath in the config file'; +} #---------------------------------------------------------------------------- # exportCheckPath() + my $e; # ensure exportCheckPath barfs if not given a session as its first argument. @@ -977,17 +986,18 @@ is($home->exportGetUrlAsPath->absolute->stringify, readlink $rootUrlSymlink->abs #---------------------------------------------------------------------------- # Cleanup END { + if ($testRan) { + # remove $tempDirectory since it now exists in the filesystem + rmtree($tempDirectory); - # remove $tempDirectory since it now exists in the filesystem - rmtree($tempDirectory); + # restore the original exportPath setting, now that we're done testing + # exportCheckPath. + $session->config->set('exportPath', $originalExportPath); - # restore the original exportPath setting, now that we're done testing - # exportCheckPath. - $session->config->set('exportPath', $originalExportPath); + # we created a couple of assets; roll them back so they don't stick around + $versionTag->rollback(); - # we created a couple of assets; roll them back so they don't stick around - $versionTag->rollback(); - - # make sure people can view /home - $home->update( { groupIdView => 7 } ); # everyone + # make sure people can view /home + $home->update( { groupIdView => 7 } ); # everyone + } }