|
Lines 1136-1142
subtest 'add() tests' => sub {
Link Here
|
| 1136 |
|
1136 |
|
| 1137 |
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { |
1137 |
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { |
| 1138 |
|
1138 |
|
| 1139 |
plan tests => 16; |
1139 |
plan tests => 20; |
| 1140 |
|
1140 |
|
| 1141 |
$schema->storage->txn_begin; |
1141 |
$schema->storage->txn_begin; |
| 1142 |
|
1142 |
|
|
Lines 1240-1245
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub {
Link Here
|
| 1240 |
|
1240 |
|
| 1241 |
is( $hold->discard_changes->branchcode->branchcode, $library_1->branchcode, 'pickup library unchanged' ); |
1241 |
is( $hold->discard_changes->branchcode->branchcode, $library_1->branchcode, 'pickup library unchanged' ); |
| 1242 |
|
1242 |
|
|
|
1243 |
t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 ); |
| 1244 |
|
| 1245 |
# Attempt to use an invalid pickup locations with override succeeds |
| 1246 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
| 1247 |
. $hold->id |
| 1248 |
. "/pickup_location" |
| 1249 |
=> { 'x-koha-override' => 'any' } |
| 1250 |
=> json => { pickup_library_id => $library_2->branchcode } ) |
| 1251 |
->status_is(200) |
| 1252 |
->json_is({ pickup_library_id => $library_2->branchcode }); |
| 1253 |
|
| 1254 |
is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library changed' ); |
| 1255 |
|
| 1256 |
t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 0 ); |
| 1257 |
|
| 1243 |
$libraries_query = { |
1258 |
$libraries_query = { |
| 1244 |
branchcode => { |
1259 |
branchcode => { |
| 1245 |
'-in' => [ $library_1->branchcode, $library_2->branchcode ] |
1260 |
'-in' => [ $library_1->branchcode, $library_2->branchcode ] |
| 1246 |
- |
|
|