7
my $class = "MCollective::Action";
10
my $infile = File::Temp->new;
11
my $outfile = File::Temp->new;
13
$ENV{MCOLLECTIVE_REQUEST_FILE} = $infile->filename;
14
$ENV{MCOLLECTIVE_REPLY_FILE} = $outfile->filename;
15
print $infile JSON->new->encode({ red => "apples", blue => "moon" });
19
isa_ok( $mc, $class );
20
is( $mc->request->{red}, "apples", "apples are red" );
21
$mc->reply->{potato} = "chips";
24
my $json = do { local $/; <$outfile> };
25
ok( $json, "Got some JSON" );
26
my $reply = JSON->new->decode( $json );
28
is( $reply->{potato}, "chips", "Got the reply that potato = chips" );