App-PAIA
view release on metacpan or search on metacpan
lib/App/PAIA/Command/session.pm view on Meta::CPAN
use App::PAIA::JSON;
sub _execute {
my ($self, $opt, $args) = @_;
if (defined $self->session->file ) {
my $data = $self->session->load;
say encode_json($data) if $self->app->global_options->verbose;
my $msg = $self->not_authentificated;
die "$msg.\n" if $msg;
say "session looks fine.";
} else {
die "no session file found.\n";
}
if (!$self->auth) {
die "PAIA auth server URL not found\n";
} else {
$self->logger->('auth URL: '.$self->auth);
}
t/15-session.t view on Meta::CPAN
paia qw(patron -b https://example.org/ -u alice -p 1234 -v -q);
is output, <<OUT, 'auto-login with session';
# auto-login with scope 'read_patron'
# POST https://example.org/auth/login
# saved session file paia-session.json
# GET https://example.org/core/8362432
OUT
paia qw(session);
is output, "session looks fine.\n", "session looks fine";
paia qw(config base http://example.com/paia);
paia qw(session -v);
is_deeply [ (output =~ /^# .... URL: .+/mg) ],
[ '# auth URL: https://example.org/auth',
'# core URL: https://example.org/core' ],
'session overrides config file';
paia qw(patron -b https://example.com/ -v -q);
is output, <<OUT, 'command line arguments override session file';
( run in 0.611 second using v1.01-cache-2.11-cpan-64827b87656 )