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 1054-1056
subtest 'add() tests' => sub {
Link Here
|
1054 |
|
1054 |
|
1055 |
$schema->storage->txn_rollback; |
1055 |
$schema->storage->txn_rollback; |
1056 |
}; |
1056 |
}; |
1057 |
- |
1057 |
|
|
|
1058 |
|
1059 |
subtest 'PUT /holds/{hold_id}/pickup_location tests' => sub { |
1060 |
|
1061 |
plan tests => 4; |
1062 |
|
1063 |
$schema->storage->txn_begin; |
1064 |
|
1065 |
my $password = 'AbcdEFG123'; |
1066 |
|
1067 |
my $library_1 = $builder->build_object({ class => 'Koha::Libraries' }); |
1068 |
my $library_2 = $builder->build_object({ class => 'Koha::Libraries' }); |
1069 |
|
1070 |
my $patron = $builder->build_object( |
1071 |
{ class => 'Koha::Patrons', value => { flags => 0 } } ); |
1072 |
$patron->set_password( { password => $password, skip_validation => 1 } ); |
1073 |
my $userid = $patron->userid; |
1074 |
$builder->build( |
1075 |
{ |
1076 |
source => 'UserPermission', |
1077 |
value => { |
1078 |
borrowernumber => $patron->borrowernumber, |
1079 |
module_bit => 6, |
1080 |
code => 'place_holds', |
1081 |
}, |
1082 |
} |
1083 |
); |
1084 |
|
1085 |
# Disable logging |
1086 |
t::lib::Mocks::mock_preference( 'HoldsLog', 0 ); |
1087 |
t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 ); |
1088 |
|
1089 |
my $biblio = $builder->build_sample_biblio; |
1090 |
my $hold = Koha::Holds->find( |
1091 |
AddReserve( |
1092 |
{ |
1093 |
branchcode => $library_1->branchcode, |
1094 |
borrowernumber => $patron->borrowernumber, |
1095 |
biblionumber => $biblio->biblionumber, |
1096 |
priority => 1, |
1097 |
} |
1098 |
) |
1099 |
); |
1100 |
|
1101 |
$t->put_ok( "//$userid:$password@/api/v1/holds/" |
1102 |
. $hold->id |
1103 |
. "/pickup_location" => json => $library_2->branchcode )->status_is(200)->json_is($library_2->branchcode); |
1104 |
|
1105 |
is( $hold->discard_changes->branchcode->branchcode, $library_2->branchcode, 'pickup library adjusted correctly' ); |
1106 |
|
1107 |
$schema->storage->txn_rollback; |
1108 |
}; |