NAME

App::PAIA::Tester - facilitate PAIA testing

SYNOPSIS

use Test::More;
use App::PAIA::Tester;

new_paia_test;

# call with list
paia qw(config base http://example.org/);

# call with string and print call
PAIA "config base http://example.org/";

is error, undef;

paia qw(config);
is_deeply stdout_json, {
    base => 'http://example.org/'
};

paia qw(login -u alice -p 1234);
is stderr, '';
is exit_code, 0;

my $token = stdout_json->{access_token};
ok $token;
note "token: $token";

done_paia_test;

DESCRIPTION

The module implements a simple a singleton wrapper around App::Cmd::Tester to facilitate writing tests for and with the paia client App::PAIA.

FUNCTIONS

paia

Execute paia with arguments given as list.

PAIA

Execute paia with arguments given as string and print the call before execution.

new_paia_test

Start a new test by changing into a new empty temporary directory and enabling paia_live.

done_paia_test

Finish testing and print a summary.

paia_response

Set a mocked HTTP result to return for all following paia requests.

paia_live

Disable HTTP request mocking.

stdout

Return the output sent to STDOUT by last paia execution.

stderr

Return the output sent to STDERR by last paia execution.

stderr

Return the combined output sent to STDOUT and STDERR by last paia execution.

stdout_json

Decode stdout, stripping lines starting with #, as JSON.

stderr_json

Decode stderr, stripping lines starting with #, as JSON.

output_json

Decode output, stripping lines starting with #, as JSON.

exit_code

Return the exit code of last paia execution (0 on success).

error

Return the exception thrown by last paia execution.

debug

Print stdout, stderr, error, and exit_code.