|
Lines 199-205
subtest "Test endpoints without permission" => sub {
Link Here
|
| 199 |
|
199 |
|
| 200 |
subtest "Test endpoints with permission" => sub { |
200 |
subtest "Test endpoints with permission" => sub { |
| 201 |
|
201 |
|
| 202 |
plan tests => 59; |
202 |
plan tests => 62; |
| 203 |
|
203 |
|
| 204 |
$t->get_ok( "//$userid_1:$password@/api/v1/holds" ) |
204 |
$t->get_ok( "//$userid_1:$password@/api/v1/holds" ) |
| 205 |
->status_is(200) |
205 |
->status_is(200) |
|
Lines 286-291
subtest "Test endpoints with permission" => sub {
Link Here
|
| 286 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
286 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
| 287 |
->status_is(403) |
287 |
->status_is(403) |
| 288 |
->json_like('/error', qr/itemAlreadyOnHold/); |
288 |
->json_like('/error', qr/itemAlreadyOnHold/); |
|
|
289 |
|
| 290 |
my $to_delete_patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 291 |
my $deleted_patron_id = $to_delete_patron->borrowernumber; |
| 292 |
$to_delete_patron->delete; |
| 293 |
|
| 294 |
my $tmp_patron_id = $post_data->{patron_id}; |
| 295 |
$post_data->{patron_id} = $deleted_patron_id; |
| 296 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
| 297 |
->status_is(400) |
| 298 |
->json_is( { error => 'patron_id not found' } ); |
| 299 |
|
| 300 |
# Restore the original patron_id as it is expected by the next subtest |
| 301 |
# FIXME: this tests need to be rewritten from scratch |
| 302 |
$post_data->{patron_id} = $tmp_patron_id; |
| 289 |
}; |
303 |
}; |
| 290 |
|
304 |
|
| 291 |
subtest 'Reserves with itemtype' => sub { |
305 |
subtest 'Reserves with itemtype' => sub { |
| 292 |
- |
|
|