- added: Inbox is now pruned after 1 year
- Added about a hundred tests for Collaboration system, Post, and Thread permissions - Cleaned up code tested by the aforementioned tests - Fixed all Test::WWW::Mechanize tests and updated the skeleton. Should be usable now.
This commit is contained in:
parent
ea1dac4064
commit
98992b8920
16 changed files with 742 additions and 120 deletions
|
|
@ -65,9 +65,16 @@ $versionTags[-1]->commit;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 9; # Increment this number for each test you create
|
||||
if ( !eval { require Test::WWW::Mechanize; 1; } ) {
|
||||
plan skip_all => 'Cannot load Test::WWW::Mechanize. Will not test.';
|
||||
}
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
$mech->get( $baseUrl );
|
||||
if ( !$mech->success ) {
|
||||
plan skip_all => "Cannot load URL '$baseUrl'. Will not test.";
|
||||
}
|
||||
|
||||
use_ok( 'Test::WWW::Mechanize' ) or BAIL_OUT("Cannot continue without Test::WWW::Mechanize");
|
||||
plan tests => 8; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add event: Users without permission are not shown form
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ my %oldSettings;
|
|||
# userFunctionStyleId
|
||||
$oldSettings{ userFunctionStyleId } = $session->setting->get( 'userFunctionStyleId' );
|
||||
$session->setting->set( 'userFunctionStyleId', 'PBtmpl0000000000000132' );
|
||||
# specialState
|
||||
$oldSettings{ specialState } = $session->setting->get( 'specialState' );
|
||||
$session->setting->set( 'specialState', '' );
|
||||
|
||||
# Create a user for testing purposes
|
||||
my $user = WebGUI::User->new( $session, "new" );
|
||||
|
|
@ -67,62 +70,66 @@ my $photo;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 6; # Increment this number for each test you create
|
||||
if ( !eval { require Test::WWW::Mechanize; 1; } ) {
|
||||
plan skip_all => 'Cannot load Test::WWW::Mechanize. Will not test.';
|
||||
}
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
$mech->get( $baseUrl );
|
||||
if ( !$mech->success ) {
|
||||
plan skip_all => "Cannot load URL '$baseUrl'. Will not test.";
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
plan tests => 5; # Increment this number for each test you create
|
||||
|
||||
use_ok( 'Test::WWW::Mechanize' ) or skip( "Cannot continue without Test::WWW::Mechanize", 5 );
|
||||
#----------------------------------------------------------------------------
|
||||
# Test permissions for new photos
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test permissions for new photos
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
# Save a new photo
|
||||
$mech->get( $baseUrl . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
|
||||
$mech->content_lacks( 'value="editSave"' );
|
||||
|
||||
# Save a new photo
|
||||
$mech->get( $baseUrl . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
|
||||
$mech->content_lacks( 'value="editSave"' );
|
||||
#----------------------------------------------------------------------------
|
||||
# Test creating a new Photo
|
||||
SKIP: {
|
||||
skip "File control needs to be fixed to be more 508-compliant before this can be used", 4;
|
||||
$mech = getMechLogin( $baseUrl, $user, $identifier );
|
||||
$mech->get_ok( $baseUrl . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test creating a new Photo
|
||||
SKIP: {
|
||||
skip "File control needs to be fixed to be more 508-compliant before this can be used", 4;
|
||||
$mech = getMechLogin( $baseUrl, $user, $identifier );
|
||||
$mech->get_ok( $baseUrl . $album->getUrl("func=add;class=WebGUI::Asset::File::GalleryFile::Photo") );
|
||||
open my $file, '<', WebGUI::Test->getTestCollateralPath( 'lamp.jpg' )
|
||||
or die( "Couldn't open test collateral 'lamp.jpg' for reading: $!" );
|
||||
my $properties = {
|
||||
title => 'Photo Title' . time,
|
||||
synopsis => '<p>Photo Synopsis' . time . '</p>',
|
||||
newFile_file => $file,
|
||||
};
|
||||
|
||||
open my $file, '<', WebGUI::Test->getTestCollateralPath( 'lamp.jpg' )
|
||||
or die( "Couldn't open test collateral 'lamp.jpg' for reading: $!" );
|
||||
my $properties = {
|
||||
title => 'Photo Title' . time,
|
||||
synopsis => '<p>Photo Synopsis' . time . '</p>',
|
||||
newFile_file => $file,
|
||||
};
|
||||
$mech->submit_form_ok(
|
||||
{
|
||||
form_number => 1,
|
||||
fields => $properties,
|
||||
},
|
||||
'Submit new Photo'
|
||||
);
|
||||
|
||||
$mech->submit_form_ok(
|
||||
{
|
||||
form_number => 1,
|
||||
fields => $properties,
|
||||
},
|
||||
'Submit new Photo'
|
||||
);
|
||||
# Add properties that should be default and remove those that should be different
|
||||
delete $properties->{ newFile_file };
|
||||
$properties = {
|
||||
%{ $properties },
|
||||
ownerUserId => $user->userId,
|
||||
filename => 'lamp.jpg',
|
||||
};
|
||||
|
||||
# Add properties that should be default and remove those that should be different
|
||||
delete $properties->{ newFile_file };
|
||||
$properties = {
|
||||
%{ $properties },
|
||||
ownerUserId => $user->userId,
|
||||
filename => 'lamp.jpg',
|
||||
};
|
||||
# Make sure properties were saved
|
||||
my $photo = WebGUI::Asset->newByDynamicClass( $session, $album->getFileIds->[0] );
|
||||
cmp_deeply( $photo->get, superhashof( $properties ), "Photo properties saved correctly" );
|
||||
|
||||
# Make sure properties were saved
|
||||
my $photo = WebGUI::Asset->newByDynamicClass( $session, $album->getFileIds->[0] );
|
||||
cmp_deeply( $photo->get, superhashof( $properties ), "Photo properties saved correctly" );
|
||||
|
||||
# First File in an album should update assetIdThumbnail
|
||||
my $album = WebGUI::Asset->newByDynamicClass( $session, $album->getId );
|
||||
is(
|
||||
$album->get('assetIdThumbnail'), $photo->getId,
|
||||
"Album assetIdThumbnail gets set by first File added",
|
||||
);
|
||||
}
|
||||
# First File in an album should update assetIdThumbnail
|
||||
my $album = WebGUI::Asset->newByDynamicClass( $session, $album->getId );
|
||||
is(
|
||||
$album->get('assetIdThumbnail'), $photo->getId,
|
||||
"Album assetIdThumbnail gets set by first File added",
|
||||
);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
129
t/Asset/Post/Thread/permission.t
Normal file
129
t/Asset/Post/Thread/permission.t
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
# vim:syntax=perl
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 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 FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../../../lib";
|
||||
use Test::More;
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Test::Maker::Permission;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
$session->user( { userId => 3 } );
|
||||
my $maker = WebGUI::Test::Maker::Permission->new;
|
||||
my $node = WebGUI::Asset->getImportNode( $session );
|
||||
|
||||
my %user;
|
||||
$user{"2"} = WebGUI::User->new( $session, "new" );
|
||||
$user{"2"}->addToGroups( ['2'] ); # Registered user
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking( $session );
|
||||
$versionTag->set( { name => "Collaboration Test" } );
|
||||
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1 } );
|
||||
|
||||
my $collab
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Collaboration",
|
||||
groupIdView => 7, # Everyone
|
||||
groupIdEdit => 3, # Admins
|
||||
groupToEditPost => 3, # Admins
|
||||
ownerUserId => 3, # Admin
|
||||
postGroupId => 2, # Registered Users
|
||||
canStartThreadGroupId => 3, # Admin
|
||||
allowReplies => 1,
|
||||
editTimeout => 60 * 60 * 24, # 24 hours
|
||||
}, @addArgs );
|
||||
|
||||
my $thread
|
||||
= $collab->addChild({
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
ownerUserId => $user{"2"}->userId,
|
||||
groupIdView => 7,
|
||||
}, @addArgs );
|
||||
|
||||
$versionTag->commit( { timeout => 1_000_000 } );
|
||||
|
||||
# Re-load the collab to get the newly committed properties
|
||||
$collab = WebGUI::Asset->newByDynamicClass( $session, $collab->getId );
|
||||
$thread = WebGUI::Asset->newByDynamicClass( $session, $thread->getId );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 36;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Permissions for threads
|
||||
# View
|
||||
$maker->prepare( {
|
||||
object => $thread,
|
||||
method => 'canView',
|
||||
pass => [ '1', $user{"2"}, '3', ],
|
||||
} )->run;
|
||||
|
||||
# Subscribe
|
||||
$maker->prepare( {
|
||||
object => $thread,
|
||||
method => 'canSubscribe',
|
||||
pass => [ $user{"2"}, '3', ],
|
||||
fail => [ '1', ],
|
||||
} )->run;
|
||||
|
||||
# Edit
|
||||
$maker->prepare( {
|
||||
object => $thread,
|
||||
method => 'canEdit',
|
||||
pass => [ $user{"2"}, '3', ],
|
||||
fail => [ '1', ],
|
||||
} )->run;
|
||||
|
||||
# Reply
|
||||
$maker->prepare( {
|
||||
object => $thread,
|
||||
method => 'canReply',
|
||||
pass => [ $user{"2"}, '3', ],
|
||||
fail => [ '1', ],
|
||||
} )->run;
|
||||
|
||||
# Reply with allowReplies = 0
|
||||
$collab->update({ allowReplies => 0 });
|
||||
$thread = WebGUI::Asset->newByDynamicClass( $session, $thread->getId );
|
||||
$maker->prepare( {
|
||||
object => $thread,
|
||||
method => 'canReply',
|
||||
fail => [ '1', $user{"2"}, '3', ],
|
||||
} )->run;
|
||||
$collab->update({ allowReplies => 1 });
|
||||
|
||||
# Reply with thread isLocked
|
||||
$thread->lock;
|
||||
$maker->prepare( {
|
||||
object => $thread,
|
||||
method => 'canReply',
|
||||
fail => [ '1', $user{"2"}, '3', ],
|
||||
} )->run;
|
||||
$thread->unlock;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
END {
|
||||
for my $user ( values %user ) {
|
||||
$user->delete;
|
||||
}
|
||||
$versionTag->rollback;
|
||||
}
|
||||
100
t/Asset/Post/permission.t
Normal file
100
t/Asset/Post/permission.t
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
# vim:syntax=perl
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 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 FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../../lib";
|
||||
use Test::More;
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Test::Maker::Permission;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
$session->user( { userId => 3 } );
|
||||
my $maker = WebGUI::Test::Maker::Permission->new;
|
||||
my $node = WebGUI::Asset->getImportNode( $session );
|
||||
|
||||
my %user;
|
||||
$user{"2"} = WebGUI::User->new( $session, "new" );
|
||||
$user{"2"}->addToGroups( ['2'] ); # Registered user
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking( $session );
|
||||
$versionTag->set( { name => "Collaboration Test" } );
|
||||
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1 } );
|
||||
|
||||
my $collab
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Collaboration",
|
||||
groupIdView => 7, # Everyone
|
||||
groupIdEdit => 3, # Admins
|
||||
groupToEditPost => 3, # Admins
|
||||
ownerUserId => 3, # Admin
|
||||
postGroupId => 2, # Registered Users
|
||||
canStartThreadGroupId => 3, # Admin
|
||||
allowReplies => 1,
|
||||
editTimeout => 60 * 60 * 24, # 24 hours
|
||||
}, @addArgs );
|
||||
|
||||
my $thread
|
||||
= $collab->addChild({
|
||||
className => 'WebGUI::Asset::Post::Thread',
|
||||
ownerUserId => $user{"2"}->userId,
|
||||
}, @addArgs );
|
||||
|
||||
my $post
|
||||
= $thread->addChild({
|
||||
className => 'WebGUI::Asset::Post',
|
||||
ownerUserId => $user{"2"}->userId,
|
||||
}, @addArgs );
|
||||
|
||||
$versionTag->commit( { timeout => 1_000_000 } );
|
||||
|
||||
# Re-load the collab to get the newly committed properties
|
||||
$collab = WebGUI::Asset->newByDynamicClass( $session, $collab->getId );
|
||||
$thread = WebGUI::Asset->newByDynamicClass( $session, $thread->getId );
|
||||
$post = WebGUI::Asset->newByDynamicClass( $session, $post->getId );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 12;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Permissions for posts
|
||||
# View
|
||||
$maker->prepare( {
|
||||
object => $post,
|
||||
method => 'canView',
|
||||
pass => [ '1', $user{"2"}, '3', ],
|
||||
} )->run;
|
||||
|
||||
# Edit
|
||||
$maker->prepare( {
|
||||
object => $post,
|
||||
method => 'canEdit',
|
||||
pass => [ $user{"2"}, '3', ],
|
||||
fail => [ '1', ],
|
||||
} )->run;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
END {
|
||||
for my $user ( values %user ) {
|
||||
$user->delete;
|
||||
}
|
||||
$versionTag->rollback;
|
||||
}
|
||||
|
|
@ -33,10 +33,13 @@ my %oldSettings;
|
|||
# userFunctionStyleId
|
||||
$oldSettings{ userFunctionStyleId } = $session->setting->get( 'userFunctionStyleId' );
|
||||
$session->setting->set( 'userFunctionStyleId', 'PBtmpl0000000000000132' );
|
||||
# specialState
|
||||
$oldSettings{ specialState } = $session->setting->get( 'specialState' );
|
||||
$session->setting->set( 'specialState', '' );
|
||||
|
||||
# Create a user for testing purposes
|
||||
my $user = WebGUI::User->new( $session, "new" );
|
||||
$user->username( 'dufresne' . time );
|
||||
$user->username( 'dufresne' );
|
||||
my $identifier = 'ritahayworth';
|
||||
my $auth = WebGUI::Operation::Auth::getInstance( $session, $user->authMethod, $user->userId );
|
||||
$auth->saveParams( $user->userId, $user->authMethod, {
|
||||
|
|
@ -65,9 +68,16 @@ $versionTags[-1]->commit;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 13; # Increment this number for each test you create
|
||||
if ( !eval { require Test::WWW::Mechanize; 1; } ) {
|
||||
plan skip_all => 'Cannot load Test::WWW::Mechanize. Will not test.';
|
||||
}
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
$mech->get( $baseUrl );
|
||||
if ( !$mech->success ) {
|
||||
plan skip_all => "Cannot load URL '$baseUrl'. Will not test.";
|
||||
}
|
||||
|
||||
use_ok( 'Test::WWW::Mechanize' );
|
||||
plan tests => 12; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test operation with a public Redirect
|
||||
|
|
|
|||
115
t/Asset/Wobject/Collaboration/permission.t
Normal file
115
t/Asset/Wobject/Collaboration/permission.t
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
# vim:syntax=perl
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2008 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 FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../../../lib";
|
||||
use Test::More;
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Test::Maker::Permission;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
$session->user( { userId => 3 } );
|
||||
my $maker = WebGUI::Test::Maker::Permission->new;
|
||||
my $node = WebGUI::Asset->getImportNode( $session );
|
||||
|
||||
my %user;
|
||||
$user{"2"} = WebGUI::User->new( $session, "new" );
|
||||
$user{"2"}->addToGroups( ['2'] ); # Registered user
|
||||
|
||||
my $versionTag = WebGUI::VersionTag->getWorking( $session );
|
||||
$versionTag->set( { name => "Collaboration Test" } );
|
||||
|
||||
my @addArgs = ( undef, undef, { skipAutoCommitWorkflows => 1 } );
|
||||
|
||||
my $collab
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Collaboration",
|
||||
groupIdView => 7, # Everyone
|
||||
groupIdEdit => 3, # Admins
|
||||
ownerUserId => 3, # Admin
|
||||
postGroupId => 2, # Registered Users
|
||||
canStartThreadGroupId => 3, # Admin
|
||||
}, @addArgs );
|
||||
|
||||
$versionTag->commit( { timeout => 1_000_000 } );
|
||||
|
||||
# Re-load the collab to get the newly committed properties
|
||||
$collab = WebGUI::Asset->newByDynamicClass( $session, $collab->getId );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 36;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Permissions for collaboration systems
|
||||
# View
|
||||
$maker->prepare( {
|
||||
object => $collab,
|
||||
method => 'canView',
|
||||
pass => [ '1', $user{"2"}, '3', ],
|
||||
} )->run;
|
||||
|
||||
# Edit
|
||||
$maker->prepare( {
|
||||
object => $collab,
|
||||
method => 'canEdit',
|
||||
pass => [ '3', ],
|
||||
fail => [ '1', $user{"2"}, ],
|
||||
} )->run;
|
||||
|
||||
# Post
|
||||
$maker->prepare( {
|
||||
object => $collab,
|
||||
method => 'canPost',
|
||||
pass => [ $user{"2"}, '3', ],
|
||||
fail => [ '1', ],
|
||||
} )->run;
|
||||
|
||||
# Post Thread
|
||||
$maker->prepare( {
|
||||
object => $collab,
|
||||
method => 'canStartThread',
|
||||
pass => [ '3', ],
|
||||
fail => [ '1', $user{"2"}, ],
|
||||
} )->run;
|
||||
|
||||
# Subscribe
|
||||
$maker->prepare( {
|
||||
object => $collab,
|
||||
method => 'canSubscribe',
|
||||
pass => [ $user{"2"}, '3', ],
|
||||
fail => [ '1', ],
|
||||
} )->run;
|
||||
|
||||
# Moderate
|
||||
$maker->prepare( {
|
||||
object => $collab,
|
||||
method => 'canModerate',
|
||||
pass => [ '3', ],
|
||||
fail => [ '1', $user{"2"}, ],
|
||||
} )->run;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
END {
|
||||
for my $user ( values %user ) {
|
||||
$user->delete;
|
||||
}
|
||||
$versionTag->rollback;
|
||||
}
|
||||
|
|
@ -33,6 +33,9 @@ my %oldSettings;
|
|||
# userFunctionStyleId
|
||||
$oldSettings{ userFunctionStyleId } = $session->setting->get( 'userFunctionStyleId' );
|
||||
$session->setting->set( 'userFunctionStyleId', 'PBtmpl0000000000000132' );
|
||||
# specialState
|
||||
$oldSettings{ specialState } = $session->setting->get( 'specialState' );
|
||||
$session->setting->set( 'specialState', '' );
|
||||
|
||||
# Create a user for testing purposes
|
||||
my $user = WebGUI::User->new( $session, "new" );
|
||||
|
|
@ -62,6 +65,15 @@ $versionTags[-1]->commit;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
if ( !eval { require Test::WWW::Mechanize; 1; } ) {
|
||||
plan skip_all => 'Cannot load Test::WWW::Mechanize. Will not test.';
|
||||
}
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
$mech->get( $baseUrl );
|
||||
if ( !$mech->success ) {
|
||||
plan skip_all => "Cannot load URL '$baseUrl'. Will not test.";
|
||||
}
|
||||
|
||||
plan tests => 6; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ my %oldSettings;
|
|||
# userFunctionStyleId
|
||||
$oldSettings{ userFunctionStyleId } = $session->setting->get( 'userFunctionStyleId' );
|
||||
$session->setting->set( 'userFunctionStyleId', 'PBtmpl0000000000000132' );
|
||||
# specialState
|
||||
$oldSettings{ specialState } = $session->setting->get( 'specialState' );
|
||||
$session->setting->set( 'specialState', '' );
|
||||
|
||||
# Create a user for testing purposes
|
||||
my $USERNAME = 'dufresne';
|
||||
|
|
@ -72,9 +75,16 @@ my $assetUrl = $baseUrl . $asset->get('url');
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 41; # Increment this number for each test you create
|
||||
if ( !eval { require Test::WWW::Mechanize; 1; } ) {
|
||||
plan skip_all => 'Cannot load Test::WWW::Mechanize. Will not test.';
|
||||
}
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
$mech->get( $baseUrl );
|
||||
if ( !$mech->success ) {
|
||||
plan skip_all => "Cannot load URL '$baseUrl'. Will not test.";
|
||||
}
|
||||
|
||||
use_ok( 'Test::WWW::Mechanize' );
|
||||
plan tests => 40; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# no form: Test logging in on a normal page sends the user back to the same page
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ my %oldSettings;
|
|||
# userFunctionStyleId
|
||||
$oldSettings{ userFunctionStyleId } = $session->setting->get( 'userFunctionStyleId' );
|
||||
$session->setting->set( 'userFunctionStyleId', 'PBtmpl0000000000000132' );
|
||||
# specialState
|
||||
$oldSettings{ specialState } = $session->setting->get( 'specialState' );
|
||||
$session->setting->set( 'specialState', '' );
|
||||
|
||||
# Create a user for testing purposes
|
||||
my $user = WebGUI::User->new( $session, "new" );
|
||||
|
|
@ -62,9 +65,16 @@ my $baseUrl = 'http://' . $session->config->get('sitename')->[0];
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 1; # Increment this number for each test you create
|
||||
if ( !eval { require Test::WWW::Mechanize; 1; } ) {
|
||||
plan skip_all => 'Cannot load Test::WWW::Mechanize. Will not test.';
|
||||
}
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
$mech->get( $baseUrl );
|
||||
if ( !$mech->success ) {
|
||||
plan skip_all => "Cannot load URL '$baseUrl'. Will not test.";
|
||||
}
|
||||
|
||||
use_ok( 'Test::WWW::Mechanize' ) or BAIL_OUT( "Cannot continue without Test::WWW::Mechanize" );
|
||||
plan tests => 1; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# put your tests here
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue