Bugzilla – Attachment 172048 Details for
Bug 37856
Some SUSHI providers require the platform parameter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37856: (QA follow-up) Tidy
Bug-37856-QA-follow-up-Tidy.patch (text/plain), 7.97 KB, created by
Nick Clemens (kidclamp)
on 2024-09-26 19:22:15 UTC
(
hide
)
Description:
Bug 37856: (QA follow-up) Tidy
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-09-26 19:22:15 UTC
Size:
7.97 KB
patch
obsolete
>From eeb78f0442d97acd8786ca532df710d219bb9dd2 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 26 Sep 2024 19:20:15 +0000 >Subject: [PATCH] Bug 37856: (QA follow-up) Tidy > >--- > Koha/ERM/EUsage/UsageDataProvider.pm | 4 +- > .../data/mysql/atomicupdate/bug_37856.pl | 10 ++-- > .../Koha/BackgroundJob/ErmSushiHarvester.t | 58 +++++++++++++------ > 3 files changed, 48 insertions(+), 24 deletions(-) > >diff --git a/Koha/ERM/EUsage/UsageDataProvider.pm b/Koha/ERM/EUsage/UsageDataProvider.pm >index 1f094e15d39..ab9f314c80c 100644 >--- a/Koha/ERM/EUsage/UsageDataProvider.pm >+++ b/Koha/ERM/EUsage/UsageDataProvider.pm >@@ -475,8 +475,8 @@ sub _sushi_errors { > } > > my $exceptions = $decoded_response->{Report_Header}->{Exceptions} // $decoded_response->{Exceptions}; >- if ( $exceptions ) { >- foreach my $exception ( @{ $exceptions } ) { >+ if ($exceptions) { >+ foreach my $exception ( @{$exceptions} ) { > $self->{job_callbacks}->{add_message_callback}->( > { > type => 'error', >diff --git a/installer/data/mysql/atomicupdate/bug_37856.pl b/installer/data/mysql/atomicupdate/bug_37856.pl >index 0d62d171436..8544c30b5fc 100755 >--- a/installer/data/mysql/atomicupdate/bug_37856.pl >+++ b/installer/data/mysql/atomicupdate/bug_37856.pl >@@ -8,11 +8,13 @@ return { > my ($args) = @_; > my ( $dbh, $out ) = @$args{qw(dbh out)}; > >- if( !column_exists( 'erm_usage_data_providers', 'service_platform' ) ) { >- $dbh->do(q{ >+ if ( !column_exists( 'erm_usage_data_providers', 'service_platform' ) ) { >+ $dbh->do( >+ q{ > ALTER TABLE erm_usage_data_providers ADD COLUMN `service_platform` varchar(80) DEFAULT NULL COMMENT 'platform if provider requires it' AFTER `report_types` >- }); >- say_info( $out, "Bug 37856 - Added service_platform column to table 'erm_usage_data_providers'" ); >+ } >+ ); >+ say_info( $out, "Bug 37856 - Added service_platform column to table 'erm_usage_data_providers'" ); > } > say_success( $out, "Bug 37856 - Done" ); > }, >diff --git a/t/db_dependent/Koha/BackgroundJob/ErmSushiHarvester.t b/t/db_dependent/Koha/BackgroundJob/ErmSushiHarvester.t >index a3b26367f12..874a5e99d81 100755 >--- a/t/db_dependent/Koha/BackgroundJob/ErmSushiHarvester.t >+++ b/t/db_dependent/Koha/BackgroundJob/ErmSushiHarvester.t >@@ -41,7 +41,8 @@ my $sushi_response_errors = { > }; > > my $sushi_response_exceptions = { >- 'multiple_exceptions' => '{"Created":"2024-09-06T10:41:02Z","Created_By":"Test Services","Customer_ID":"Test_customer_id","Report_ID":"TR_J1","Release":"5","Report_Name":"Journal Requests (Excluding OA_Gold)","Institution_Name":"Test Institution","Report_Filters":[{"Name":"Begin_Date","Value":"2024-06-01"},{"Name":"End_Date","Value":"2024-08-31"}],"Exceptions":[{"Code":3050,"Severity":"Warning","Message":"Parameter Not Recognized in this Context","Data":"Parameter api_key is not recognized"},{"Code":3070,"Severity":"Error","Message":"Required ReportFilter Missing","Data":"Required parameter Platform is missing and should be one of:sd|sc|ev|em|ck"}]}', >+ 'multiple_exceptions' => >+ '{"Created":"2024-09-06T10:41:02Z","Created_By":"Test Services","Customer_ID":"Test_customer_id","Report_ID":"TR_J1","Release":"5","Report_Name":"Journal Requests (Excluding OA_Gold)","Institution_Name":"Test Institution","Report_Filters":[{"Name":"Begin_Date","Value":"2024-06-01"},{"Name":"End_Date","Value":"2024-08-31"}],"Exceptions":[{"Code":3050,"Severity":"Warning","Message":"Parameter Not Recognized in this Context","Data":"Parameter api_key is not recognized"},{"Code":3070,"Severity":"Error","Message":"Required ReportFilter Missing","Data":"Required parameter Platform is missing and should be one of:sd|sc|ev|em|ck"}]}', > }; > > subtest 'enqueue() tests' => sub { >@@ -173,32 +174,53 @@ subtest 'multiple_exceptions() tests' => sub { > $schema->storage->txn_begin; > > my $ua = Test::MockModule->new('LWP::UserAgent'); >- $ua->mock('simple_request', sub { >- return mock_sushi_response({'exception'=>'multiple_exceptions'}); >- }); >+ $ua->mock( >+ 'simple_request', >+ sub { >+ return mock_sushi_response( { 'exception' => 'multiple_exceptions' } ); >+ } >+ ); > > 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, >- }; >+ 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 ); >+ my $job = Koha::BackgroundJobs->find($job_id)->_derived_class; >+ $job->process($job_args); > >- is( $job->{messages}[0]->{message}, decode_json($sushi_response_exceptions->{multiple_exceptions})->{Exceptions}[0]->{Message} . ' - ' . decode_json($sushi_response_exceptions->{multiple_exceptions})->{Exceptions}[0]->{Data},'SUSHI exceptions multiple_exceptions are stored on job messages correctly' ); >- is( $job->{messages}[0]->{type},'error','SUSHI error multiple_exceptions are stored on job messages correctly' ); >- is( $job->{messages}[0]->{code},decode_json($sushi_response_exceptions->{multiple_exceptions})->{Exceptions}[0]->{Code},'SUSHI error multiple_exceptions are stored on job messages correctly' ); >+ is( >+ $job->{messages}[0]->{message}, >+ decode_json( $sushi_response_exceptions->{multiple_exceptions} )->{Exceptions}[0]->{Message} . ' - ' >+ . decode_json( $sushi_response_exceptions->{multiple_exceptions} )->{Exceptions}[0]->{Data}, >+ 'SUSHI exceptions multiple_exceptions are stored on job messages correctly' >+ ); >+ is( $job->{messages}[0]->{type}, 'error', 'SUSHI error multiple_exceptions are stored on job messages correctly' ); >+ is( >+ $job->{messages}[0]->{code}, >+ decode_json( $sushi_response_exceptions->{multiple_exceptions} )->{Exceptions}[0]->{Code}, >+ 'SUSHI error multiple_exceptions are stored on job messages correctly' >+ ); > >- is( $job->{messages}[1]->{message}, decode_json($sushi_response_exceptions->{multiple_exceptions})->{Exceptions}[1]->{Message} . ' - ' . decode_json($sushi_response_exceptions->{multiple_exceptions})->{Exceptions}[1]->{Data},'SUSHI exceptions multiple_exceptions are stored on job messages correctly' ); >- is( $job->{messages}[1]->{type},'error','SUSHI error multiple_exceptions are stored on job messages correctly' ); >- is( $job->{messages}[1]->{code},decode_json($sushi_response_exceptions->{multiple_exceptions})->{Exceptions}[1]->{Code},'SUSHI error multiple_exceptions are stored on job messages correctly' ); >+ is( >+ $job->{messages}[1]->{message}, >+ decode_json( $sushi_response_exceptions->{multiple_exceptions} )->{Exceptions}[1]->{Message} . ' - ' >+ . decode_json( $sushi_response_exceptions->{multiple_exceptions} )->{Exceptions}[1]->{Data}, >+ 'SUSHI exceptions multiple_exceptions are stored on job messages correctly' >+ ); >+ is( $job->{messages}[1]->{type}, 'error', 'SUSHI error multiple_exceptions are stored on job messages correctly' ); >+ is( >+ $job->{messages}[1]->{code}, >+ decode_json( $sushi_response_exceptions->{multiple_exceptions} )->{Exceptions}[1]->{Code}, >+ 'SUSHI error multiple_exceptions are stored on job messages correctly' >+ ); > > $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 37856
:
171680
|
171681
|
171682
|
171683
|
171773
|
171774
|
171775
|
171893
|
171894
|
171895
|
171896
|
171897
|
171898
|
171899
|
172040
|
172042
|
172043
|
172044
|
172045
|
172046
|
172047
| 172048 |
172155
|
172156
|
172215