Bug 38926: Regression tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Tomas Cohen Arazi 2025-01-20 10:05:56 -03:00 committed by Katrin Fischer
parent d6a4637ff6
commit 384b869ccd
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 18 additions and 2 deletions

View File

@ -899,9 +899,9 @@ subtest 'set_rating() tests' => sub {
};
subtest 'post() tests' => sub {
subtest 'add() tests' => sub {
plan tests => 14;
plan tests => 17;
$schema->storage->txn_begin;
@ -1358,6 +1358,22 @@ subtest 'post() tests' => sub {
)->status_is(200);
};
my $mock_biblio = Test::MockModule->new('C4::Biblio');
# FIXME: AddBiblio wraps everything inside a transaction and a try/catch block
# this will need a tweak if this behavior changes
$mock_biblio->mock( 'AddBiblio', sub { return ( undef, undef ); } );
$t->post_ok( "//$userid:$password@/api/v1/biblios" =>
{ 'Content-Type' => 'application/marc', 'x-framework-id' => $frameworkcode } => $marc )
->status_is(400)
->json_is(
{
error => 'Error creating record',
error_code => 'record_creation_failed'
}
);
$schema->storage->txn_rollback;
};