A new test. It's currently failing but I'm not really sure why. It could be a bug but I think I'm testing this wrong.

This commit is contained in:
Roy Johnson 2006-10-04 19:04:28 +00:00
parent b99833a9cd
commit 518c76c6f1

View file

@ -16,7 +16,7 @@ use lib "$FindBin::Bin/../../lib";
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 20; # increment this value for each test you create
use Test::More tests => 17; # increment this value for each test you create
use WebGUI::Asset::Wobject::Article;
my $session = WebGUI::Test->session;
@ -25,13 +25,17 @@ my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
# Lets create an article wobject using all defaults then test to see if those defaults were set
my $articleDefaults = {
cacheTimeout => 3600,
#
# This is all commented out right now because it seems the API is not intended to set defaultValues
# based on an assets defintion. This may change down the line, so lets just comment this out for now.
#
#my $articleDefaults = {
# cacheTimeout => 3600,
# templateId => 'PBtmpl0000000000000002',
linkURL => undef,
linkTitle => undef,
storageId => undef,
};
# linkURL => undef,
# linkTitle => undef,
# storageId => undef,
#};
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Article Test"});
@ -41,9 +45,9 @@ my $article = $node->addChild({className=>'WebGUI::Asset::Wobject::Article'});
isa_ok($article, 'WebGUI::Asset::Wobject::Article');
# Test to see if all of the default properties are correct
foreach my $defaultProperty (keys %{$articleDefaults}) {
is ($article->get($defaultProperty), $articleDefaults->{$defaultProperty}, "default $defaultProperty is ".$articleDefaults->{$defaultProperty});
}
#foreach my $defaultProperty (keys %{$articleDefaults}) {
# is ($article->get($defaultProperty), $articleDefaults->{$defaultProperty}, "default $defaultProperty is ".$articleDefaults->{$defaultProperty});
#}
# Test to see if we can set new values
my $newArticleSettings = {
@ -51,7 +55,7 @@ my $newArticleSettings = {
templateId => "PBtmpl0000000000000084",
linkURL => "http://www.snapcount.org",
linkTitle => "I'm thinking of getting metal legs",
storageId => "ThisIsNotRealStorageId",
storageId => "FKGH2yiNQoC2E_FqbMYebw", # This is the storageId of main_bg.jpg from the default wg 7 style 3
};
$article->update($newArticleSettings);
@ -59,9 +63,20 @@ foreach my $newSetting (keys %{$newArticleSettings}) {
is ($article->get($newSetting), $newArticleSettings->{$newSetting}, "updated $newSetting is ".$newArticleSettings->{$newSetting});
}
# Test the duplicate method... not for assets, just the extended duplicate functionality of the article wobject
my $filename = "main_bg.jpg";
my $duplicateArticle = $article->duplicate();
isa_ok($duplicateArticle, 'WebGUI::Asset::Wobject::Article');
my $storageId = $duplicateArticle->get("storageId");
my $storage = WebGUI::Storage::Image->get($session,$storageId);
my $duplicateFilename = $storage->getFiles->[0];
is ($duplicateFilename, $filename, "duplicate method copies collateral");
TODO: {
local $TODO = "Tests to make later";
ok(0, 'Test duplicate method');
ok(0, 'Test exportAssetData method');
ok(0, 'Test getStorageLocation method');
ok(0, 'Test indexContent method');