projects
/
virtual-ldap
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7279da9
)
test all search filters generated by SAFEQ application
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 23 Feb 2010 01:28:09 +0000
(
01:28
+0000)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Tue, 23 Feb 2010 01:28:09 +0000
(
01:28
+0000)
t/ldap-koha.t
patch
|
blob
|
history
diff --git
a/t/ldap-koha.t
b/t/ldap-koha.t
index
7814ade
..
ddd856b
100755
(executable)
--- a/
t/ldap-koha.t
+++ b/
t/ldap-koha.t
@@
-3,7
+3,7
@@
use warnings;
use strict;
use warnings;
use strict;
-use Test::More tests =>
37
;
+use Test::More tests =>
75
;
use Data::Dump qw(dump);
BEGIN {
use Data::Dump qw(dump);
BEGIN {
@@
-21,11
+21,6
@@
ok( my $ldap = Net::LDAP->new( 'localhost:2389' ), 'new Net::LDAP' );
ok( my $bind = $ldap->bind, 'bind' );
ldap_check_error $bind;
ok( my $bind = $ldap->bind, 'bind' );
ldap_check_error $bind;
-my @test_searches = ( qw/
-uid=dpavlin@ffzg.hr
-pager=E00401001F77E218
-/ );
-
sub check_search_attributes {
my $search = shift;
sub check_search_attributes {
my $search = shift;
@@
-35,14
+30,28
@@
sub check_search_attributes {
}
}
}
}
-
foreach my $search ( @test_searches )
{
-
+
sub search
{
+ my ($ldap,$search) = @_;
ok( my $search = $ldap->search( filter => $search ), "search $search" );
ldap_check_error $search;
ok( $search->entries, 'have results' );
ok( my $search = $ldap->search( filter => $search ), "search $search" );
ldap_check_error $search;
ok( $search->entries, 'have results' );
- check_search_attributes $search => 'uid', 'mail', 'pager', 'memberOf';
+ return $search;
+}
+foreach my $search ( qw/
+uid=dpavlin@ffzg.hr
+pager=E00401001F77E218
+/ ) {
+ my $entries = search $ldap => $search;
+ check_search_attributes $entries => 'uid', 'mail', 'pager', 'memberOf';
+
+ $entries = search $ldap => "(&(objectclass=HrEduPerson)($search))";
+ check_search_attributes $entries => 'uid', 'mail', 'pager', 'memberOf';
}
}
+search $ldap => $_ foreach ( qw/
+objectclass=organizationalUnit
+objectclass=group
+/ );
ok( $ldap->unbind, 'unbind' );
ok( $ldap->unbind, 'unbind' );