|
Lines 1408-1420
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
Link Here
|
| 1408 |
|
1408 |
|
| 1409 |
subtest 'delete() tests' => sub { |
1409 |
subtest 'delete() tests' => sub { |
| 1410 |
|
1410 |
|
| 1411 |
plan tests => 3; |
1411 |
plan tests => 13; |
| 1412 |
|
1412 |
|
| 1413 |
$schema->storage->txn_begin; |
1413 |
$schema->storage->txn_begin; |
| 1414 |
|
1414 |
|
| 1415 |
my $password = 'AbcdEFG123'; |
1415 |
my $password = 'AbcdEFG123'; |
| 1416 |
my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 0 } }); |
1416 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 0 } } ); |
| 1417 |
$patron->set_password({ password => $password, skip_validation => 1 }); |
1417 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
| 1418 |
my $userid = $patron->userid; |
1418 |
my $userid = $patron->userid; |
| 1419 |
|
1419 |
|
| 1420 |
# Only have 'place_holds' subpermission |
1420 |
# Only have 'place_holds' subpermission |
|
Lines 1454-1462
subtest 'delete() tests' => sub {
Link Here
|
| 1454 |
) |
1454 |
) |
| 1455 |
); |
1455 |
); |
| 1456 |
|
1456 |
|
| 1457 |
$t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id ) |
1457 |
$t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id )->status_is( 204, 'SWAGGER3.2.4' ) |
| 1458 |
->status_is(204, 'SWAGGER3.2.4') |
1458 |
->content_is( '', 'SWAGGER3.3.4' ); |
| 1459 |
->content_is('', 'SWAGGER3.3.4'); |
1459 |
|
|
|
1460 |
$hold = Koha::Holds->find( |
| 1461 |
AddReserve( |
| 1462 |
{ |
| 1463 |
branchcode => $patron->branchcode, |
| 1464 |
borrowernumber => $patron->borrowernumber, |
| 1465 |
biblionumber => $biblio->biblionumber, |
| 1466 |
priority => 1, |
| 1467 |
itemnumber => undef, |
| 1468 |
} |
| 1469 |
) |
| 1470 |
); |
| 1471 |
|
| 1472 |
$t->delete_ok( "//$userid:$password@/api/v1/holds/" . $hold->id => { 'x-koha-override' => q{} } ) |
| 1473 |
->status_is( 204, 'Same behavior if header not set' )->content_is(''); |
| 1474 |
|
| 1475 |
$hold = Koha::Holds->find( |
| 1476 |
AddReserve( |
| 1477 |
{ |
| 1478 |
branchcode => $patron->branchcode, |
| 1479 |
borrowernumber => $patron->borrowernumber, |
| 1480 |
biblionumber => $biblio->biblionumber, |
| 1481 |
priority => 1, |
| 1482 |
itemnumber => undef, |
| 1483 |
} |
| 1484 |
) |
| 1485 |
); |
| 1486 |
|
| 1487 |
$t->delete_ok( |
| 1488 |
"//$userid:$password@/api/v1/holds/" . $hold->id => { 'x-koha-override' => q{cancellation-request-flow} } ) |
| 1489 |
->status_is( 204, 'Same behavior if header set but hold not waiting' )->content_is(''); |
| 1490 |
|
| 1491 |
$hold = Koha::Holds->find( |
| 1492 |
AddReserve( |
| 1493 |
{ |
| 1494 |
branchcode => $patron->branchcode, |
| 1495 |
borrowernumber => $patron->borrowernumber, |
| 1496 |
biblionumber => $biblio->biblionumber, |
| 1497 |
priority => 1, |
| 1498 |
itemnumber => undef, |
| 1499 |
} |
| 1500 |
) |
| 1501 |
); |
| 1502 |
|
| 1503 |
$hold->set_waiting; |
| 1504 |
|
| 1505 |
is( $hold->cancellation_requests->count, 0 ); |
| 1506 |
|
| 1507 |
$t->delete_ok( |
| 1508 |
"//$userid:$password@/api/v1/holds/" . $hold->id => { 'x-koha-override' => q{cancellation-request-flow} } ) |
| 1509 |
->status_is( 202, 'Cancellation request accepted' ); |
| 1510 |
|
| 1511 |
is( $hold->cancellation_requests->count, 1 ); |
| 1460 |
|
1512 |
|
| 1461 |
$schema->storage->txn_rollback; |
1513 |
$schema->storage->txn_rollback; |
| 1462 |
}; |
1514 |
}; |
| 1463 |
- |
|
|