Lines 23-28
use Test::Mojo;
Link Here
|
23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
25 |
|
25 |
|
|
|
26 |
use Koha::DateUtils qw( dt_from_string ); |
27 |
|
26 |
my $schema = Koha::Database->new->schema; |
28 |
my $schema = Koha::Database->new->schema; |
27 |
my $builder = t::lib::TestBuilder->new; |
29 |
my $builder = t::lib::TestBuilder->new; |
28 |
|
30 |
|
Lines 77-83
subtest 'success tests' => sub {
Link Here
|
77 |
|
79 |
|
78 |
subtest 'failure tests' => sub { |
80 |
subtest 'failure tests' => sub { |
79 |
|
81 |
|
80 |
plan tests => 8; |
82 |
plan tests => 13; |
81 |
|
83 |
|
82 |
$schema->storage->txn_begin; |
84 |
$schema->storage->txn_begin; |
83 |
|
85 |
|
Lines 91-96
subtest 'failure tests' => sub {
Link Here
|
91 |
$patron->set_password({ password => $password }); |
93 |
$patron->set_password({ password => $password }); |
92 |
my $userid = $patron->userid; |
94 |
my $userid = $patron->userid; |
93 |
|
95 |
|
|
|
96 |
$t->get_ok("//$userid:$password@/api/v1/patrons") |
97 |
->status_is( 200, 'All good' ); |
98 |
|
99 |
# expire patron's password |
100 |
$patron->password_expiration_date( dt_from_string->subtract( days => 1 ) )->store; |
101 |
|
102 |
$t->get_ok("//$userid:$password@/api/v1/patrons") |
103 |
->status_is( 403 ) |
104 |
->json_is( '/error' => 'Password has expired', 'Password expired' ); |
105 |
|
94 |
$t->get_ok("//@/api/v1/patrons") |
106 |
$t->get_ok("//@/api/v1/patrons") |
95 |
->status_is( 401, 'No credentials passed' ); |
107 |
->status_is( 401, 'No credentials passed' ); |
96 |
|
108 |
|
97 |
- |
|
|