Lines 192-198
subtest 'get() tests' => sub {
Link Here
|
192 |
|
192 |
|
193 |
subtest 'add() tests' => sub { |
193 |
subtest 'add() tests' => sub { |
194 |
|
194 |
|
195 |
plan tests => 24; |
195 |
plan tests => 25; |
196 |
|
196 |
|
197 |
$schema->storage->txn_begin; |
197 |
$schema->storage->txn_begin; |
198 |
|
198 |
|
Lines 331-336
subtest 'add() tests' => sub {
Link Here
|
331 |
] |
331 |
] |
332 |
); |
332 |
); |
333 |
|
333 |
|
|
|
334 |
subtest 'add eholdings title linked to biblio tests' => sub { |
335 |
|
336 |
plan tests => 4; |
337 |
|
338 |
delete $ehtitle->{title_id}; |
339 |
my $request_body = { |
340 |
%{$ehtitle}, |
341 |
}; |
342 |
$request_body->{create_linked_biblio} = 1; |
343 |
my $biblios_count = Koha::Biblios->search()->count; |
344 |
$t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles/" => json => $request_body ) |
345 |
->status_is(201)->json_is( '/publication_title' => 'Publication title' ); |
346 |
my $new_biblios_count = Koha::Biblios->search()->count; |
347 |
is( $new_biblios_count, $biblios_count + 1, "Biblio was added" ); |
348 |
}; |
349 |
|
334 |
$schema->storage->txn_rollback; |
350 |
$schema->storage->txn_rollback; |
335 |
}; |
351 |
}; |
336 |
|
352 |
|
Lines 471-479
subtest 'update() tests' => sub {
Link Here
|
471 |
->title_id; |
487 |
->title_id; |
472 |
my $ehtitle_updated_title = { publication_title => "The journal of writing unit tests :" }; |
488 |
my $ehtitle_updated_title = { publication_title => "The journal of writing unit tests :" }; |
473 |
|
489 |
|
474 |
$t->put_ok( |
490 |
$t->put_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id" => json => |
475 |
"//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id" => json => $ehtitle_updated_title ) |
491 |
{ %$ehtitle_updated_title, create_linked_biblio => 1 } )->status_is(200) |
476 |
->status_is(200)->json_is( '/publication_title' => 'The journal of writing unit tests :' ); |
492 |
->json_is( '/publication_title' => 'The journal of writing unit tests :' ); |
477 |
|
493 |
|
478 |
$biblio->discard_changes; |
494 |
$biblio->discard_changes; |
479 |
|
495 |
|
480 |
- |
|
|