Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 10; |
20 |
use Test::More tests => 11; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Mojo; |
22 |
use Test::Mojo; |
23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
Lines 787-789
subtest 'pickup_locations() tests' => sub {
Link Here
|
787 |
|
787 |
|
788 |
$schema->storage->txn_rollback; |
788 |
$schema->storage->txn_rollback; |
789 |
}; |
789 |
}; |
790 |
- |
790 |
|
|
|
791 |
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { |
792 |
|
793 |
plan tests => 4; |
794 |
|
795 |
$schema->storage->txn_begin; |
796 |
|
797 |
my $password = 'AbcdEFG123'; |
798 |
|
799 |
my $library_1 = $builder->build_object({ class => 'Koha::Libraries' }); |
800 |
my $library_2 = $builder->build_object({ class => 'Koha::Libraries' }); |
801 |
|
802 |
my $patron = $builder->build_object( |
803 |
{ class => 'Koha::Patrons', value => { flags => 0 } } ); |
804 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
805 |
my $userid = $patron->userid; |
806 |
$builder->build( |
807 |
{ |
808 |
source => 'UserPermission', |
809 |
value => { |
810 |
borrowernumber => $patron->borrowernumber, |
811 |
module_bit => 6, |
812 |
code => 'place_holds', |
813 |
}, |
814 |
} |
815 |
); |
816 |
|
817 |
# Disable logging |
818 |
t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); |
819 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
820 |
|
821 |
my $biblio = $builder->build_sample_biblio; |
822 |
my $hold = Koha::Holds->find( |
823 |
AddReserve( |
824 |
{ |
825 |
branchcode => $library_1->branchcode, |
826 |
borrowernumber => $patron->borrowernumber, |
827 |
biblionumber => $biblio->biblionumber, |
828 |
priority => 1, |
829 |
} |
830 |
) |
831 |
); |
832 |
|
833 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
834 |
. $hold->id |
835 |
. "/pickup_location" => json => $library_2->branchcode )->status_is(200)->json_is($library_2->branchcode); |
836 |
|
837 |
is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' ); |
838 |
|
839 |
$schema->storage->txn_rollback; |
840 |
}; |