~ubuntu-branches/ubuntu/oneiric/mcollective/oneiric-proposed

« back to all changes in this revision

Viewing changes to ext/action_helpers/perl/t/basic.t

  • Committer: Bazaar Package Importer
  • Author(s): Marc Cluet, Marc Cluet, Chuck Short
  • Date: 2011-05-05 07:37:54 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110505073754-klk1jkz8afi4fomx
Tags: 1.2.0-0ubuntu1
[Marc Cluet]
* Update to 1.2.0
* Build for Oneiric.

[Chuck Short]
* Drop ruby from mcollective, mcollective-middleware, mcollective-client
  since its a dependency of mcollective-common.
* Bump standards to 3.9.2.
* Fix up lintian warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!perl
 
2
use strict;
 
3
use Test::More;
 
4
use JSON;
 
5
use File::Temp;
 
6
 
 
7
my $class = "MCollective::Action";
 
8
use_ok( $class );
 
9
 
 
10
my $infile  = File::Temp->new;
 
11
my $outfile = File::Temp->new;
 
12
 
 
13
$ENV{MCOLLECTIVE_REQUEST_FILE} = $infile->filename;
 
14
$ENV{MCOLLECTIVE_REPLY_FILE}   = $outfile->filename;
 
15
print $infile JSON->new->encode({ red => "apples", blue => "moon" });
 
16
close $infile;
 
17
{
 
18
    my $mc = $class->new;
 
19
    isa_ok( $mc, $class );
 
20
    is( $mc->request->{red}, "apples", "apples are red" );
 
21
    $mc->reply->{potato} = "chips";
 
22
}
 
23
 
 
24
my $json = do { local $/; <$outfile> };
 
25
ok( $json, "Got some JSON" );
 
26
my $reply = JSON->new->decode( $json );
 
27
 
 
28
is( $reply->{potato}, "chips", "Got the reply that potato = chips" );
 
29
 
 
30
done_testing();