Lines 177-183
subtest "Test endpoints without permission" => sub {
Link Here
|
177 |
|
177 |
|
178 |
subtest "Test endpoints with permission" => sub { |
178 |
subtest "Test endpoints with permission" => sub { |
179 |
|
179 |
|
180 |
plan tests => 44; |
180 |
plan tests => 47; |
181 |
|
181 |
|
182 |
$t->get_ok( "//$userid_1:$password@/api/v1/holds" ) |
182 |
$t->get_ok( "//$userid_1:$password@/api/v1/holds" ) |
183 |
->status_is(200) |
183 |
->status_is(200) |
Lines 245-250
subtest "Test endpoints with permission" => sub {
Link Here
|
245 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
245 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
246 |
->status_is(403) |
246 |
->status_is(403) |
247 |
->json_like('/error', qr/itemAlreadyOnHold/); |
247 |
->json_like('/error', qr/itemAlreadyOnHold/); |
|
|
248 |
|
249 |
my $to_delete_patron = $builder->build_object({ class => 'Koha::Patrons' }); |
250 |
my $deleted_patron_id = $to_delete_patron->borrowernumber; |
251 |
$to_delete_patron->delete; |
252 |
|
253 |
my $tmp_patron_id = $post_data->{patron_id}; |
254 |
$post_data->{patron_id} = $deleted_patron_id; |
255 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
256 |
->status_is(400) |
257 |
->json_is( { error => 'patron_id not found' } ); |
258 |
|
259 |
# Restore the original patron_id as it is expected by the next subtest |
260 |
# FIXME: this tests need to be rewritten from scratch |
261 |
$post_data->{patron_id} = $tmp_patron_id; |
248 |
}; |
262 |
}; |
249 |
|
263 |
|
250 |
subtest 'Reserves with itemtype' => sub { |
264 |
subtest 'Reserves with itemtype' => sub { |
251 |
- |
|
|