8 |
|
|
9 |
=cut |
=cut |
10 |
|
|
11 |
use Jifty::Test tests => 16; |
use Jifty::Test tests => 29; |
12 |
|
use Data::Dump qw/dump/; |
13 |
|
|
14 |
use_ok('A3C::LDAP'); |
use_ok('A3C::LDAP'); |
15 |
|
|
17 |
|
|
18 |
isa_ok( $ldap, 'A3C::LDAP' ); |
isa_ok( $ldap, 'A3C::LDAP' ); |
19 |
|
|
20 |
|
isa_ok( $ldap->objectClass, 'HASH', 'have objectClass' ); |
21 |
|
isa_ok( $ldap->link, 'HASH', 'have link' ); |
22 |
|
|
23 |
|
diag "objectClass = ",dump( $ldap->objectClass ); |
24 |
|
diag "link = ",dump( $ldap->link ); |
25 |
|
|
26 |
ok( |
ok( |
27 |
$ldap->search( |
$ldap->search( |
28 |
base => 'dc=skole,dc=hr', |
base => 'dc=skole,dc=hr', |
29 |
filter => '(objectClass=hrEduOrg)', |
filter => '(objectClass=hrEduOrg)', |
30 |
|
sizelimit => 10, |
31 |
) |
) |
32 |
), 'search'; |
), 'search'; |
33 |
|
|
34 |
isa_ok( $ldap, 'A3C::LDAP' ); |
isa_ok( $ldap, 'A3C::LDAP' ); |
35 |
|
|
36 |
cmp_ok( $ldap->count, '>', 1000, 'count' ); |
cmp_ok( $ldap->count, '==', 10, 'count' ); |
37 |
|
|
38 |
foreach my $i ( 1 .. 10 ) { |
foreach my $i ( 1 .. 10 ) { |
39 |
ok( my $entry = $ldap->next, "next $i" ); |
ok( my $entry = $ldap->next, "next $i" ); |
40 |
# $entry->dump; |
# $entry->dump; |
41 |
} |
} |
42 |
|
|
43 |
|
foreach my $limit ( 3, 7, 14 ) { |
44 |
|
ok( my $collection = $ldap->collection('Organization', limit => $limit), "collection Organization limit = $limit" ); |
45 |
|
isa_ok( $collection, 'A3C::Model::OrganizationCollection' ); |
46 |
|
is( $collection->count, $limit, 'count' ); |
47 |
|
} |
48 |
|
|
49 |
|
ok( my $coll = $ldap->collection('Person', filter => '(HrEduPersonHomeOrg=aa-test-zz)'), 'collection with filter' ); |
50 |
|
is( $coll->count, 0, 'no results' ); |