Merge commit 'v7.10.23' into WebGUI8. Tests need fixing.
This commit is contained in:
commit
a2a821822d
72 changed files with 578 additions and 132 deletions
|
|
@ -162,9 +162,6 @@ $storage->addFileFromFilesystem(WebGUI::Test->getTestCollateralPath('lamp.jpg'))
|
|||
$storage->addFileFromFilesystem(WebGUI::Test->getTestCollateralPath('littleTextFile'));
|
||||
my $attachment_loop = $post1->getTemplateVars()->{attachment_loop};
|
||||
|
||||
use Data::Dumper;
|
||||
diag Dumper($attachment_loop);
|
||||
|
||||
my @extensions = map { [ $_->{filename}, $_->{extension} ] } @{ $attachment_loop };
|
||||
|
||||
cmp_bag(
|
||||
|
|
|
|||
|
|
@ -16,8 +16,9 @@ use lib "$FindBin::Bin/../../lib";
|
|||
use Test::MockTime qw/:all/; ##Must be loaded before all other code
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use Test::More tests => 3; # increment this value for each test you create
|
||||
use Test::More tests => 5; # increment this value for each test you create
|
||||
use WebGUI::Asset::Wobject::Layout;
|
||||
use WebGUI::Asset::Template;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
@ -64,4 +65,25 @@ set_relative_time(-100);
|
|||
$snip1 = $snip1->addRevision({ title => 'titular', }, 18);
|
||||
is $page->getContentLastModifiedBy, $revised_user1->userId, '... check that a new revision tracks';
|
||||
|
||||
# inheriting mobileStyleTemplateId and mobileTemplateId; from ``Mobile template is not being inherited (#12246)''
|
||||
|
||||
my $importNode = WebGUI::Asset::Template->getImportNode($session);
|
||||
my $template1 = $importNode->addChild({className=>"WebGUI::Asset::Template"});
|
||||
my $template2 = $importNode->addChild({className=>"WebGUI::Asset::Template"});
|
||||
WebGUI::Test->addToCleanup($template1, $template2);
|
||||
|
||||
my $mobileStyleTemplateId = $template1->getId;
|
||||
my $mobileTemplateId = $template2->getId;
|
||||
$page->update({ mobileStyleTemplateId => $mobileStyleTemplateId, mobileTemplateId => $mobileTemplateId });
|
||||
my $url = $page->get('url') . '/layout_child_test';
|
||||
my $html = WebGUI::Test->getPage($page, "www_add", {
|
||||
userId => 3,
|
||||
formParams => {
|
||||
class => 'WebGUI::Asset::Wobject::Layout',
|
||||
url => $page->get('url') . '/layout_child_test',
|
||||
},
|
||||
});
|
||||
|
||||
like $html, qr/name="mobileTemplateId" value="$mobileTemplateId"/, 'child PageLayout inherited parents mobileTempaleId';
|
||||
like $html, qr/name="mobileStyleTemplateId" value="$mobileStyleTemplateId"/, 'child PageLayout inherited parents mobileStyleTempaleId';
|
||||
|
||||
|
|
|
|||
|
|
@ -75,12 +75,12 @@ is $session->db->quickScalar('select count(*) from assetIndex where assetId=?',[
|
|||
|
||||
my $record;
|
||||
|
||||
$record = $session->db->quickHashRef('select * from assetIndex where assetId=?',[$thingy->getId]);
|
||||
$record = $session->db->quickHashRef('select * from assetIndex where assetId=? AND subId IS NOT NULL',[$thingy->getId]);
|
||||
cmp_deeply(
|
||||
$record,
|
||||
superhashof({
|
||||
subId => 'THING_RECORD',
|
||||
url => $thingy->getUrl('func=search;thingId=THING_RECORD'),
|
||||
url => $session->url->append($thingy->get('url'), 'func=search;thingId=THING_RECORD'),
|
||||
title => 'Label',
|
||||
groupIdView => 2,
|
||||
keywords => all(
|
||||
|
|
@ -165,7 +165,7 @@ cmp_deeply(
|
|||
score => ignore(),
|
||||
synopsis => ignore(),
|
||||
title => 'Label', ##From the Thing's label
|
||||
url => $thingy->getUrl('func=viewThingData;thingId='.$thingId.';thingDataId=THING_DATA'),
|
||||
url => $session->url->append($thingy->get('url'), 'func=viewThingData;thingId='.$thingId.';thingDataId=THING_DATA'),
|
||||
}
|
||||
],
|
||||
'Checking indexed data for the thingData'
|
||||
|
|
@ -214,7 +214,7 @@ cmp_deeply(
|
|||
score => ignore(),
|
||||
synopsis => ignore(),
|
||||
title => '8/16/2001', ##From viewScreenTitle, which is $birthday in user's preferred date format
|
||||
url => $thingy->getUrl('func=viewThingData;thingId='.$thingId.';thingDataId=THING_DATA'),
|
||||
url => $session->url->append($thingy->get('url'), 'func=viewThingData;thingId='.$thingId.';thingDataId=THING_DATA'),
|
||||
}
|
||||
],
|
||||
'Checking indexed data for the thingData'
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ use WebGUI::Session;
|
|||
use Test::Deep;
|
||||
use Scope::Guard;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
#plan tests => 9; # Increment this number for each test you create
|
||||
plan skip_all => 'Test server for LDAP down'; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
|
|
@ -41,11 +47,6 @@ $ldapGroup->set( "ldapGroupProperty", "member" );
|
|||
$ldapGroup->set( "ldapRecursiveProperty", "uid" );
|
||||
WebGUI::Test->addToCleanup($ldapGroup);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 9; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test Login of existing user
|
||||
my $user = WebGUI::User->create( $session );
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ my ($redirect, $response, $url);
|
|||
# Get the site's base URL
|
||||
my $baseUrl = 'http://localhost/';
|
||||
|
||||
my $httpAuthUrl = 'http://' . $USERNAME . ':' . $IDENTIFIER . '@' . $session->config->get('sitename')->[0];
|
||||
# $httpAuthUrl .= ':8000'; # no easy way to automatically find this
|
||||
$httpAuthUrl .= $session->config->get('gateway');
|
||||
|
||||
# Make an asset we can login on
|
||||
my $tag = WebGUI::VersionTag->getWorking($session);
|
||||
my $node = WebGUI::Test->asset;
|
||||
|
|
@ -74,7 +78,6 @@ my $asset = $asset->cloneFromDb;
|
|||
# Tests
|
||||
|
||||
my $mech = WebGUI::Test::Mechanize->new( config => WebGUI::Test->config );
|
||||
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
|
||||
|
|
@ -263,3 +266,12 @@ $mech->submit_form_ok(
|
|||
);
|
||||
$mech->base_is( $assetUrl, "We don't get redirected" );
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# HTTP basic auth
|
||||
$mech = Test::WWW::Mechanize->new;
|
||||
$mech->get( $httpAuthUrl );
|
||||
$mech->content_contains( "Hello, $USERNAME", "We are greeted by name" );
|
||||
$mech->get( $httpAuthUrl . $asset->get('url') );
|
||||
$mech->content_contains( "ARTICLE", "We are shown the article" );
|
||||
|
||||
done_testing;
|
||||
|
|
|
|||
47
t/Group.t
47
t/Group.t
|
|
@ -70,26 +70,6 @@ my @ipTests = (
|
|||
},
|
||||
);
|
||||
|
||||
my @ldapTests = (
|
||||
{
|
||||
dn => 'uid=Byron Hadley,o=shawshank',
|
||||
comment => 'bad dn for group',
|
||||
expect => 0,
|
||||
},
|
||||
{
|
||||
dn => 'uid=Andy Dufresne,o=shawshank',
|
||||
comment => 'good dn for group',
|
||||
expect => 1,
|
||||
},
|
||||
{
|
||||
dn => 'uid=Bogs Diamond,o=shawshank',
|
||||
comment => 'another good dn for group',
|
||||
expect => 1,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
plan tests => (173 + (scalar(@scratchTests) * 2) + scalar(@ipTests)); # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
$session->cache->remove('myTestKey');
|
||||
|
|
@ -633,14 +613,16 @@ WebGUI::Test->addToCleanup(@sessionBank);
|
|||
|
||||
#isInGroup test
|
||||
foreach my $scratchTest (@scratchTests) {
|
||||
is($scratchTest->{user}->isInGroup($gS->getId), $scratchTest->{expect}, $scratchTest->{comment});
|
||||
is($scratchTest->{user}->isInGroup($gS->getId), $scratchTest->{expect}, $scratchTest->{comment});
|
||||
}
|
||||
|
||||
$session->cache->remove("isInGroup");
|
||||
|
||||
#hasScratchUser test
|
||||
foreach my $scratchTest (@scratchTests) {
|
||||
is($gS->hasScratchUser($scratchTest->{user}->getId), $scratchTest->{expect}, $scratchTest->{comment}." - hasScratchUser");
|
||||
foreach my $idx (0..$#scratchTests) {
|
||||
my $scratchTest = $scratchTests[$idx];
|
||||
my $sessionId = $sessionBank[$idx]->getId;
|
||||
is($gS->hasScratchUser($scratchTest->{user}->getId, $sessionId), $scratchTest->{expect}, $scratchTest->{comment}." - hasScratchUser");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -658,7 +640,7 @@ cmp_bag(
|
|||
|
||||
{ ##Add scope to force cleanup
|
||||
|
||||
note "Checking for user Visitor session leak";
|
||||
note "Checking for user Visitor session leak with scratch";
|
||||
|
||||
my $remoteSession = WebGUI::Test->newSession;
|
||||
$remoteSession->user({userId => 1});
|
||||
|
|
@ -673,13 +655,13 @@ cmp_bag(
|
|||
my $localSession = WebGUI::Test->newSession;
|
||||
WebGUI::Test->addToCleanup($localScratchGroup, $remoteSession, $localSession);
|
||||
$localSession->user({userId => 1});
|
||||
$remoteSession->scratch->set('local','ok');
|
||||
$localSession->scratch->set('local','ok');
|
||||
$localScratchGroup->clearCaches;
|
||||
|
||||
ok $localSession->user->isInGroup($localScratchGroup->getId), 'Local Visitor is in the scratch group';
|
||||
|
||||
$remoteSession->stow->delete('isInGroup');
|
||||
ok !$remoteSession->user->isInGroup($localScratchGroup->getId), 'Remove Visitor is not in the scratch group, even though a different Visitor passed';
|
||||
ok !$remoteSession->user->isInGroup($localScratchGroup->getId), 'Remote Visitor is not in the scratch group, even though a different Visitor passed';
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -702,8 +684,9 @@ foreach my $idx (0..$#ipTests) {
|
|||
##Name this user for convenience
|
||||
$tcps[$idx]->username("tcp$idx");
|
||||
|
||||
##Assign this user to this test to be fetched later
|
||||
$ipTests[$idx]->{user} = $tcps[$idx];
|
||||
##Assign this user and session to this test to be fetched later
|
||||
$ipTests[$idx]->{user} = $tcps[$idx];
|
||||
$ipTests[$idx]->{session} = $sessionBank[$idx];
|
||||
}
|
||||
WebGUI::Test->addToCleanup(@tcps);
|
||||
|
||||
|
|
@ -725,7 +708,7 @@ cmp_bag(
|
|||
);
|
||||
|
||||
is_deeply(
|
||||
[ (map { $gI->hasIpUser($_->{user}->getId) } @ipTests) ],
|
||||
[ (map { $gI->hasIpUser($_->{user}->getId, $_->{session}->getId) } @ipTests) ],
|
||||
[ (map { $_->{expect} } @ipTests) ],
|
||||
'hasIpUsers for group with IP filter'
|
||||
);
|
||||
|
|
@ -736,7 +719,7 @@ foreach my $ipTest (@ipTests) {
|
|||
|
||||
{ ##Add scope to force cleanup
|
||||
|
||||
note "Checking for user Visitor session leak";
|
||||
note "Checking for user Visitor session leak via IP address";
|
||||
|
||||
my $remoteSession = WebGUI::Test->newSession;
|
||||
$remoteSession->request->env->{REMOTE_ADDR} = '191.168.1.1';
|
||||
|
|
@ -757,7 +740,8 @@ foreach my $ipTest (@ipTests) {
|
|||
ok $localSession->user->isInGroup($localIpGroup->getId), 'Local Visitor is in the group';
|
||||
|
||||
$remoteSession->stow->delete('isInGroup');
|
||||
ok !$remoteSession->user->isInGroup($localIpGroup->getId), 'Remove Visitor is not in the group, even though a different Visitor passed';
|
||||
$localIpGroup->clearCaches;
|
||||
ok !$remoteSession->user->isInGroup($localIpGroup->getId), 'Remote Visitor is not in the group, even though a different Visitor passed';
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -858,5 +842,6 @@ ok(
|
|||
"registered users: don't get the users in both groups",
|
||||
);
|
||||
|
||||
done_testing;
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
|
|
@ -20,27 +20,49 @@ use WebGUI::Group;
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $session1 = WebGUI::Test->session;
|
||||
my $session2 = WebGUI::Session->open(WebGUI::Test::root, WebGUI::Test::file);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
### Updates by DRT test that group membership is restricted by user session
|
||||
### ...specifically for Visitors to have separate scratch group memberships
|
||||
|
||||
plan tests => 5; # Increment this number for each test you create
|
||||
plan tests => 14; # Increment this number for each test you create
|
||||
|
||||
my $group = WebGUI::Group->new($session, 'new');
|
||||
my $group = WebGUI::Group->new($session1, 'new');
|
||||
WebGUI::Test->addToCleanup($group);
|
||||
$group->scratchFilter("itchy=test_value");
|
||||
is( $group->scratchFilter(), "itchy=test_value",'Group->scratchFilter is properly set and retrieved');
|
||||
$group->groupCacheTimeout(0);
|
||||
is( $group->groupCacheTimeout(), 0, 'set groupCacheTimeout to 0');
|
||||
|
||||
$session->user({userId => 1});
|
||||
ok( !$session->user->isInGroup($group->getId), 'Visitor is NOT in the group BEFORE scratch value is set');
|
||||
$session->scratch->set('itchy', 'test_value');
|
||||
is ($group->hasScratchUser($session->user->getId), 1, 'Group->hasScratchUser correctly returns 1 immediately after scratch is set');
|
||||
$session1->user({userId => 1});
|
||||
$session2->user({userId => 1});
|
||||
|
||||
##Simulate another page view by clearing stow, which is volatile
|
||||
$session->stow->deleteAll;
|
||||
$session->scratch->delete('itchy');
|
||||
is ($group->hasScratchUser($session->user->getId), 0, 'after clearing scratch, user is not in the group any longer');
|
||||
### Test group membership before scratch is set
|
||||
### NOTE: test hasScratchUser first, because isInGroup sets stow & cache
|
||||
is ($group->hasScratchUser($session1->user->getId,$session1->user->session->getId), 0, 'Group->hasScratchUser correctly returns 0 for Visitor 1 before scratch is set');
|
||||
is ($group->hasScratchUser($session2->user->getId,$session2->user->session->getId), 0, 'Group->hasScratchUser correctly returns 0 for Visitor 2 before scratch is set');
|
||||
ok( !$session1->user->isInGroup($group->getId), 'user1->isInGroup correctly returns 0 before scratch is set');
|
||||
ok( !$session2->user->isInGroup($group->getId), 'user2->isInGroup correctly returns 0 before scratch is set');
|
||||
|
||||
### Test group membership after scratch is set
|
||||
### Clear stow, which is volatile, to simulate new page view
|
||||
$session1->stow->deleteAll;
|
||||
$session2->stow->deleteAll;
|
||||
$session1->scratch->set('itchy', 'test_value');
|
||||
is ($group->hasScratchUser($session1->user->getId,$session1->user->session->getId), 1, 'Group->hasScratchUser correctly returns 1 for Visitor 1 after scratch for Visitor 1 is set');
|
||||
is ($group->hasScratchUser($session2->user->getId,$session2->user->session->getId), 0, 'Group->hasScratchUser correctly returns 0 for Visitor 2 after scratch for Visitor 1 is set');
|
||||
ok( $session1->user->isInGroup($group->getId), 'user1->isInGroup correctly returns 1 after scratch for Visitor 1 is set');
|
||||
ok( !$session2->user->isInGroup($group->getId), 'user2->isInGroup correctly returns 0 after scratch for Visitor 1 is set');
|
||||
|
||||
### Test group membership after scratch is deleted
|
||||
### Clear stow, which is volatile, to simulate new page view
|
||||
$session1->stow->deleteAll;
|
||||
$session2->stow->deleteAll;
|
||||
$session1->scratch->delete('itchy');
|
||||
is ($group->hasScratchUser($session1->user->getId,$session1->user->session->getId), 0, 'Group->hasScratchUser for Visitor 1 correctly returns 0 after clearing scratch for Visitor 1');
|
||||
is ($group->hasScratchUser($session2->user->getId,$session2->user->session->getId), 0, 'Group->hasScratchUser for Visitor 2 correctly returns 0 after clearing scratch for Visitor 1');
|
||||
ok( !$session1->user->isInGroup($group->getId), 'user1->isInGroup correctly returns 0 after scratch for Visitor 1 is deleted');
|
||||
ok( !$session2->user->isInGroup($group->getId), 'user2->isInGroup correctly returns 0 after scratch for Visitor 1 is deleted');
|
||||
|
|
|
|||
101
t/Group/ldap_groups.t
Normal file
101
t/Group/ldap_groups.t
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use FindBin;
|
||||
use strict;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Utility;
|
||||
|
||||
use WebGUI::User;
|
||||
use WebGUI::Group;
|
||||
use WebGUI::Cache;
|
||||
|
||||
use Test::More skip_all => 'Disabled until the test LDAP server is rejuvenated';
|
||||
use Test::Deep;
|
||||
|
||||
my @ldapTests = (
|
||||
{
|
||||
dn => 'uid=Byron Hadley,o=shawshank',
|
||||
comment => 'bad dn for group',
|
||||
expect => 0,
|
||||
},
|
||||
{
|
||||
dn => 'uid=Andy Dufresne,o=shawshank',
|
||||
comment => 'good dn for group',
|
||||
expect => 1,
|
||||
},
|
||||
{
|
||||
dn => 'uid=Bogs Diamond,o=shawshank',
|
||||
comment => 'another good dn for group',
|
||||
expect => 1,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
################################################################
|
||||
#
|
||||
# LDAP specific group properties
|
||||
# These tests have to be done on an isolated group that will NEVER
|
||||
# have getGroups called on it
|
||||
#
|
||||
################################################################
|
||||
|
||||
my $ldapProps = WebGUI::Test->getSmokeLDAPProps();
|
||||
$session->db->setRow('ldapLink', 'ldapLinkId', $ldapProps, $ldapProps->{ldapLinkId});
|
||||
my $ldap = WebGUI::LDAPLink->new($session, $ldapProps->{ldapLinkId});
|
||||
is($ldap->getValue("ldapLinkId"),$ldapProps->{ldapLinkId},'ldap link created properly');
|
||||
WebGUI::Test->addToCleanup($ldap);
|
||||
|
||||
my @shawshank;
|
||||
|
||||
foreach my $idx (0..$#ldapTests) {
|
||||
$shawshank[$idx] = WebGUI::User->new($session, "new");
|
||||
$shawshank[$idx]->username("shawshank$idx");
|
||||
$shawshank[$idx]->authMethod("LDAP");
|
||||
my $auth = $shawshank[$idx]->authInstance;
|
||||
$auth->saveParams($shawshank[$idx]->getId,$shawshank[$idx]->authMethod,{
|
||||
connectDN => $ldapTests[$idx]->{dn},
|
||||
ldapConnection => $ldap->getValue("ldapLinkId"),
|
||||
ldapUrl => $ldap->getValue("ldapUrl"),
|
||||
});
|
||||
}
|
||||
|
||||
WebGUI::Test->addToCleanup(@shawshank);
|
||||
|
||||
my $lGroup = WebGUI::Group->new($session, 'new');
|
||||
|
||||
$lGroup->ldapGroup('cn=Convicts,o=shawshank');
|
||||
is($lGroup->ldapGroup(), 'cn=Convicts,o=shawshank', 'ldapGroup set and fetched correctly');
|
||||
|
||||
$lGroup->ldapGroupProperty('member');
|
||||
is($lGroup->ldapGroupProperty(), 'member', 'ldapGroup set and fetched correctly');
|
||||
|
||||
$lGroup->ldapLinkId($ldapProps->{ldapLinkId});
|
||||
is($lGroup->ldapLinkId(),$ldapProps->{ldapLinkId}, 'ldapLinkId set and fetched correctly');
|
||||
|
||||
is_deeply(
|
||||
[ (map { $lGroup->hasLDAPUser($_->getId) } @shawshank) ],
|
||||
[0, 1, 1],
|
||||
'shawshank user 2, and 3 found in lGroup users from LDAP'
|
||||
);
|
||||
|
||||
$lGroup->ldapRecursiveProperty('LDAP recursive property');
|
||||
is($lGroup->ldapRecursiveProperty(), 'LDAP recursive property', 'ldapRecursiveProperty set and fetched correctly');
|
||||
|
||||
$lGroup->ldapRecursiveFilter('LDAP recursive filter');
|
||||
is($lGroup->ldapRecursiveFilter(), 'LDAP recursive filter', 'ldapRecursiveFilter set and fetched correctly');
|
||||
|
||||
$lGroup->delete;
|
||||
|
||||
done_testing;
|
||||
|
||||
|
|
@ -50,7 +50,8 @@ plan tests => 9; # Increment this number for each test you create
|
|||
#
|
||||
###########################################################################
|
||||
|
||||
{
|
||||
SKIP: {
|
||||
skip "Test LDAP server is down", 3;
|
||||
my $ldapProps = WebGUI::Test->getSmokeLDAPProps();
|
||||
$session->db->setRow('ldapLink', 'ldapLinkId', $ldapProps, $ldapProps->{ldapLinkId});
|
||||
my $ldap = WebGUI::LDAPLink->new($session, $ldapProps->{ldapLinkId});
|
||||
|
|
@ -68,7 +69,8 @@ plan tests => 9; # Increment this number for each test you create
|
|||
#
|
||||
###########################################################################
|
||||
|
||||
{
|
||||
SKIP: {
|
||||
skip "Test LDAP server is down", 4;
|
||||
my $ldapProps = WebGUI::Test->getSmokeLDAPProps();
|
||||
$ldapProps->{identifier} = 'hadley';
|
||||
$session->db->setRow('ldapLink', 'ldapLinkId', $ldapProps, $ldapProps->{ldapLinkId});
|
||||
|
|
|
|||
1
t/SQL.t
1
t/SQL.t
|
|
@ -224,6 +224,7 @@ SKIP: {
|
|||
|
||||
}
|
||||
|
||||
$session->db->dbh->do('DROP TABLE IF EXISTS testTable');
|
||||
$session->db->dbh->do('CREATE TABLE testTable (myIndex int(8) NOT NULL default 0, message CHAR(64), myKey varchar(32), PRIMARY KEY(myIndex))');
|
||||
|
||||
my @tableData = (
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ use Kwargs;
|
|||
use URI;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
WebGUI::Test->originalConfig('templateParsers');
|
||||
$session->config->addToArray('templateParsers', 'WebGUI::Asset::Template::TemplateToolkit');
|
||||
|
||||
my $act = WebGUI::Workflow::Activity->newByPropertyHashRef(
|
||||
$session, {
|
||||
|
|
|
|||
58
t/templateAttachments.t
Normal file
58
t/templateAttachments.t
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#-------------------------------------------------------------------
|
||||
# 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
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use FindBin;
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib "$FindBin::Bin/lib"; ##t/lib
|
||||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use Data::Dumper;
|
||||
use WebGUI::Asset;
|
||||
use WebGUI::Asset::Template;
|
||||
use WebGUI::Macro;
|
||||
|
||||
#The goal of this test is to find template attachments that do not resolve.
|
||||
|
||||
use Test::More; # increment this value for each test you create
|
||||
my $numTests = 0;
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
# put your tests here
|
||||
|
||||
$numTests = $session->db->quickScalar('select count(distinct(assetId)) from template');
|
||||
|
||||
my $getATemplate = WebGUI::Asset::Template->getIsa($session);
|
||||
|
||||
WebGUI::Test->originalConfig('extrasURL');
|
||||
$session->config->set('extrasURL', '');
|
||||
|
||||
TEMPLATE: while (my $templateAsset = $getATemplate->()) {
|
||||
my $bad_attachments = 0;
|
||||
foreach my $attachment (@{ $templateAsset->getAttachments }) {
|
||||
my $url = $attachment->{url};
|
||||
WebGUI::Macro::process($session, \$url);
|
||||
my $url_exists = 0;
|
||||
if ($attachment->{url} =~ /\^Extras/) {
|
||||
##File system path for /extras, adjust the URL for that.
|
||||
$url = $session->config->get('extrasPath') . $url;
|
||||
$url_exists = -e $url;
|
||||
}
|
||||
else {
|
||||
my $asset = eval { WebGUI::Asset->newByUrl($session, $url) };
|
||||
$url_exists = defined $asset;
|
||||
}
|
||||
ok $url_exists, sprintf "%s: %s (%s) has a bad attachment url: %s", $templateAsset->getTitle, $templateAsset->getId, $templateAsset->getUrl, $attachment->{url};
|
||||
}
|
||||
}
|
||||
|
||||
done_testing;
|
||||
Loading…
Add table
Add a link
Reference in a new issue