Lines 1270-1276
subtest 'add() tests' => sub {
Link Here
|
1270 |
|
1270 |
|
1271 |
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { |
1271 |
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { |
1272 |
|
1272 |
|
1273 |
plan tests => 28; |
1273 |
plan tests => 37; |
1274 |
|
1274 |
|
1275 |
$schema->storage->txn_begin; |
1275 |
$schema->storage->txn_begin; |
1276 |
|
1276 |
|
Lines 1403-1408
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
Link Here
|
1403 |
|
1403 |
|
1404 |
is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'invalid pickup library not used, even if x-koha-override is passed' ); |
1404 |
is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'invalid pickup library not used, even if x-koha-override is passed' ); |
1405 |
|
1405 |
|
|
|
1406 |
my $waiting_hold = $builder->build_object( { class => 'Koha::Holds', value => { found => 'W' } } ); |
1407 |
my $in_processing_hold = $builder->build_object( { class => 'Koha::Holds', value => { found => 'P' } } ); |
1408 |
my $in_transit_hold = $builder->build_object( { class => 'Koha::Holds', value => { found => 'T' } } ); |
1409 |
|
1410 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
1411 |
. $waiting_hold->id |
1412 |
. "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } )->status_is(409) |
1413 |
->json_is( { error => q{Cannot change pickup location}, error_code => 'hold_waiting' } ); |
1414 |
|
1415 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
1416 |
. $in_processing_hold->id |
1417 |
. "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } )->status_is(409) |
1418 |
->json_is( { error => q{Cannot change pickup location}, error_code => 'hold_in_processing' } ); |
1419 |
|
1420 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
1421 |
. $in_transit_hold->id |
1422 |
. "/pickup_location" => json => { pickup_library_id => $library_2->branchcode } )->status_is(409) |
1423 |
->json_is( { error => q{Cannot change pickup location}, error_code => 'hold_in_transit' } ); |
1424 |
|
1406 |
$schema->storage->txn_rollback; |
1425 |
$schema->storage->txn_rollback; |
1407 |
}; |
1426 |
}; |
1408 |
|
1427 |
|
1409 |
- |
|
|