Bugzilla – Attachment 149462 Details for
Bug 31795
Add POST endpoint for Authorities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31795: (follow-up) Mock call to FindDuplicateAuthority
Bug-31795-follow-up-Mock-call-to-FindDuplicateAuth.patch (text/plain), 2.15 KB, created by
David Nind
on 2023-04-11 18:11:46 UTC
(
hide
)
Description:
Bug 31795: (follow-up) Mock call to FindDuplicateAuthority
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-04-11 18:11:46 UTC
Size:
2.15 KB
patch
obsolete
>From ec7d5303f7ce1605554650d9240f1872f4c5075c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 11 Apr 2023 12:04:17 -0300 >Subject: [PATCH] Bug 31795: (follow-up) Mock call to FindDuplicateAuthority > >When running against Zebra, this tests fail because it requires the >record to be indexed timely. In theory, a 5 seconds delay should be >enough for the indexer to pick up. But that's not the point of the test, >and we should better just mock the query in this case. > >To test: >1. Have ktd launch with zebra: > $ ktd up -d >2. Run: > $ ktd --shell > k$ prove t/db_dependent/api/v1/authorities.t >=> FAIL: Tests fail! >3. Apply this patch >4. Repeat 2 >=> SUCCESS: Tests pass! >5. Launch ktd with ES: > $ ktd down > $ ktd --es7 up -d >6. Repeat 2 >=> SUCCESS: Tests pass! >7. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/REST/V1/Authorities.pm | 2 +- > t/db_dependent/api/v1/authorities.t | 3 +++ > 2 files changed, 4 insertions(+), 1 deletion(-) > >diff --git a/Koha/REST/V1/Authorities.pm b/Koha/REST/V1/Authorities.pm >index 8a6c24b2c1..b46be125b7 100644 >--- a/Koha/REST/V1/Authorities.pm >+++ b/Koha/REST/V1/Authorities.pm >@@ -169,7 +169,7 @@ sub add { > } > > unless ( $overrides->{any} || $overrides->{duplicate} ) { >- my ( $duplicateauthid, $duplicateauthvalue ) = FindDuplicateAuthority( $record, $authtypecode ); >+ my ( $duplicateauthid, $duplicateauthvalue ) = C4::AuthoritiesMarc::FindDuplicateAuthority( $record, $authtypecode ); > > return $c->render( > status => 409, >diff --git a/t/db_dependent/api/v1/authorities.t b/t/db_dependent/api/v1/authorities.t >index 3da737e9ad..8c8056323b 100755 >--- a/t/db_dependent/api/v1/authorities.t >+++ b/t/db_dependent/api/v1/authorities.t >@@ -159,6 +159,9 @@ subtest 'post() tests' => sub { > > $schema->storage->txn_begin; > >+ my $authorities_mock = Test::MockModule->new('C4::AuthoritiesMarc'); >+ $authorities_mock->mock( 'FindDuplicateAuthority', sub { return 1234; } ); >+ > my $patron = $builder->build_object( > { > class => 'Koha::Patrons', >-- >2.30.2
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 31795
:
144555
|
144746
|
144747
|
144749
|
144750
|
149380
|
149407
|
149409
|
149451
|
149459
|
149460
|
149461
|
149462
|
150370
|
150371
|
150372
|
150373