|
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 62-67
my $borrower = $builder->build({
Link Here
|
| 62 |
} |
62 |
} |
| 63 |
}); |
63 |
}); |
| 64 |
|
64 |
|
|
|
65 |
my $librarian = $builder->build({ |
| 66 |
source => 'Borrower', |
| 67 |
value => { |
| 68 |
branchcode => $branchcode, |
| 69 |
categorycode => $categorycode, |
| 70 |
flags => 16, |
| 71 |
password => Koha::AuthUtils::hash_password("test"), |
| 72 |
} |
| 73 |
}); |
| 74 |
|
| 65 |
$t->get_ok('/api/v1/patrons') |
75 |
$t->get_ok('/api/v1/patrons') |
| 66 |
->status_is(401); |
76 |
->status_is(401); |
| 67 |
|
77 |
|
|
Lines 82-87
$session2->param('ip', '127.0.0.1');
Link Here
|
| 82 |
$session2->param('lasttime', time()); |
92 |
$session2->param('lasttime', time()); |
| 83 |
$session2->flush; |
93 |
$session2->flush; |
| 84 |
|
94 |
|
|
|
95 |
my $session3 = C4::Auth::get_session(''); |
| 96 |
$session3->param('number', $librarian->{ borrowernumber }); |
| 97 |
$session3->param('id', $librarian->{ userid }); |
| 98 |
$session3->param('ip', '127.0.0.1'); |
| 99 |
$session3->param('lasttime', time()); |
| 100 |
$session3->flush; |
| 101 |
|
| 85 |
my $tx = $t->ua->build_tx(GET => '/api/v1/patrons'); |
102 |
my $tx = $t->ua->build_tx(GET => '/api/v1/patrons'); |
| 86 |
$tx->req->cookies({name => 'CGISESSID', value => $session->id}); |
103 |
$tx->req->cookies({name => 'CGISESSID', value => $session->id}); |
| 87 |
$t->request_ok($tx) |
104 |
$t->request_ok($tx) |
|
Lines 210-213
$tx->req->cookies({name => 'CGISESSID', value => $session_nopermission->id});
Link Here
|
| 210 |
$t->request_ok($tx) |
227 |
$t->request_ok($tx) |
| 211 |
->status_is(200); |
228 |
->status_is(200); |
| 212 |
|
229 |
|
|
|
230 |
$tx = $t->ua->build_tx(PATCH => '/api/v1/patrons/'.$borrower->{borrowernumber}.'/password' => json => $password_obj); |
| 231 |
$tx->req->cookies({name => 'CGISESSID', value => $session3->id}); |
| 232 |
$t->request_ok($tx) |
| 233 |
->status_is(200); |
| 234 |
|
| 213 |
$schema->storage->txn_rollback; |
235 |
$schema->storage->txn_rollback; |
| 214 |
- |
|
|