Tree view buttons now work. Changed progress bar helpers to use fork. Added forkId option to AssetHelpers. Added updateAsset service to Admin.
This commit is contained in:
parent
399aa5368b
commit
b27bc19e4d
14 changed files with 757 additions and 277 deletions
|
|
@ -30,12 +30,13 @@ my $session = WebGUI::Test->session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 3; # Increment this number for each test you create
|
||||
plan tests => 2; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
|
||||
my $output;
|
||||
$session->setting->set( "versionTagMode" => "autoCommit" );
|
||||
my $helper = WebGUI::AssetHelper::Copy->new( id => 'copy', session => $session );
|
||||
my $home = WebGUI::Asset->getDefault($session);
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
|
|
@ -46,19 +47,14 @@ my $root = WebGUI::Asset->getRoot($session);
|
|||
cmp_deeply(
|
||||
$output,
|
||||
{
|
||||
openDialog => all(
|
||||
re('helperId=copy'),
|
||||
re('method=copy'),
|
||||
re('assetId=' . $home->getId ),
|
||||
),
|
||||
forkId => re('[a-zA-Z0-9_-]{22}'),
|
||||
},
|
||||
'AssetHelper/Copy opens a dialog for the copy method'
|
||||
'AssetHelper/Copy forks a process'
|
||||
);
|
||||
}
|
||||
|
||||
my $mech = WebGUI::Test::Mechanize->new( config => WebGUI::Test->file );
|
||||
$mech->get_ok( '/?op=assetHelper;helperId=copy;method=copy;assetId=' . $home->getId );
|
||||
|
||||
WebGUI::Test->waitForAllForks;
|
||||
$session->cache->clear;
|
||||
my $clippies = $root->getLineage(["descendants"], {statesToInclude => [qw{clipboard clipboard-limbo}], returnObjects => 1,});
|
||||
is @{ $clippies }, 1, '... only copied 1 asset to the clipboard, no children';
|
||||
addToCleanup(@{ $clippies });
|
||||
|
|
|
|||
|
|
@ -59,14 +59,12 @@ $output = $helper->process($safe_page);
|
|||
cmp_deeply(
|
||||
$output,
|
||||
{
|
||||
openDialog => all( re('method=cut'), re('assetId=' . $safe_page->getId) ),
|
||||
forkId => re(qr/[a-zA-Z0-9_-]{22}/),
|
||||
},
|
||||
'AssetHelper/Cut opens a dialog'
|
||||
'AssetHelper/Cut forks a process'
|
||||
);
|
||||
|
||||
my $mech = WebGUI::Test::Mechanize->new( config => WebGUI::Test->file );
|
||||
$mech->get_ok( $output->{ openDialog } );
|
||||
$mech->content_lacks( 'error', "Cut succeeded" );
|
||||
WebGUI::Test->waitForAllForks;
|
||||
|
||||
$session->cache->clear;
|
||||
$safe_page = WebGUI::Asset->newById( $session, $safe_page->assetId );
|
||||
|
|
|
|||
77
t/AssetHelper/Delete.t
Normal file
77
t/AssetHelper/Delete.t
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
# vim:syntax=perl
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2009 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
|
||||
#------------------------------------------------------------------
|
||||
|
||||
# Write a little about what this script tests.
|
||||
#
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::AssetHelper::Delete;
|
||||
use WebGUI::Test::Mechanize;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
my $output;
|
||||
my $helper = WebGUI::AssetHelper::Delete->new( id => 'Delete', session => $session );
|
||||
my $import = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
$session->user({userId => 1});
|
||||
$output = $helper->process($import);
|
||||
cmp_deeply(
|
||||
$output,
|
||||
{
|
||||
error => re('You do not have sufficient privileges'),
|
||||
},
|
||||
'AssetHelper/Delete checks for editing privileges'
|
||||
);
|
||||
|
||||
$session->user({userId => 3});
|
||||
$output = $helper->process($import);
|
||||
cmp_deeply(
|
||||
$output,
|
||||
{
|
||||
error => re('vital component'),
|
||||
},
|
||||
'AssetHelper/Delete checks for system pages'
|
||||
);
|
||||
|
||||
my $safe_page = $import->getFirstChild;
|
||||
$output = $helper->process($safe_page);
|
||||
cmp_deeply(
|
||||
$output,
|
||||
{
|
||||
forkId => re(qr/[a-zA-Z0-9_-]{22}/),
|
||||
},
|
||||
'AssetHelper/Delete forks a process'
|
||||
);
|
||||
|
||||
WebGUI::Test->waitForAllForks;
|
||||
|
||||
$session->cache->clear;
|
||||
$safe_page = WebGUI::Asset->newById( $session, $safe_page->assetId );
|
||||
is $safe_page->state, 'trash', '... and the asset was really Deleted';
|
||||
|
||||
$safe_page->restore;
|
||||
|
||||
done_testing();
|
||||
|
||||
#vim:ft=perl
|
||||
61
t/AssetHelper/Duplicate.t
Normal file
61
t/AssetHelper/Duplicate.t
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# vim:syntax=perl
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Duplicateright 2001-2009 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
|
||||
#------------------------------------------------------------------
|
||||
|
||||
# Write a little about what this script tests.
|
||||
#
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::AssetHelper::Duplicate;
|
||||
use WebGUI::Test::Mechanize;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 2; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
|
||||
my $output;
|
||||
$session->setting->set( "versionTagMode" => "autoCommit" );
|
||||
my $helper = WebGUI::AssetHelper::Duplicate->new( id => 'duplicate', session => $session );
|
||||
my $root = WebGUI::Test->asset;
|
||||
my $test = $root->addChild( { className => 'WebGUI::Asset::Snippet' } );
|
||||
|
||||
{
|
||||
|
||||
$output = $helper->process($test);
|
||||
cmp_deeply(
|
||||
$output,
|
||||
{
|
||||
forkId => re('[a-zA-Z0-9_-]{22}'),
|
||||
},
|
||||
'AssetHelper/Duplicate forks a process'
|
||||
);
|
||||
}
|
||||
|
||||
WebGUI::Test->waitForAllForks;
|
||||
$session->cache->clear;
|
||||
my $children = $root->getLineage(["children"]);
|
||||
is @{ $children }, 2, '... created a new asset';
|
||||
|
||||
#vim:ft=perl
|
||||
Loading…
Add table
Add a link
Reference in a new issue