|
Lines 1097-1103
subtest 'edit() tests' => sub {
Link Here
|
| 1097 |
|
1097 |
|
| 1098 |
subtest 'add() tests' => sub { |
1098 |
subtest 'add() tests' => sub { |
| 1099 |
|
1099 |
|
| 1100 |
plan tests => 21; |
1100 |
plan tests => 24; |
| 1101 |
|
1101 |
|
| 1102 |
$schema->storage->txn_begin; |
1102 |
$schema->storage->txn_begin; |
| 1103 |
|
1103 |
|
|
Lines 1139-1155
subtest 'add() tests' => sub {
Link Here
|
| 1139 |
return Koha::Libraries->search( { branchcode => [ $library_2->branchcode, $library_3->branchcode ] } ); |
1139 |
return Koha::Libraries->search( { branchcode => [ $library_2->branchcode, $library_3->branchcode ] } ); |
| 1140 |
}); |
1140 |
}); |
| 1141 |
|
1141 |
|
| 1142 |
my $can_be_reserved = 'OK'; |
1142 |
my $can_biblio_be_reserved = 'OK'; |
|
|
1143 |
my $can_item_be_reserved = 'OK'; |
| 1144 |
|
| 1143 |
my $mock_reserves = Test::MockModule->new('C4::Reserves'); |
1145 |
my $mock_reserves = Test::MockModule->new('C4::Reserves'); |
| 1144 |
$mock_reserves->mock( 'CanItemBeReserved', sub |
1146 |
|
| 1145 |
{ |
1147 |
$mock_reserves->mock( |
| 1146 |
return { status => $can_be_reserved } |
1148 |
'CanItemBeReserved', |
|
|
1149 |
sub { |
| 1150 |
return { status => $can_item_be_reserved }; |
| 1147 |
} |
1151 |
} |
| 1148 |
|
1152 |
|
| 1149 |
); |
1153 |
); |
| 1150 |
$mock_reserves->mock( 'CanBookBeReserved', sub |
1154 |
$mock_reserves->mock( |
| 1151 |
{ |
1155 |
'CanBookBeReserved', |
| 1152 |
return { status => $can_be_reserved } |
1156 |
sub { |
|
|
1157 |
return { status => $can_biblio_be_reserved }; |
| 1153 |
} |
1158 |
} |
| 1154 |
|
1159 |
|
| 1155 |
); |
1160 |
); |
|
Lines 1243-1249
subtest 'add() tests' => sub {
Link Here
|
| 1243 |
->status_is(400) |
1248 |
->status_is(400) |
| 1244 |
->json_is({ error => 'The supplied pickup location is not valid' }); |
1249 |
->json_is({ error => 'The supplied pickup location is not valid' }); |
| 1245 |
|
1250 |
|
|
|
1251 |
$can_item_be_reserved = 'notReservable'; |
| 1252 |
$can_biblio_be_reserved = 'OK'; |
| 1253 |
|
| 1246 |
$item_hold_data->{pickup_library_id} = $library_2->branchcode; |
1254 |
$item_hold_data->{pickup_library_id} = $library_2->branchcode; |
|
|
1255 |
|
| 1256 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => json => $item_hold_data ) |
| 1257 |
->status_is(403, 'Item checks performed when both biblio_id and item_id passed (Bug 35053)') |
| 1258 |
->json_is({ error => 'Hold cannot be placed. Reason: notReservable' }); |
| 1259 |
|
| 1260 |
$can_item_be_reserved = 'OK'; |
| 1261 |
$can_biblio_be_reserved = 'OK'; |
| 1262 |
|
| 1247 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => json => $item_hold_data ) |
1263 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => json => $item_hold_data ) |
| 1248 |
->status_is(201); |
1264 |
->status_is(201); |
| 1249 |
|
1265 |
|
| 1250 |
- |
|
|