|
Lines 860-866
subtest 'pickup_locations() tests' => sub {
Link Here
|
| 860 |
|
860 |
|
| 861 |
subtest 'edit() tests' => sub { |
861 |
subtest 'edit() tests' => sub { |
| 862 |
|
862 |
|
| 863 |
plan tests => 14; |
863 |
plan tests => 20; |
| 864 |
|
864 |
|
| 865 |
$schema->storage->txn_begin; |
865 |
$schema->storage->txn_begin; |
| 866 |
|
866 |
|
|
Lines 885-890
subtest 'edit() tests' => sub {
Link Here
|
| 885 |
# Disable logging |
885 |
# Disable logging |
| 886 |
t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); |
886 |
t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); |
| 887 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
887 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
|
|
888 |
t::lib::Mocks::mock_preference( 'AllowHoldPolicyOverride', 1 ); |
| 888 |
|
889 |
|
| 889 |
my $mock_biblio = Test::MockModule->new('Koha::Biblio'); |
890 |
my $mock_biblio = Test::MockModule->new('Koha::Biblio'); |
| 890 |
my $mock_item = Test::MockModule->new('Koha::Item'); |
891 |
my $mock_item = Test::MockModule->new('Koha::Item'); |
|
Lines 930-935
subtest 'edit() tests' => sub {
Link Here
|
| 930 |
$biblio_hold->discard_changes; |
931 |
$biblio_hold->discard_changes; |
| 931 |
is( $biblio_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); |
932 |
is( $biblio_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); |
| 932 |
|
933 |
|
|
|
934 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" . $biblio_hold->id |
| 935 |
=> { 'x-koha-override' => 'any' } |
| 936 |
=> json => $biblio_hold_data ) |
| 937 |
->status_is(200) |
| 938 |
->json_has( '/pickup_library_id' => $library_1->id ); |
| 939 |
|
| 933 |
$biblio_hold_data->{pickup_library_id} = $library_2->branchcode; |
940 |
$biblio_hold_data->{pickup_library_id} = $library_2->branchcode; |
| 934 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
941 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
| 935 |
. $biblio_hold->id |
942 |
. $biblio_hold->id |
|
Lines 964-969
subtest 'edit() tests' => sub {
Link Here
|
| 964 |
$item_hold->discard_changes; |
971 |
$item_hold->discard_changes; |
| 965 |
is( $item_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); |
972 |
is( $item_hold->branchcode, $library_3->branchcode, 'branchcode remains untouched' ); |
| 966 |
|
973 |
|
|
|
974 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" . $item_hold->id |
| 975 |
=> { 'x-koha-override' => 'any' } |
| 976 |
=> json => $item_hold_data ) |
| 977 |
->status_is(200) |
| 978 |
->json_has( '/pickup_library_id' => $library_1->id ); |
| 979 |
|
| 967 |
$item_hold_data->{pickup_library_id} = $library_2->branchcode; |
980 |
$item_hold_data->{pickup_library_id} = $library_2->branchcode; |
| 968 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
981 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
| 969 |
. $item_hold->id |
982 |
. $item_hold->id |
| 970 |
- |
|
|