File: 03schema.t

package info (click to toggle)
libnet-ldap-perl 1%3A0.4400-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,484 kB
  • sloc: perl: 13,645; sh: 16; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,142 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!perl -w
use Net::LDAP::Schema;

print "1..7\n";

my $schema = Net::LDAP::Schema->new( "data/schema.in" ) or die "Cannot open schema";
print "ok 1\n";

my @atts = $schema->all_attributes();
print "not " unless @atts == 55;
print "ok 2\n";

print "The schema contains ", scalar @atts, " attributes\n";

my @ocs = $schema->all_objectclasses();
print "not " unless @ocs == 22;
print "ok 3\n";
print "The schema contains ", scalar @ocs, " object classes\n";

@atts = $schema->must( "person" );
print "not " unless join(' ', sort map $_->{name}, @atts) eq join(' ',sort qw(cn sn objectClass));
print "ok 4\n";
print "The 'person' OC must have these attributes [",
		join( ",", map $_->{name}, @atts ),
		"]\n";
@atts = $schema->may( "mhsOrganizationalUser" );
print "not " if @atts;
print "ok 5\n";
print "The 'mhsOrganizationalUser' OC may have these attributes [",
		join( ",", map $_->{name}, @atts ),
		"]\n";

print "not " if defined $schema->attribute('distinguishedName')->{max_length};
print "ok 6\n";

print "not " unless $schema->attribute('userPassword')->{max_length} == 128;
print "ok 7\n";

use Data::Dumper;
print Dumper($schema);