Lines 893-899
subtest 'pickup_locations() tests' => sub {
Link Here
|
893 |
|
893 |
|
894 |
subtest 'edit() tests' => sub { |
894 |
subtest 'edit() tests' => sub { |
895 |
|
895 |
|
896 |
plan tests => 14; |
896 |
plan tests => 20; |
897 |
|
897 |
|
898 |
$schema->storage->txn_begin; |
898 |
$schema->storage->txn_begin; |
899 |
|
899 |
|
Lines 918-923
subtest 'edit() tests' => sub {
Link Here
|
918 |
# Disable logging |
918 |
# Disable logging |
919 |
t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); |
919 |
t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); |
920 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
920 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
|
|
921 |
t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 ); |
921 |
|
922 |
|
922 |
my $mock_biblio = Test::MockModule->new('Koha::Biblio'); |
923 |
my $mock_biblio = Test::MockModule->new('Koha::Biblio'); |
923 |
my $mock_item = Test::MockModule->new('Koha::Item'); |
924 |
my $mock_item = Test::MockModule->new('Koha::Item'); |
Lines 963-968
subtest 'edit() tests' => sub {
Link Here
|
963 |
$biblio_hold->discard_changes; |
964 |
$biblio_hold->discard_changes; |
964 |
is( $biblio_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); |
965 |
is( $biblio_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); |
965 |
|
966 |
|
|
|
967 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" . $biblio_hold->id |
968 |
=> { 'x-koha-override' => 'any' } |
969 |
=> json => $biblio_hold_data ) |
970 |
->status_is(200) |
971 |
->json_has( '/pickup_library_id' => $library_1->id ); |
972 |
|
966 |
$biblio_hold_data->{pickup_library_id} = $library_2->branchcode; |
973 |
$biblio_hold_data->{pickup_library_id} = $library_2->branchcode; |
967 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
974 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
968 |
. $biblio_hold->id |
975 |
. $biblio_hold->id |
Lines 997-1002
subtest 'edit() tests' => sub {
Link Here
|
997 |
$item_hold->discard_changes; |
1004 |
$item_hold->discard_changes; |
998 |
is( $item_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); |
1005 |
is( $item_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); |
999 |
|
1006 |
|
|
|
1007 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" . $item_hold->id |
1008 |
=> { 'x-koha-override' => 'any' } |
1009 |
=> json => $item_hold_data ) |
1010 |
->status_is(200) |
1011 |
->json_has( '/pickup_library_id' => $library_1->id ); |
1012 |
|
1000 |
$item_hold_data->{pickup_library_id} = $library_2->branchcode; |
1013 |
$item_hold_data->{pickup_library_id} = $library_2->branchcode; |
1001 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
1014 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
1002 |
. $item_hold->id |
1015 |
. $item_hold->id |
1003 |
- |
|
|