fix Cut assethelper tests
This commit is contained in:
parent
51d5f6bcb4
commit
d40fbc8255
1 changed files with 16 additions and 9 deletions
|
|
@ -20,6 +20,7 @@ use WebGUI::Test; # Must use this before any other WebGUI modules
|
|||
use WebGUI::Session;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::AssetHelper::Cut;
|
||||
use WebGUI::Test::Mechanize;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -30,10 +31,10 @@ my $session = WebGUI::Test->session;
|
|||
# Tests
|
||||
|
||||
my $output;
|
||||
my $home = WebGUI::Asset->getDefault($session);
|
||||
my $import = WebGUI::Asset->getImportNode($session);
|
||||
|
||||
$session->user({userId => 1});
|
||||
$output = WebGUI::AssetHelper::Cut->process($home);
|
||||
$output = WebGUI::AssetHelper::Cut->process($import);
|
||||
cmp_deeply(
|
||||
$output,
|
||||
{
|
||||
|
|
@ -43,7 +44,7 @@ cmp_deeply(
|
|||
);
|
||||
|
||||
$session->user({userId => 3});
|
||||
$output = WebGUI::AssetHelper::Cut->process($home);
|
||||
$output = WebGUI::AssetHelper::Cut->process($import);
|
||||
cmp_deeply(
|
||||
$output,
|
||||
{
|
||||
|
|
@ -52,20 +53,26 @@ cmp_deeply(
|
|||
'AssetHelper/Cut checks for system pages'
|
||||
);
|
||||
|
||||
my $safe_page = $home->getFirstChild;
|
||||
my $safe_page = $import->getFirstChild;
|
||||
$output = WebGUI::AssetHelper::Cut->process($safe_page);
|
||||
cmp_deeply(
|
||||
$output,
|
||||
{
|
||||
message => re('was cut to the clipboard'),
|
||||
redirect => $home->getUrl,
|
||||
openDialog => all( re('method=cut'), re('assetId=' . $safe_page->getId) ),
|
||||
},
|
||||
'AssetHelper/Cut returns a message and a redirect'
|
||||
'AssetHelper/Cut opens a dialog'
|
||||
);
|
||||
|
||||
my $mech = WebGUI::Test::Mechanize->new( config => WebGUI::Test->file );
|
||||
$mech->get_ok( $output->{ openDialog } );
|
||||
$mech->content_lacks( 'error', "Cut succeeded" );
|
||||
|
||||
$session->cache->clear;
|
||||
$safe_page = WebGUI::Asset->newById( $session, $safe_page->assetId );
|
||||
is $safe_page->state, 'clipboard', '... and the asset was really cut';
|
||||
|
||||
$session->asset($home);
|
||||
ok $home->paste($safe_page->getId), 'page pasted correctly';
|
||||
$session->asset($import);
|
||||
ok $import->paste($safe_page->getId), 'page pasted correctly';
|
||||
|
||||
$session->cache->clear;
|
||||
my $safe_page2 = WebGUI::Asset->newById($session, $safe_page->assetId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue