Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 12; |
20 |
use Test::More tests => 13; |
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 1026-1028
subtest 'add() tests' => sub {
Link Here
|
1026 |
|
1026 |
|
1027 |
$schema->storage->txn_rollback; |
1027 |
$schema->storage->txn_rollback; |
1028 |
}; |
1028 |
}; |
1029 |
- |
1029 |
|
|
|
1030 |
|
1031 |
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { |
1032 |
|
1033 |
plan tests => 4; |
1034 |
|
1035 |
$schema->storage->txn_begin; |
1036 |
|
1037 |
my $password = 'AbcdEFG123'; |
1038 |
|
1039 |
my $library_1 = $builder->build_object({ class => 'Koha::Libraries' }); |
1040 |
my $library_2 = $builder->build_object({ class => 'Koha::Libraries' }); |
1041 |
|
1042 |
my $patron = $builder->build_object( |
1043 |
{ class => 'Koha::Patrons', value => { flags => 0 } } ); |
1044 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
1045 |
my $userid = $patron->userid; |
1046 |
$builder->build( |
1047 |
{ |
1048 |
source => 'UserPermission', |
1049 |
value => { |
1050 |
borrowernumber => $patron->borrowernumber, |
1051 |
module_bit => 6, |
1052 |
code => 'place_holds', |
1053 |
}, |
1054 |
} |
1055 |
); |
1056 |
|
1057 |
# Disable logging |
1058 |
t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); |
1059 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
1060 |
|
1061 |
my $biblio = $builder->build_sample_biblio; |
1062 |
my $hold = Koha::Holds->find( |
1063 |
AddReserve( |
1064 |
{ |
1065 |
branchcode => $library_1->branchcode, |
1066 |
borrowernumber => $patron->borrowernumber, |
1067 |
biblionumber => $biblio->biblionumber, |
1068 |
priority => 1, |
1069 |
} |
1070 |
) |
1071 |
); |
1072 |
|
1073 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
1074 |
. $hold->id |
1075 |
. "/pickup_location" => json => $library_2->branchcode )->status_is(200)->json_is($library_2->branchcode); |
1076 |
|
1077 |
is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' ); |
1078 |
|
1079 |
$schema->storage->txn_rollback; |
1080 |
}; |