Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 44; |
20 |
use Test::More tests => 46; |
21 |
use Test::Mojo; |
21 |
use Test::Mojo; |
22 |
use t::lib::TestBuilder; |
22 |
use t::lib::TestBuilder; |
23 |
use t::lib::Mocks; |
23 |
use t::lib::Mocks; |
Lines 66-71
my $borrower = $builder->build({
Link Here
|
66 |
} |
66 |
} |
67 |
}); |
67 |
}); |
68 |
|
68 |
|
|
|
69 |
my $librarian = $builder->build({ |
70 |
source => 'Borrower', |
71 |
value => { |
72 |
branchcode => $branchcode, |
73 |
categorycode => $categorycode, |
74 |
flags => 16, |
75 |
password => Koha::AuthUtils::hash_password("test"), |
76 |
} |
77 |
}); |
78 |
|
69 |
$t->get_ok('/api/v1/patrons') |
79 |
$t->get_ok('/api/v1/patrons') |
70 |
->status_is(401); |
80 |
->status_is(401); |
71 |
|
81 |
|
Lines 86-91
$session2->param('ip', '127.0.0.1');
Link Here
|
86 |
$session2->param('lasttime', time()); |
96 |
$session2->param('lasttime', time()); |
87 |
$session2->flush; |
97 |
$session2->flush; |
88 |
|
98 |
|
|
|
99 |
my $session3 = C4::Auth::get_session(''); |
100 |
$session3->param('number', $librarian->{ borrowernumber }); |
101 |
$session3->param('id', $librarian->{ userid }); |
102 |
$session3->param('ip', '127.0.0.1'); |
103 |
$session3->param('lasttime', time()); |
104 |
$session3->flush; |
105 |
|
89 |
my $tx = $t->ua->build_tx(GET => '/api/v1/patrons'); |
106 |
my $tx = $t->ua->build_tx(GET => '/api/v1/patrons'); |
90 |
$tx->req->cookies({name => 'CGISESSID', value => $session->id}); |
107 |
$tx->req->cookies({name => 'CGISESSID', value => $session->id}); |
91 |
$t->request_ok($tx) |
108 |
$t->request_ok($tx) |
Lines 214-217
$tx->req->cookies({name => 'CGISESSID', value => $session_nopermission->id});
Link Here
|
214 |
$t->request_ok($tx) |
231 |
$t->request_ok($tx) |
215 |
->status_is(200); |
232 |
->status_is(200); |
216 |
|
233 |
|
|
|
234 |
$tx = $t->ua->build_tx(PATCH => '/api/v1/patrons/'.$borrower->{borrowernumber}.'/password' => json => $password_obj); |
235 |
$tx->req->cookies({name => 'CGISESSID', value => $session3->id}); |
236 |
$t->request_ok($tx) |
237 |
->status_is(200); |
238 |
|
217 |
$schema->storage->txn_rollback; |
239 |
$schema->storage->txn_rollback; |
218 |
- |
|
|