/[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

Annotation of /t/ldap-koha.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 75 - (hide annotations)
Tue Feb 23 01:03:22 2010 UTC (14 years, 1 month ago) by dpavlin
Original Path: t/ldap-koha.pl
File MIME type: text/plain
File size: 929 byte(s)
test Virtual LDAP implementation on top of Koha scheme

1 dpavlin 75 #!/usr/bin/perl
2    
3     use warnings;
4     use strict;
5    
6     use Test::More tests => 37;
7     use Data::Dump qw(dump);
8    
9     BEGIN {
10     use_ok 'Net::LDAP';
11     }
12    
13     sub ldap_check_error {
14     my $o = shift;
15     ok( ! $o->code, 'no errror' );
16     diag $o->error if $o->code;
17     }
18    
19     ok( my $ldap = Net::LDAP->new( 'localhost:2389' ), 'new Net::LDAP' );
20    
21     ok( my $bind = $ldap->bind, 'bind' );
22     ldap_check_error $bind;
23    
24     my @test_searches = ( qw/
25     uid=dpavlin@ffzg.hr
26     pager=E00401001F77E218
27     / );
28    
29     sub check_search_attributes {
30     my $search = shift;
31    
32     foreach my $entry ( $search->entries ) {
33     diag dump $entry;
34     map { ok( $_, "attribute $_" ) } grep { /^\Q$_\E$/i } $entry->attributes;
35     }
36     }
37    
38     foreach my $search ( @test_searches ) {
39    
40     ok( my $search = $ldap->search( filter => $search ), "search $search" );
41     ldap_check_error $search;
42     ok( $search->entries, 'have results' );
43     check_search_attributes $search => 'uid', 'mail', 'pager', 'memberOf';
44    
45     }
46    
47    
48     ok( $ldap->unbind, 'unbind' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26