#!perl
subtest
'response dialog'
=>
sub
{
my
$ua
=
local
$Pinto::Globals::UA
= Test::LWP::UserAgent->new;
my
$res
= HTTP::Response->new(200);
$res
->content(
"DATA-GOES-HERE\n## DIAG-MSG-HERE\n$PINTO_PROTOCOL_STATUS_OK\n"
);
$ua
->map_response(
qr{.*}
,
$res
);
my
$out_buffer
=
''
;
my
$out_fh
= IO::String->new( \
$out_buffer
);
my
$err_buffer
=
''
;
my
$err_fh
= IO::String->new( \
$err_buffer
);
my
$chrome
= Pinto::Chrome::Term->new(
stdout
=>
$out_fh
,
stderr
=>
$err_fh
);
my
$pinto
= Pinto::Remote->new(
chrome
=>
$chrome
,
root
=>
$PINTO_SERVER_DEFAULT_ROOT
);
my
$result
=
$pinto
->run(
'List'
);
is
$result
->was_successful, 1,
'Got successful result'
or diag
$err_buffer
;
is
$out_buffer
,
"DATA-GOES-HERE\n"
,
'Got correct data output'
;
is
$err_buffer
,
"DIAG-MSG-HERE\n"
,
'Got correct diagnostic output'
;
};
done_testing;