From d76ff6ef339020d7796cde9e0c58348b08fbf1b8 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 30 Aug 2011 14:53:17 -0700 Subject: [PATCH] Disable LDAP testing for the time being. --- t/Group.t | 76 +------------------------------ t/Group/ldap_groups.t | 101 ++++++++++++++++++++++++++++++++++++++++++ t/LDAPLink.t | 6 ++- 3 files changed, 106 insertions(+), 77 deletions(-) create mode 100644 t/Group/ldap_groups.t diff --git a/t/Group.t b/t/Group.t index 332713912..2226e2fb6 100644 --- a/t/Group.t +++ b/t/Group.t @@ -74,26 +74,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; my $testCache = WebGUI::Cache->new($session, 'myTestKey'); @@ -180,61 +160,6 @@ my $getGroupsIn = $optionGroup->getGroupsIn(); cmp_deeply($getGroupsIn, [], 'new: noAdmin prevents the admin group from being added to this group'); $optionGroup->delete; -################################################################ -# -# 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; - my $gid = $g->getId; is (length($gid), 22, "GroupId is proper length"); @@ -870,5 +795,6 @@ ok( "registered users: don't get the users in both groups", ); +done_testing; #vim:ft=perl diff --git a/t/Group/ldap_groups.t b/t/Group/ldap_groups.t new file mode 100644 index 000000000..742b2d35e --- /dev/null +++ b/t/Group/ldap_groups.t @@ -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; + diff --git a/t/LDAPLink.t b/t/LDAPLink.t index bc243002d..bf1bd0c83 100644 --- a/t/LDAPLink.t +++ b/t/LDAPLink.t @@ -52,7 +52,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}); @@ -70,7 +71,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});