1 |
dpavlin |
161 |
#!/usr/bin/env perl |
2 |
|
|
use warnings; |
3 |
|
|
use strict; |
4 |
|
|
|
5 |
|
|
=head1 DESCRIPTION |
6 |
|
|
|
7 |
|
|
A (very) basic test harness for the StrixSQL action. |
8 |
|
|
|
9 |
|
|
=cut |
10 |
|
|
|
11 |
|
|
use Jifty::Test tests => 10; |
12 |
|
|
|
13 |
|
|
# Make sure we can load the action |
14 |
|
|
use_ok('A3C::Action::StrixSQL'); |
15 |
|
|
|
16 |
|
|
my $action = Jifty::Test->web->new_action( |
17 |
|
|
class => 'StrixSQL', |
18 |
|
|
# current_user => $system_user, |
19 |
|
|
# arguments => {} |
20 |
|
|
); |
21 |
|
|
|
22 |
|
|
isa_ok( $action, 'A3C::Action::StrixSQL' ); |
23 |
|
|
|
24 |
|
|
$action->argument_values({ strix => 'os-test0604-zg', sql => 'select now() as time' }); |
25 |
|
|
$action->run; |
26 |
|
|
|
27 |
|
|
ok( $action->result->success, 'result is success' ); |
28 |
|
|
|
29 |
|
|
ok( my $coll = $action->result->content( 'sql' ), 'result content have sql' ); |
30 |
|
|
|
31 |
|
|
isa_ok( $coll, 'A3C::SQL' ); |
32 |
|
|
|
33 |
|
|
cmp_ok( $coll->count, '>', 0, 'count' ); |
34 |
|
|
|
35 |
|
|
is_deeply( [ $coll->_column_names ], [ 'time' ], '_column_names' ); |
36 |
|
|
|
37 |
|
|
ok( my $row = $coll->next, 'next' ); |
38 |
|
|
|
39 |
|
|
isa_ok( $row, 'A3C::SQL::row' ); |
40 |
|
|
|
41 |
|
|
ok( my $time = $row->time, 'row->time' ); |
42 |
|
|
|
43 |
|
|
diag $time; |