Skip to content

Commit d76ff6e

Browse files
committedAug 30, 2011
Disable LDAP testing for the time being.
1 parent 61d7287 commit d76ff6e

File tree

3 files changed

+106
-77
lines changed

3 files changed

+106
-77
lines changed
 

‎t/Group.t

+1-75
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,6 @@ my @ipTests = (
7474
},
7575
);
7676

77-
my @ldapTests = (
78-
{
79-
dn => 'uid=Byron Hadley,o=shawshank',
80-
comment => 'bad dn for group',
81-
expect => 0,
82-
},
83-
{
84-
dn => 'uid=Andy Dufresne,o=shawshank',
85-
comment => 'good dn for group',
86-
expect => 1,
87-
},
88-
{
89-
dn => 'uid=Bogs Diamond,o=shawshank',
90-
comment => 'another good dn for group',
91-
expect => 1,
92-
},
93-
);
94-
95-
96-
plan tests => (173 + (scalar(@scratchTests) * 2) + scalar(@ipTests)); # increment this value for each test you create
9777

9878
my $session = WebGUI::Test->session;
9979
my $testCache = WebGUI::Cache->new($session, 'myTestKey');
@@ -180,61 +160,6 @@ my $getGroupsIn = $optionGroup->getGroupsIn();
180160
cmp_deeply($getGroupsIn, [], 'new: noAdmin prevents the admin group from being added to this group');
181161
$optionGroup->delete;
182162

183-
################################################################
184-
#
185-
# LDAP specific group properties
186-
# These tests have to be done on an isolated group that will NEVER
187-
# have getGroups called on it
188-
#
189-
################################################################
190-
191-
my $ldapProps = WebGUI::Test->getSmokeLDAPProps();
192-
$session->db->setRow('ldapLink', 'ldapLinkId', $ldapProps, $ldapProps->{ldapLinkId});
193-
my $ldap = WebGUI::LDAPLink->new($session, $ldapProps->{ldapLinkId});
194-
is($ldap->getValue("ldapLinkId"),$ldapProps->{ldapLinkId},'ldap link created properly');
195-
WebGUI::Test->addToCleanup($ldap);
196-
197-
my @shawshank;
198-
199-
foreach my $idx (0..$#ldapTests) {
200-
$shawshank[$idx] = WebGUI::User->new($session, "new");
201-
$shawshank[$idx]->username("shawshank$idx");
202-
$shawshank[$idx]->authMethod("LDAP");
203-
my $auth = $shawshank[$idx]->authInstance;
204-
$auth->saveParams($shawshank[$idx]->getId,$shawshank[$idx]->authMethod,{
205-
connectDN => $ldapTests[$idx]->{dn},
206-
ldapConnection => $ldap->getValue("ldapLinkId"),
207-
ldapUrl => $ldap->getValue("ldapUrl"),
208-
});
209-
}
210-
211-
WebGUI::Test->addToCleanup(@shawshank);
212-
213-
my $lGroup = WebGUI::Group->new($session, 'new');
214-
215-
$lGroup->ldapGroup('cn=Convicts,o=shawshank');
216-
is($lGroup->ldapGroup(), 'cn=Convicts,o=shawshank', 'ldapGroup set and fetched correctly');
217-
218-
$lGroup->ldapGroupProperty('member');
219-
is($lGroup->ldapGroupProperty(), 'member', 'ldapGroup set and fetched correctly');
220-
221-
$lGroup->ldapLinkId($ldapProps->{ldapLinkId});
222-
is($lGroup->ldapLinkId(),$ldapProps->{ldapLinkId}, 'ldapLinkId set and fetched correctly');
223-
224-
is_deeply(
225-
[ (map { $lGroup->hasLDAPUser($_->getId) } @shawshank) ],
226-
[0, 1, 1],
227-
'shawshank user 2, and 3 found in lGroup users from LDAP'
228-
);
229-
230-
$lGroup->ldapRecursiveProperty('LDAP recursive property');
231-
is($lGroup->ldapRecursiveProperty(), 'LDAP recursive property', 'ldapRecursiveProperty set and fetched correctly');
232-
233-
$lGroup->ldapRecursiveFilter('LDAP recursive filter');
234-
is($lGroup->ldapRecursiveFilter(), 'LDAP recursive filter', 'ldapRecursiveFilter set and fetched correctly');
235-
236-
$lGroup->delete;
237-
238163
my $gid = $g->getId;
239164
is (length($gid), 22, "GroupId is proper length");
240165

@@ -870,5 +795,6 @@ ok(
870795
"registered users: don't get the users in both groups",
871796
);
872797

798+
done_testing;
873799

874800
#vim:ft=perl

‎t/Group/ldap_groups.t

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#-------------------------------------------------------------------
2+
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
3+
#-------------------------------------------------------------------
4+
# Please read the legal notices (docs/legal.txt) and the license
5+
# (docs/license.txt) that came with this distribution before using
6+
# this software.
7+
#-------------------------------------------------------------------
8+
# http://www.plainblack.com info@plainblack.com
9+
#-------------------------------------------------------------------
10+
11+
use FindBin;
12+
use strict;
13+
use lib "$FindBin::Bin/../lib";
14+
15+
use WebGUI::Test;
16+
use WebGUI::Session;
17+
use WebGUI::Utility;
18+
19+
use WebGUI::User;
20+
use WebGUI::Group;
21+
use WebGUI::Cache;
22+
23+
use Test::More skip_all => 'Disabled until the test LDAP server is rejuvenated';
24+
use Test::Deep;
25+
26+
my @ldapTests = (
27+
{
28+
dn => 'uid=Byron Hadley,o=shawshank',
29+
comment => 'bad dn for group',
30+
expect => 0,
31+
},
32+
{
33+
dn => 'uid=Andy Dufresne,o=shawshank',
34+
comment => 'good dn for group',
35+
expect => 1,
36+
},
37+
{
38+
dn => 'uid=Bogs Diamond,o=shawshank',
39+
comment => 'another good dn for group',
40+
expect => 1,
41+
},
42+
);
43+
44+
45+
################################################################
46+
#
47+
# LDAP specific group properties
48+
# These tests have to be done on an isolated group that will NEVER
49+
# have getGroups called on it
50+
#
51+
################################################################
52+
53+
my $ldapProps = WebGUI::Test->getSmokeLDAPProps();
54+
$session->db->setRow('ldapLink', 'ldapLinkId', $ldapProps, $ldapProps->{ldapLinkId});
55+
my $ldap = WebGUI::LDAPLink->new($session, $ldapProps->{ldapLinkId});
56+
is($ldap->getValue("ldapLinkId"),$ldapProps->{ldapLinkId},'ldap link created properly');
57+
WebGUI::Test->addToCleanup($ldap);
58+
59+
my @shawshank;
60+
61+
foreach my $idx (0..$#ldapTests) {
62+
$shawshank[$idx] = WebGUI::User->new($session, "new");
63+
$shawshank[$idx]->username("shawshank$idx");
64+
$shawshank[$idx]->authMethod("LDAP");
65+
my $auth = $shawshank[$idx]->authInstance;
66+
$auth->saveParams($shawshank[$idx]->getId,$shawshank[$idx]->authMethod,{
67+
connectDN => $ldapTests[$idx]->{dn},
68+
ldapConnection => $ldap->getValue("ldapLinkId"),
69+
ldapUrl => $ldap->getValue("ldapUrl"),
70+
});
71+
}
72+
73+
WebGUI::Test->addToCleanup(@shawshank);
74+
75+
my $lGroup = WebGUI::Group->new($session, 'new');
76+
77+
$lGroup->ldapGroup('cn=Convicts,o=shawshank');
78+
is($lGroup->ldapGroup(), 'cn=Convicts,o=shawshank', 'ldapGroup set and fetched correctly');
79+
80+
$lGroup->ldapGroupProperty('member');
81+
is($lGroup->ldapGroupProperty(), 'member', 'ldapGroup set and fetched correctly');
82+
83+
$lGroup->ldapLinkId($ldapProps->{ldapLinkId});
84+
is($lGroup->ldapLinkId(),$ldapProps->{ldapLinkId}, 'ldapLinkId set and fetched correctly');
85+
86+
is_deeply(
87+
[ (map { $lGroup->hasLDAPUser($_->getId) } @shawshank) ],
88+
[0, 1, 1],
89+
'shawshank user 2, and 3 found in lGroup users from LDAP'
90+
);
91+
92+
$lGroup->ldapRecursiveProperty('LDAP recursive property');
93+
is($lGroup->ldapRecursiveProperty(), 'LDAP recursive property', 'ldapRecursiveProperty set and fetched correctly');
94+
95+
$lGroup->ldapRecursiveFilter('LDAP recursive filter');
96+
is($lGroup->ldapRecursiveFilter(), 'LDAP recursive filter', 'ldapRecursiveFilter set and fetched correctly');
97+
98+
$lGroup->delete;
99+
100+
done_testing;
101+

‎t/LDAPLink.t

+4-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ plan tests => 9; # Increment this number for each test you create
5252
#
5353
###########################################################################
5454

55-
{
55+
SKIP: {
56+
skip "Test LDAP server is down", 3;
5657
my $ldapProps = WebGUI::Test->getSmokeLDAPProps();
5758
$session->db->setRow('ldapLink', 'ldapLinkId', $ldapProps, $ldapProps->{ldapLinkId});
5859
my $ldap = WebGUI::LDAPLink->new($session, $ldapProps->{ldapLinkId});
@@ -70,7 +71,8 @@ plan tests => 9; # Increment this number for each test you create
7071
#
7172
###########################################################################
7273

73-
{
74+
SKIP: {
75+
skip "Test LDAP server is down", 4;
7476
my $ldapProps = WebGUI::Test->getSmokeLDAPProps();
7577
$ldapProps->{identifier} = 'hadley';
7678
$session->db->setRow('ldapLink', 'ldapLinkId', $ldapProps, $ldapProps->{ldapLinkId});

0 commit comments

Comments
 (0)
Please sign in to comment.