1 |
dpavlin |
231 |
#!/usr/bin/env perl |
2 |
|
|
use warnings; |
3 |
|
|
use strict; |
4 |
|
|
|
5 |
|
|
=head1 DESCRIPTION |
6 |
|
|
|
7 |
|
|
A (very) basic test harness for the SearchLDAP action. |
8 |
|
|
|
9 |
|
|
=cut |
10 |
|
|
|
11 |
|
|
use Jifty::Test tests => 6; |
12 |
|
|
use Data::Dump qw/dump/; |
13 |
|
|
|
14 |
|
|
# Make sure we can load the action |
15 |
|
|
use_ok('A3C::Action::SearchLDAP'); |
16 |
|
|
|
17 |
|
|
my $action = Jifty::Test->web->new_action( |
18 |
|
|
class => 'SearchLDAP', |
19 |
|
|
# current_user => $system_user, |
20 |
|
|
arguments => { |
21 |
|
|
base => 'dc=skole,dc=hr', |
22 |
|
|
filter => 'objectClass=hrEduOrg', |
23 |
|
|
sizelimit => 3, |
24 |
|
|
} |
25 |
|
|
); |
26 |
|
|
|
27 |
|
|
isa_ok( $action, 'A3C::Action::SearchLDAP' ); |
28 |
|
|
|
29 |
|
|
$action->run; |
30 |
|
|
|
31 |
|
|
ok( $action->result->success, 'result is success' ); |
32 |
|
|
|
33 |
|
|
ok( my $search = $action->result->content( 'current_search' ), 'result content have current_search' ); |
34 |
|
|
|
35 |
|
|
isa_ok( $search, "Net::LDAP::Search" ); |
36 |
|
|
|
37 |
|
|
#diag dump( $search->entries ); |
38 |
|
|
|
39 |
|
|
cmp_ok( $search->entries, '==', 3, 'entries' ); |