merging tests and bug fixes from 7.1 branch

- fix Asset.t cache test
- fix Asset.t purgeCache test
- add Session.t test suite
This commit is contained in:
Roy Johnson 2006-10-26 19:14:45 +00:00
parent 39c6b000ca
commit 153b13207f
2 changed files with 60 additions and 1 deletions

57
t/Asset/Snippet.t Normal file
View file

@ -0,0 +1,57 @@
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use FindBin;
use strict;
use lib "$FindBin::Bin/../lib";
##The goal of this test is to test the creation of Snippet Assets.
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 10; # increment this value for each test you create
use WebGUI::Asset::Snippet;
my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Snippet Test"});
my $snippet = $node->addChild({className=>'WebGUI::Asset::Snippet'});
# Test for a sane object type
isa_ok($snippet, 'WebGUI::Asset::Snippet');
# Test to see if we can set values
my $properties = {
cacheTimeout => 124,
processAsTemplate => 1,
mimeType => 'text/plain',
snippet => "Gooey's milkshake brings all the girls to the yard...",
};
$snippet->update($properties);
foreach my $property (keys %{$properties}) {
is ($snippet->get($property), $properties->{$property}, "updated $property is ".$properties->{$property});
}
TODO: {
local $TODO = "Tests to make later";
ok(0, 'Test getToolbar method');
ok(0, 'Test indexContent method');
ok(0, 'Test view method');
ok(0, 'Test www_edit method');
ok(0, 'Test www_view method... maybe?');
}
END {
# Clean up after thy self
$versionTag->rollback($versionTag->getId);
}

View file

@ -103,6 +103,7 @@ is ($duplicateFilename, undef, 'purge method deletes collateral');
# Lets make sure the view method returns something.
# This is not a very good test but I need to do it to test the purgeCache method anyways =)
$article->prepareView;
my $output = $article->view;
isnt ($output, "", 'view method returns something');
@ -112,6 +113,7 @@ is ($output, $cachedOutput, 'view method caches output');
# Lets see if the purgeCache method works
$article->purgeCache;
$cachedOutput = WebGUI::Cache->new($session, 'view_'.$article->getId)->get; # Check cache post purge
isnt ($output, $cachedOutput, 'purgeCache method deletes cache');
@ -127,6 +129,6 @@ TODO: {
END {
# Clean up after thy self
#$versionTag->rollback($versionTag->getId);
$versionTag->rollback($versionTag->getId);
}