Bugzilla – Attachment 183853 Details for
Bug 40317
Auth_with_shibboleth.t generates warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40317: Remove warnings from Auth_with_shibboleth.t output
Bug-40317-Remove-warnings-from-Authwithshibboletht.patch (text/plain), 4.19 KB, created by
Martin Renvoize (ashimema)
on 2025-07-08 07:03:53 UTC
(
hide
)
Description:
Bug 40317: Remove warnings from Auth_with_shibboleth.t output
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-07-08 07:03:53 UTC
Size:
4.19 KB
patch
obsolete
>From 05f0c8a5ffd9fd2f93a0a889e389d237801f6477 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 7 Jul 2025 13:58:37 +0200 >Subject: [PATCH] Bug 40317: Remove warnings from Auth_with_shibboleth.t output > >t/db_dependent/Auth_with_shibboleth.t .. 1/5 GetPreparedLetter called at t/db_dependent/Auth_with_shibboleth.t line 73. >EnqueueLetter called at t/db_dependent/Auth_with_shibboleth.t line 80. >SendQueuedMessages called with message_id: 42 at t/db_dependent/Auth_with_shibboleth.t line 90. > >Not sure what exactly is going on here, but warnings_are is not supposed >to show the warnings in the output. I think it's because of the logger >mock. A workaround is to use a variable we increment then compare to see >if we reach the sub. > >Test plan: > % prove t/db_dependent/Auth_with_shibboleth.t >should return green without warnings > >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > t/db_dependent/Auth_with_shibboleth.t | 31 ++++++++++++--------------- > 1 file changed, 14 insertions(+), 17 deletions(-) > >diff --git a/t/db_dependent/Auth_with_shibboleth.t b/t/db_dependent/Auth_with_shibboleth.t >index db6ce0b1cba..b7cfdbbfb2b 100755 >--- a/t/db_dependent/Auth_with_shibboleth.t >+++ b/t/db_dependent/Auth_with_shibboleth.t >@@ -20,9 +20,10 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 6; >+use Test::More tests => 7; > use Test::MockModule; > use Test::Warn; >+use Test::NoWarnings; > use CGI qw(-utf8 ); > use File::Temp qw(tempdir); > >@@ -67,17 +68,18 @@ $context->mock( 'interface', sub { return $interface; } ); > # Mock Letters: GetPreparedLetter, EnqueueLetter and SendQueuedMessages > # We want to test the params > my $mocked_letters = Test::MockModule->new('C4::Letters'); >+my $sub_called = {}; > $mocked_letters->mock( > 'GetPreparedLetter', > sub { >- warn "GetPreparedLetter called"; >+ $sub_called->{GetPreparedLetter}++; > return 1; > } > ); > $mocked_letters->mock( > 'EnqueueLetter', > sub { >- warn "EnqueueLetter called"; >+ $sub_called->{EnqueueLetter}++; > > # return a 'message_id' > return 42; >@@ -87,7 +89,7 @@ $mocked_letters->mock( > 'SendQueuedMessages', > sub { > my $params = shift; >- warn "SendQueuedMessages called with message_id: $params->{message_id}"; >+ $sub_called->{SendQueuedMessages}->{ $params->{message_id} }++; > return 1; > } > ); >@@ -172,7 +174,7 @@ subtest "get_login_shib tests" => sub { > > subtest "checkpw_shib tests" => sub { > >- plan tests => 54; >+ plan tests => 56; > > # Test borrower data > my $test_borrowers = [ >@@ -251,18 +253,13 @@ subtest "checkpw_shib tests" => sub { > $ENV{'emailpro'} = 'me@myemail.com'; > $ENV{branchcode} = $library->branchcode; # needed since T::D::C does no longer hides the FK constraint > >- warnings_are { >- ( $retval, $retcard, $retuserid, $retpatron ) = checkpw_shib($shib_login); >- } >- [ >- 'GetPreparedLetter called', >- 'EnqueueLetter called', >- 'SendQueuedMessages called with message_id: 42' >- ], >- "WELCOME notice Prepared, Enqueued and Send"; >- is( $retval, "1", "user authenticated" ); >- is( $retuserid, "test4321", "expected userid returned" ); >- is( ref($retpatron), 'Koha::Patron', "expected Koha::Patron object returned" ); >+ ( $retval, $retcard, $retuserid, $retpatron ) = checkpw_shib($shib_login); >+ is( $sub_called->{GetPreparedLetter}, 1, 'GetPreparedLetter called' ); >+ is( $sub_called->{EnqueueLetter}, 1, 'EnqueueLetter called' ); >+ is( $sub_called->{SendQueuedMessages}->{42}, 1, 'SendQueuedMessages called with message_id: 42' ); >+ is( $retval, "1", "user authenticated" ); >+ is( $retuserid, "test4321", "expected userid returned" ); >+ is( ref($retpatron), 'Koha::Patron', "expected Koha::Patron object returned" ); > $logger->debug_is( "koha borrower field to match: userid", "borrower match field debug info" ) > ->debug_is( "shibboleth attribute to match: uid", "shib match attribute debug info" )->clear(); > >-- >2.50.0
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 40317
:
183834
| 183853