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 => 57; |
202 |
plan tests => 59; |
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 240-246
subtest "Test endpoints with permission" => sub {
Link Here
|
240 |
->json_is( '/pickup_library_id', $branchcode2 ); |
240 |
->json_is( '/pickup_library_id', $branchcode2 ); |
241 |
|
241 |
|
242 |
$t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" ) |
242 |
$t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" ) |
243 |
->status_is(200); |
243 |
->status_is(204, 'SWAGGER3.2.4') |
|
|
244 |
->content_is('', 'SWAGGER3.3.4'); |
244 |
|
245 |
|
245 |
$t->put_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" => json => $put_data ) |
246 |
$t->put_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" => json => $put_data ) |
246 |
->status_is(404) |
247 |
->status_is(404) |
Lines 260-266
subtest "Test endpoints with permission" => sub {
Link Here
|
260 |
->json_is([]); |
261 |
->json_is([]); |
261 |
|
262 |
|
262 |
$t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id2" ) |
263 |
$t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id2" ) |
263 |
->status_is(200); |
264 |
->status_is(204, 'SWAGGER3.2.4') |
|
|
265 |
->content_is('', 'SWAGGER3.3.4'); |
264 |
|
266 |
|
265 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
267 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
266 |
->status_is(201) |
268 |
->status_is(201) |
Lines 287-293
subtest "Test endpoints with permission" => sub {
Link Here
|
287 |
}; |
289 |
}; |
288 |
|
290 |
|
289 |
subtest 'Reserves with itemtype' => sub { |
291 |
subtest 'Reserves with itemtype' => sub { |
290 |
plan tests => 9; |
292 |
plan tests => 10; |
291 |
|
293 |
|
292 |
my $post_data = { |
294 |
my $post_data = { |
293 |
patron_id => int($patron_1->borrowernumber), |
295 |
patron_id => int($patron_1->borrowernumber), |
Lines 297-303
subtest 'Reserves with itemtype' => sub {
Link Here
|
297 |
}; |
299 |
}; |
298 |
|
300 |
|
299 |
$t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" ) |
301 |
$t->delete_ok( "//$userid_3:$password@/api/v1/holds/$reserve_id" ) |
300 |
->status_is(200); |
302 |
->status_is(204, 'SWAGGER3.2.4') |
|
|
303 |
->content_is('', 'SWAGGER3.3.4'); |
301 |
|
304 |
|
302 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
305 |
$t->post_ok( "//$userid_3:$password@/api/v1/holds" => json => $post_data ) |
303 |
->status_is(201) |
306 |
->status_is(201) |
Lines 427-434
subtest 'suspend and resume tests' => sub {
Link Here
|
427 |
); |
430 |
); |
428 |
|
431 |
|
429 |
$t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" ) |
432 |
$t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" ) |
430 |
->status_is( 204, "Correct status when deleting a resource" ) |
433 |
->status_is(204, 'SWAGGER3.2.4') |
431 |
->json_is( undef ); |
434 |
->content_is('', 'SWAGGER3.3.4'); |
432 |
|
435 |
|
433 |
# Pass a an expiration date for the suspension |
436 |
# Pass a an expiration date for the suspension |
434 |
my $date = dt_from_string()->add( days => 5 ); |
437 |
my $date = dt_from_string()->add( days => 5 ); |
Lines 445-452
subtest 'suspend and resume tests' => sub {
Link Here
|
445 |
->header_is( Location => "/api/v1/holds/" . $hold->id . "/suspension", 'The Location header is set' ); |
448 |
->header_is( Location => "/api/v1/holds/" . $hold->id . "/suspension", 'The Location header is set' ); |
446 |
|
449 |
|
447 |
$t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" ) |
450 |
$t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id . "/suspension" ) |
448 |
->status_is( 204, "Correct status when deleting a resource" ) |
451 |
->status_is(204, 'SWAGGER3.2.4') |
449 |
->json_is( undef ); |
452 |
->content_is('', 'SWAGGER3.3.4'); |
450 |
|
453 |
|
451 |
$hold->set_waiting->discard_changes; |
454 |
$hold->set_waiting->discard_changes; |
452 |
|
455 |
|