Bugzilla – Attachment 172009 Details for
Bug 37963
Improve error handling and testing of ERM eUsage SUSHI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37963: Case 2 - Add tests for different case error message
Bug-37963-Case-2---Add-tests-for-different-case-er.patch (text/plain), 2.88 KB, created by
Nick Clemens (kidclamp)
on 2024-09-26 18:38:01 UTC
(
hide
)
Description:
Bug 37963: Case 2 - Add tests for different case error message
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-09-26 18:38:01 UTC
Size:
2.88 KB
patch
obsolete
>From 17f0905d584318f4b01d09f60139fe0817ed031f Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 19 Sep 2024 13:49:58 +0000 >Subject: [PATCH] Bug 37963: Case 2 - Add tests for different case error > message > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../Koha/BackgroundJob/ErmSushiHarvester.t | 36 ++++++++++++++++++- > 1 file changed, 35 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/BackgroundJob/ErmSushiHarvester.t b/t/db_dependent/Koha/BackgroundJob/ErmSushiHarvester.t >index 614b5f8b0f2..f0e736006c3 100755 >--- a/t/db_dependent/Koha/BackgroundJob/ErmSushiHarvester.t >+++ b/t/db_dependent/Koha/BackgroundJob/ErmSushiHarvester.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > > use Koha::Database; > use Koha::BackgroundJobs; >@@ -36,6 +36,7 @@ my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; > > my $sushi_response_errors = { >+ 'invalid_date_arguments' => '{"message":"Invalid Date Arguments","code":3020,"severity":"Error"}', > 'invalid_api_key' => '{"Code": 2020, "Severity": "Error", "Message": "API Key Invalid"}', > }; > >@@ -67,6 +68,39 @@ subtest 'enqueue() tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'invalid_date_arguments() tests' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $ua = Test::MockModule->new('LWP::UserAgent'); >+ $ua->mock('simple_request', sub { >+ return mock_sushi_response({'error'=>'invalid_date_arguments'}); >+ }); >+ >+ my $usage_data_provider = $builder->build_object( >+ { class => 'Koha::ERM::EUsage::UsageDataProviders', value => { name => 'TestProvider' } } ); >+ >+ my $job_args = { >+ ud_provider_id => $usage_data_provider->erm_usage_data_provider_id, >+ report_type => 'TR_J1', >+ begin_date => '2023-08-01', >+ end_date => '2023-09-30', >+ ud_provider_name => $usage_data_provider->name, >+ }; >+ >+ my $job_id = Koha::BackgroundJob::ErmSushiHarvester->new->enqueue($job_args); >+ my $job = Koha::BackgroundJobs->find($job_id)->_derived_class; >+ $job->process( $job_args ); >+ >+ is( $job->{messages}[0]->{message}, decode_json($sushi_response_errors->{invalid_date_arguments})->{severity} . ' - ' . decode_json($sushi_response_errors->{invalid_date_arguments})->{message},'SUSHI error invalid_date_arguments is stored on job messages correctly' ); >+ is( $job->{messages}[0]->{type},'error','SUSHI error invalid_date_arguments is stored on job messages correctly' ); >+ is( $job->{messages}[0]->{code},decode_json($sushi_response_errors->{invalid_date_arguments})->{code},'SUSHI error invalid_date_arguments is stored on job messages correctly' ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'invalid_api_key() tests' => sub { > > plan tests => 3; >-- >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 37963
:
171769
|
171770
|
171771
|
171772
|
171887
|
171888
|
171889
|
171890
|
172007
|
172008
| 172009 |
172010
|
172011