3 |
use warnings; |
use warnings; |
4 |
use strict; |
use strict; |
5 |
|
|
6 |
use Test::More tests => 37; |
use Test::More tests => 75; |
7 |
use Data::Dump qw(dump); |
use Data::Dump qw(dump); |
8 |
|
|
9 |
BEGIN { |
BEGIN { |
21 |
ok( my $bind = $ldap->bind, 'bind' ); |
ok( my $bind = $ldap->bind, 'bind' ); |
22 |
ldap_check_error $bind; |
ldap_check_error $bind; |
23 |
|
|
|
my @test_searches = ( qw/ |
|
|
uid=dpavlin@ffzg.hr |
|
|
pager=E00401001F77E218 |
|
|
/ ); |
|
|
|
|
24 |
sub check_search_attributes { |
sub check_search_attributes { |
25 |
my $search = shift; |
my $search = shift; |
26 |
|
|
30 |
} |
} |
31 |
} |
} |
32 |
|
|
33 |
foreach my $search ( @test_searches ) { |
sub search { |
34 |
|
my ($ldap,$search) = @_; |
35 |
ok( my $search = $ldap->search( filter => $search ), "search $search" ); |
ok( my $search = $ldap->search( filter => $search ), "search $search" ); |
36 |
ldap_check_error $search; |
ldap_check_error $search; |
37 |
ok( $search->entries, 'have results' ); |
ok( $search->entries, 'have results' ); |
38 |
check_search_attributes $search => 'uid', 'mail', 'pager', 'memberOf'; |
return $search; |
39 |
|
} |
40 |
|
|
41 |
|
foreach my $search ( qw/ |
42 |
|
uid=dpavlin@ffzg.hr |
43 |
|
pager=E00401001F77E218 |
44 |
|
/ ) { |
45 |
|
my $entries = search $ldap => $search; |
46 |
|
check_search_attributes $entries => 'uid', 'mail', 'pager', 'memberOf'; |
47 |
|
|
48 |
|
$entries = search $ldap => "(&(objectclass=HrEduPerson)($search))"; |
49 |
|
check_search_attributes $entries => 'uid', 'mail', 'pager', 'memberOf'; |
50 |
} |
} |
51 |
|
|
52 |
|
search $ldap => $_ foreach ( qw/ |
53 |
|
objectclass=organizationalUnit |
54 |
|
objectclass=group |
55 |
|
/ ); |
56 |
|
|
57 |
ok( $ldap->unbind, 'unbind' ); |
ok( $ldap->unbind, 'unbind' ); |