/[virtual-ldap]/t/ldap-koha.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /t/ldap-koha.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

t/ldap-koha.pl revision 75 by dpavlin, Tue Feb 23 01:03:22 2010 UTC t/ldap-koha.t revision 89 by dpavlin, Thu May 6 06:22:09 2010 UTC
# Line 3  Line 3 
3  use warnings;  use warnings;
4  use strict;  use strict;
5    
6  use Test::More tests => 37;  use Test::More tests => 76;
7  use Data::Dump qw(dump);  use Data::Dump qw(dump);
8    
9  BEGIN {  BEGIN {
10          use_ok 'Net::LDAP';          use_ok 'Net::LDAP';
11  }  }
12    
13    our $config;
14    ok( require( ( shift @ARGV || 't/config.pl' ) ), 'config.pl' );
15    
16    diag "config ",dump($config);
17    
18  sub ldap_check_error {  sub ldap_check_error {
19          my $o = shift;          my $o = shift;
20          ok( ! $o->code, 'no errror' );          ok( ! $o->code, 'no errror' );
# Line 21  ok( my $ldap = Net::LDAP->new( 'localhos Line 26  ok( my $ldap = Net::LDAP->new( 'localhos
26  ok( my $bind = $ldap->bind, 'bind' );  ok( my $bind = $ldap->bind, 'bind' );
27  ldap_check_error $bind;  ldap_check_error $bind;
28    
 my @test_searches = ( qw/  
 uid=dpavlin@ffzg.hr  
 pager=E00401001F77E218  
 / );  
   
29  sub check_search_attributes {  sub check_search_attributes {
30          my $search = shift;          my $search = shift;
31    
# Line 35  sub check_search_attributes { Line 35  sub check_search_attributes {
35          }          }
36  }  }
37    
38  foreach my $search ( @test_searches ) {  sub search {
39            my ($ldap,$search) = @_;
40            ok( my $result = $ldap->search( filter => $search ), "search $search" );
41            ldap_check_error $result;
42            ok( $result->entries, 'have results' );
43            return $result;
44    }
45    
46          ok( my $search = $ldap->search( filter => $search ), "search $search" );  foreach my $search ( qw/
47          ldap_check_error $search;  uid=dpavlin@ffzg.hr
48          ok( $search->entries, 'have results' );  pager=E00401001F77E218
49          check_search_attributes $search => 'uid', 'mail', 'pager', 'memberOf';  / ) {
50            my $entries = search $ldap => $search;
51            check_search_attributes $entries => 'uid', 'mail', 'pager', 'memberOf';
52    
53            $entries = search $ldap => "(&(objectclass=HrEduPerson)($search))";
54            check_search_attributes $entries => 'uid', 'mail', 'pager', 'memberOf';
55  }  }
56    
57    search $ldap => $_ foreach ( qw/
58    objectclass=organizationalUnit
59    objectclass=group
60    / );
61    
62  ok( $ldap->unbind, 'unbind' );  ok( $ldap->unbind, 'unbind' );

Legend:
Removed from v.75  
changed lines
  Added in v.89

  ViewVC Help
Powered by ViewVC 1.1.26