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 => 16; |
1100 |
plan tests => 21; |
1101 |
|
1101 |
|
1102 |
$schema->storage->txn_begin; |
1102 |
$schema->storage->txn_begin; |
1103 |
|
1103 |
|
Lines 1178-1183
subtest 'add() tests' => sub {
Link Here
|
1178 |
pickup_library_id => $library_1->branchcode, |
1178 |
pickup_library_id => $library_1->branchcode, |
1179 |
}; |
1179 |
}; |
1180 |
|
1180 |
|
|
|
1181 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => json => $biblio_hold_data ) |
1182 |
->status_is(400) |
1183 |
->json_is({ error => 'The supplied pickup location is not valid' }); |
1184 |
|
1185 |
$biblio_hold_data->{pickup_library_id} = $library_2->branchcode; |
1186 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => json => $biblio_hold_data ) |
1187 |
->status_is(201); |
1188 |
|
1189 |
# Test biblio-level holds |
1190 |
my $item_group = Koha::Biblio::ItemGroup->new( { biblio_id => $biblio->id } )->store(); |
1191 |
$biblio_hold = $builder->build_object( |
1192 |
{ |
1193 |
class => "Koha::Holds", |
1194 |
value => { |
1195 |
biblionumber => $biblio->biblionumber, |
1196 |
branchcode => $library_3->branchcode, |
1197 |
itemnumber => undef, |
1198 |
priority => 1, |
1199 |
item_group_id => $item_group->id, |
1200 |
} |
1201 |
} |
1202 |
); |
1203 |
|
1204 |
$biblio_hold_api_data = $biblio_hold->to_api; |
1205 |
$biblio_hold->delete; |
1206 |
$biblio_hold_data = { |
1207 |
biblio_id => $biblio_hold_api_data->{biblio_id}, |
1208 |
patron_id => $biblio_hold_api_data->{patron_id}, |
1209 |
pickup_library_id => $library_1->branchcode, |
1210 |
}; |
1211 |
|
1181 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => json => $biblio_hold_data ) |
1212 |
$t->post_ok( "//$userid:$password@/api/v1/holds" => json => $biblio_hold_data ) |
1182 |
->status_is(400) |
1213 |
->status_is(400) |
1183 |
->json_is({ error => 'The supplied pickup location is not valid' }); |
1214 |
->json_is({ error => 'The supplied pickup location is not valid' }); |
1184 |
- |
|
|