Bugzilla – Attachment 149451 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.11 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-04-11 15:38:27 UTC
(
hide
)
Description:
Bug 31795: (follow-up) Mock call to FindDuplicateAuthority
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-04-11 15:38:27 UTC
Size:
2.11 KB
patch
obsolete
>From f87d4e62a973551a092b49217644894aff86668f 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> >--- > 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 8a6c24b2c1f..b46be125b7c 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 3da737e9add..8c8056323bb 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.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 31795
:
144555
|
144746
|
144747
|
144749
|
144750
|
149380
|
149407
|
149409
|
149451
|
149459
|
149460
|
149461
|
149462
|
150370
|
150371
|
150372
|
150373