1 |
dpavlin |
55 |
#!/usr/bin/env perl |
2 |
|
|
use warnings; |
3 |
|
|
use strict; |
4 |
|
|
|
5 |
|
|
=head1 DESCRIPTION |
6 |
|
|
|
7 |
|
|
A (very) basic test harness for the SyncOrganization action. |
8 |
|
|
|
9 |
|
|
=cut |
10 |
|
|
|
11 |
dpavlin |
106 |
use Jifty::Test tests => 9; |
12 |
dpavlin |
55 |
|
13 |
|
|
# Make sure we can load the action |
14 |
|
|
use_ok('A3C::Action::SyncOrganization'); |
15 |
dpavlin |
106 |
use_ok('A3C::LDAP'); |
16 |
dpavlin |
55 |
|
17 |
dpavlin |
106 |
ok(my $person_oc = A3C::LDAP->new->objectClass->{person}, 'LDAP.objectClass.person exist'); |
18 |
|
|
|
19 |
dpavlin |
55 |
my $sync = Jifty::Test->web->new_action( |
20 |
|
|
class => 'SyncOrganization', |
21 |
|
|
# current_user => $system_user, |
22 |
|
|
arguments => {} |
23 |
|
|
); |
24 |
|
|
|
25 |
|
|
isa_ok( $sync, 'A3C::Action::SyncOrganization' ); |
26 |
|
|
|
27 |
dpavlin |
106 |
ok( $sync->arguments->{org_uid}, 'org_uid' ); |
28 |
dpavlin |
55 |
|
29 |
dpavlin |
106 |
$sync->argument_values({ org_uid => 'os-test0604-zg' }); |
30 |
dpavlin |
55 |
$sync->run; |
31 |
|
|
|
32 |
|
|
ok( $sync->result->success, 'result is success' ); |
33 |
|
|
|
34 |
|
|
ok( my $coll = $sync->result->content( 'synced-users' ), 'result content have synced-users' ); |
35 |
|
|
|
36 |
dpavlin |
106 |
isa_ok( $coll, "A3C::Model::${person_oc}Collection" ); |
37 |
dpavlin |
55 |
|
38 |
|
|
cmp_ok( $coll->count, '>', 0, 'count' ); |