Bugzilla – Attachment 176847 Details for
Bug 38926
POST /biblios returns 200 even if AddBiblio fails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38926: Regression tests
Bug-38926-Regression-tests.patch (text/plain), 1.53 KB, created by
Jonathan Druart
on 2025-01-21 08:35:05 UTC
(
hide
)
Description:
Bug 38926: Regression tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-01-21 08:35:05 UTC
Size:
1.53 KB
patch
obsolete
>From 5e2f142a61a9ef2d0bbc369e0ea5eb3b2ec5add5 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 20 Jan 2025 10:05:56 -0300 >Subject: [PATCH] Bug 38926: Regression tests > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/api/v1/biblios.t | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t >index c10bae833e4..c44509033e7 100755 >--- a/t/db_dependent/api/v1/biblios.t >+++ b/t/db_dependent/api/v1/biblios.t >@@ -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; > }; > >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38926
:
176795
|
176796
|
176835
|
176847
|
176848
|
176890
|
176891