/[virtual-ldap]/t/ldap-rewrite.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-rewrite.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 82 - (hide annotations)
Wed Feb 24 18:07:12 2010 UTC (9 years, 11 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1055 byte(s)
use $entry->dump for much nicer output

1 dpavlin 71 #!/usr/bin/perl
2    
3     use warnings;
4     use strict;
5    
6 dpavlin 74 use Test::More tests => 9;
7 dpavlin 71 use Data::Dump qw(dump);
8    
9     BEGIN {
10     use_ok 'Net::LDAP';
11     }
12    
13     our $config;
14 dpavlin 72 ok( require( ( shift @ARGV || 't/config.pl' ) ), 'config.pl' );
15 dpavlin 71
16     sub ldap_check_error {
17     my $o = shift;
18     ok( ! $o->code, 'no errror' );
19     diag $o->error if $o->code;
20     }
21    
22     ok( my $ldap = Net::LDAP->new( $config->{server} ), 'new Net::LDAP ' . dump( $config->{server} ) );
23    
24     ok( my $bind = $ldap->bind( $config->{bind_as}, password => $config->{password} ), 'bind ' . $config->{bind_as} );
25     ldap_check_error $bind;
26    
27     ok( my $search = $ldap->search( %{ $config->{search} } ), 'search ' . dump( $config->{search} ) );
28     ldap_check_error $search;
29    
30     foreach my $entry ( $search->entries ) {
31 dpavlin 74
32 dpavlin 82 # diag dump $entry;
33     $entry->dump;
34 dpavlin 74
35     my $missing = 0;
36     my @required = @{ $config->{attributes_required} };
37     foreach my $attr ( @required ) {
38     next if grep { /^\Q$attr\E$/i } $entry->attributes;
39     $missing++;
40     diag "$missing missing $attr\n";
41     }
42    
43     ok( ! $missing, "attributes " . dump( @required ) );
44 dpavlin 71 }
45    
46     ok( $ldap->unbind, 'unbind' );

Properties

Name Value
svn:executable *
svn:mergeinfo

  ViewVC Help
Powered by ViewVC 1.1.26