Bugzilla – Attachment 108734 Details for
Bug 25903
Sending a SIP patron information request with a summary field flag in indexes 6-9 will crash server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25903: Add unit tests
Bug-25903-Add-unit-tests.patch (text/plain), 2.63 KB, created by
Kyle M Hall
on 2020-08-20 11:56:43 UTC
(
hide
)
Description:
Bug 25903: Add unit tests
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2020-08-20 11:56:43 UTC
Size:
2.63 KB
patch
obsolete
>From 9a525191f057210832daf168dda401f1298e3ac5 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 20 Aug 2020 07:56:12 -0400 >Subject: [PATCH] Bug 25903: Add unit tests > >--- > t/db_dependent/SIP/Message.t | 56 +++++++++++++++++++++++++++++++++++- > 1 file changed, 55 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t >index 3b6eed812d..f875fd7738 100755 >--- a/t/db_dependent/SIP/Message.t >+++ b/t/db_dependent/SIP/Message.t >@@ -21,7 +21,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 7; >+use Test::More tests => 8; > use Test::MockObject; > use Test::MockModule; > use Test::Warn; >@@ -196,6 +196,60 @@ subtest "Test build_additional_item_fields_string" => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'Patron info summary > 5 should not crash server' => sub { >+ >+ my $schema = Koha::Database->new->schema; >+ $schema->storage->txn_begin; >+ >+ plan tests => 22; >+ my $builder = t::lib::TestBuilder->new(); >+ my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; >+ my ( $response, $findpatron ); >+ my $mocks = create_mocks( \$response, \$findpatron, \$branchcode ); >+ my $seen_patron = $builder->build({ >+ source => 'Borrower', >+ value => { >+ lastseen => '2001-01-01', >+ password => hash_password( PATRON_PW ), >+ branchcode => $branchcode, >+ }, >+ }); >+ my $cardnum = $seen_patron->{cardnumber}; >+ my $sip_patron = C4::SIP::ILS::Patron->new( $cardnum ); >+ $findpatron = $sip_patron; >+ >+ my @summaries = ( >+ ' ', >+ 'Y ', >+ ' Y ', >+ ' Y ', >+ ' Y ', >+ ' Y ', >+ ' Y ', >+ ' Y ', >+ ' Y ', >+ ' Y ', >+ ' Y', >+ ); >+ for my $summary ( @summaries ) { >+ my $siprequest = PATRON_INFO . 'engYYYYMMDDZZZZHHMMSS' . $summary . >+ FID_INST_ID . $branchcode . '|' . >+ FID_PATRON_ID . $cardnum . '|' . >+ FID_PATRON_PWD . PATRON_PW . '|'; >+ my $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); >+ >+ my $server = { ils => $mocks->{ils} }; >+ undef $response; >+ $msg->handle_patron_info( $server ); >+ >+ isnt( $response, undef, 'At least we got a response.' ); >+ my $respcode = substr( $response, 0, 2 ); >+ is( $respcode, PATRON_INFO_RESP, 'Response code fine' ); >+ } >+ >+ $schema->storage->txn_rollback; >+}; >+ > # Here is room for some more subtests > > # END of main code >-- >2.24.1 (Apple Git-126)
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 25903
:
106443
|
106452
|
108632
| 108734