Lines 210-216
subtest 'volumes delete() tests' => sub {
Link Here
|
210 |
}; |
210 |
}; |
211 |
|
211 |
|
212 |
subtest 'volume items add() + delete() tests' => sub { |
212 |
subtest 'volume items add() + delete() tests' => sub { |
213 |
plan tests => 11; |
213 |
plan tests => 14; |
214 |
|
214 |
|
215 |
$schema->storage->txn_begin; |
215 |
$schema->storage->txn_begin; |
216 |
|
216 |
|
Lines 234-241
subtest 'volume items add() + delete() tests' => sub {
Link Here
|
234 |
my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
234 |
my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
235 |
my $item_1_id = $item_1->id; |
235 |
my $item_1_id = $item_1->id; |
236 |
|
236 |
|
237 |
$t->post_ok( "//$userid:$password@/api/v1/biblios/{biblio_id}/volumes/$volume_id/items" => json => { item_id => $item_1->id } ) |
237 |
$t->post_ok( "//$userid:$password@/api/v1/biblios/XXX/volumes/$volume_id/items" => json => { item_id => $item_1->id } ) |
238 |
->status_is( 201, 'SWAGGER3.2.1' ); |
238 |
->status_is( 409 ) |
|
|
239 |
->json_is( { error => 'Volume does not belong to passed biblio_id' } ); |
240 |
|
241 |
$t->post_ok( "//$userid:$password@/api/v1/biblios/$biblio_id/volumes/$volume_id/items" => json => { item_id => $item_1->id } ) |
242 |
->status_is( 201, 'SWAGGER3.2.1' ); |
239 |
|
243 |
|
240 |
@items = $volume->items; |
244 |
@items = $volume->items; |
241 |
is( scalar(@items), 1, 'Volume now has one item'); |
245 |
is( scalar(@items), 1, 'Volume now has one item'); |
Lines 243-249
subtest 'volume items add() + delete() tests' => sub {
Link Here
|
243 |
my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
247 |
my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
244 |
my $item_2_id = $item_2->id; |
248 |
my $item_2_id = $item_2->id; |
245 |
|
249 |
|
246 |
$t->post_ok( "//$userid:$password@/api/v1/biblios/{biblio_id}/volumes/$volume_id/items" => json => { item_id => $item_2->id } ) |
250 |
$t->post_ok( "//$userid:$password@/api/v1/biblios/$biblio_id/volumes/$volume_id/items" => json => { item_id => $item_2->id } ) |
247 |
->status_is( 201, 'SWAGGER3.2.1' ); |
251 |
->status_is( 201, 'SWAGGER3.2.1' ); |
248 |
|
252 |
|
249 |
@items = $volume->items; |
253 |
@items = $volume->items; |
250 |
- |
|
|