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