Bugzilla – Attachment 182817 Details for
Bug 39823
SUSHI harvest fails to display error if the provider's response does not contain Severity
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39823: Add tests
Bug-39823-Add-tests.patch (text/plain), 3.06 KB, created by
Nick Clemens (kidclamp)
on 2025-05-28 12:12:13 UTC
(
hide
)
Description:
Bug 39823: Add tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-05-28 12:12:13 UTC
Size:
3.06 KB
patch
obsolete
>From f0605aa2c95a03a40601844ed40397f926734022 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Mon, 5 May 2025 10:27:26 +0000 >Subject: [PATCH] Bug 39823: Add tests > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../Koha/BackgroundJobs/ErmSushiHarvester.t | 74 ++++++++++++++++++- > 1 file changed, 72 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t b/t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t >index 18ffa61f8e8..3bc6a70e113 100755 >--- a/t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t >+++ b/t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > > use Test::NoWarnings; >-use Test::More tests => 3; >+use Test::More tests => 4; > > use Koha::Database; > use Koha::BackgroundJobs; >@@ -153,7 +153,6 @@ subtest 'enqueue_sushi_harvest_jobs' => sub { > is( $another_report->{us_report_info}->{added_mus}, 0 ); > is( $another_report->{us_report_info}->{added_usage_objects}, 0 ); > >- #TODO: Test a harvest with sushi errors > #TODO: Test more report types > > $schema->storage->txn_rollback; >@@ -236,3 +235,74 @@ subtest 'enqueue_counter_file_processing_job' => sub { > $schema->storage->txn_rollback; > > }; >+ >+$ua->unmock_all; >+$ua->mock( >+ 'simple_request', >+ sub { >+ my $response = Test::MockObject->new(); >+ >+ $response->mock( >+ 'code', >+ sub { >+ return 200; >+ } >+ ); >+ $response->mock( >+ 'is_error', >+ sub { >+ return 0; >+ } >+ ); >+ $response->mock( >+ 'is_redirect', >+ sub { >+ return 0; >+ } >+ ); >+ $response->mock( >+ 'decoded_content', >+ sub { >+ return '{ >+ "Code": 2010, >+ "Message": "Requestor is Not Authorized to Access Usage for Institution" >+ }'; >+ } >+ ); >+ $response->{_rc} = 200; >+ return $response; >+ } >+); >+ >+subtest 'enqueue_sushi_harvest_jobs_error_handling' => sub { >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ my $usage_data_provider_error = $builder->build_object( >+ { class => 'Koha::ERM::EUsage::UsageDataProviders', value => { name => 'TestProvider' } } ); >+ >+ my $job = Koha::BackgroundJob::ErmSushiHarvester->new( >+ { >+ status => 'new', >+ size => 1, >+ type => 'erm_sushi_harvester' >+ } >+ )->store; >+ >+ $job = Koha::BackgroundJobs->find( $job->id ); >+ >+ $job->process( >+ { >+ job_id => $job->id, >+ ud_provider_id => $usage_data_provider_error->erm_usage_data_provider_id, >+ report_type => 'TR_J1', >+ } >+ ); >+ >+ is( ref $job->messages, 'ARRAY', 'messages is an array' ); >+ is( $job->messages->[0]->{code}, 2010, 'first message has code 2010' ); >+ >+ $schema->storage->txn_rollback; >+ >+}; >-- >2.39.5
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 39823
:
181904
|
181905
|
181906
|
182121
|
182122
|
182123
|
182816
| 182817 |
182818