|
Lines 110-115
$session3->flush;
Link Here
|
| 110 |
my $biblionumber = create_biblio('RESTful Web APIs'); |
110 |
my $biblionumber = create_biblio('RESTful Web APIs'); |
| 111 |
my $itemnumber = create_item($biblionumber, 'TEST000001'); |
111 |
my $itemnumber = create_item($biblionumber, 'TEST000001'); |
| 112 |
|
112 |
|
|
|
113 |
my $biblionumber2 = create_biblio('RESTful Web APIs'); |
| 114 |
my $itemnumber2 = create_item($biblionumber2, 'TEST000002'); |
| 115 |
|
| 113 |
$dbh->do('DELETE FROM reserves'); |
116 |
$dbh->do('DELETE FROM reserves'); |
| 114 |
|
117 |
|
| 115 |
my $reserve_id = C4::Reserves::AddReserve($branchcode, $borrowernumber, |
118 |
my $reserve_id = C4::Reserves::AddReserve($branchcode, $borrowernumber, |
|
Lines 204-210
subtest "Test endpoints without permission, but accessing own object" => sub {
Link Here
|
| 204 |
}; |
207 |
}; |
| 205 |
|
208 |
|
| 206 |
subtest "Test endpoints with permission" => sub { |
209 |
subtest "Test endpoints with permission" => sub { |
| 207 |
plan tests => 42; |
210 |
plan tests => 45; |
| 208 |
|
211 |
|
| 209 |
$tx = $t->ua->build_tx(GET => '/api/v1/holds'); |
212 |
$tx = $t->ua->build_tx(GET => '/api/v1/holds'); |
| 210 |
$tx->req->cookies({name => 'CGISESSID', value => $session->id}); |
213 |
$tx->req->cookies({name => 'CGISESSID', value => $session->id}); |
|
Lines 290-295
subtest "Test endpoints with permission" => sub {
Link Here
|
| 290 |
$tx->req->cookies({name => 'CGISESSID', value => $session3->id}); |
293 |
$tx->req->cookies({name => 'CGISESSID', value => $session3->id}); |
| 291 |
$t->request_ok($tx) |
294 |
$t->request_ok($tx) |
| 292 |
->status_is(403) |
295 |
->status_is(403) |
|
|
296 |
->json_like('/error', qr/itemAlreadyOnHold/); |
| 297 |
|
| 298 |
$post_data->{biblionumber} = int($biblionumber2); |
| 299 |
$post_data->{itemnumber} = int($itemnumber2); |
| 300 |
$tx = $t->ua->build_tx(POST => "/api/v1/holds" => json => $post_data); |
| 301 |
$tx->req->cookies({name => 'CGISESSID', value => $session3->id}); |
| 302 |
$t->request_ok($tx) |
| 303 |
->status_is(403) |
| 293 |
->json_like('/error', qr/tooManyReserves/); |
304 |
->json_like('/error', qr/tooManyReserves/); |
| 294 |
}; |
305 |
}; |
| 295 |
|
306 |
|
| 296 |
- |
|
|