Bugzilla – Attachment 160421 Details for
Bug 35461
Renew All 66 SIP server response messages produce HASH content in replies
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35461: Tidy code
Bug-35461-Tidy-code.patch (text/plain), 5.75 KB, created by
Kyle M Hall (khall)
on 2024-01-02 18:07:10 UTC
(
hide
)
Description:
Bug 35461: Tidy code
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-01-02 18:07:10 UTC
Size:
5.75 KB
patch
obsolete
>From bcdb4c29f7d68d53662fb9396a75be6edaf056cf Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 2 Jan 2024 13:03:26 -0500 >Subject: [PATCH] Bug 35461: Tidy code > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/SIP/Message.t | 118 ++++++++++++++++++++++------------- > 1 file changed, 73 insertions(+), 45 deletions(-) > >diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t >index 0678aa67606..88f4b422d8e 100755 >--- a/t/db_dependent/SIP/Message.t >+++ b/t/db_dependent/SIP/Message.t >@@ -1305,67 +1305,95 @@ sub test_checkout_desensitize { > } > > sub test_renew_all { >- my $builder = t::lib::TestBuilder->new(); >- my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; >+ my $builder = t::lib::TestBuilder->new(); >+ my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode}; > my ( $response, $findpatron ); > my $mocks = create_mocks( \$response, \$findpatron, \$branchcode ); > >- t::lib::Mocks::mock_preference('ItemsDeniedRenewal', 'damaged: [1]'); >+ t::lib::Mocks::mock_preference( 'ItemsDeniedRenewal', 'damaged: [1]' ); > > # create some data >- my $patron1 = $builder->build({ >- source => 'Borrower', >- value => { >- password => hash_password( PATRON_PW ), >- }, >- }); >- my $card1 = $patron1->{cardnumber}; >- my $sip_patron1 = C4::SIP::ILS::Patron->new( $card1 ); >+ my $patron1 = $builder->build( >+ { >+ source => 'Borrower', >+ value => { >+ password => hash_password(PATRON_PW), >+ }, >+ } >+ ); >+ my $card1 = $patron1->{cardnumber}; >+ my $sip_patron1 = C4::SIP::ILS::Patron->new($card1); > my $patron_category = $sip_patron1->ptype(); > $findpatron = $sip_patron1; >- my $item_object_1 = $builder->build_sample_item({ >- damaged => 0, >- withdrawn => 0, >- itemlost => 0, >- restricted => 0, >- homebranch => $branchcode, >- holdingbranch => $branchcode, >- }); >- my $item_object_2 = $builder->build_sample_item({ >- damaged => 1, >- withdrawn => 0, >- itemlost => 0, >- restricted => 0, >- homebranch => $branchcode, >- holdingbranch => $branchcode, >- }); >+ my $item_object_1 = $builder->build_sample_item( >+ { >+ damaged => 0, >+ withdrawn => 0, >+ itemlost => 0, >+ restricted => 0, >+ homebranch => $branchcode, >+ holdingbranch => $branchcode, >+ } >+ ); >+ my $item_object_2 = $builder->build_sample_item( >+ { >+ damaged => 1, >+ withdrawn => 0, >+ itemlost => 0, >+ restricted => 0, >+ homebranch => $branchcode, >+ holdingbranch => $branchcode, >+ } >+ ); > > my $mockILS = $mocks->{ils}; >- my $server = { ils => $mockILS, account => {} }; >+ my $server = { ils => $mockILS, account => {} }; > $mockILS->mock( 'institution', sub { $branchcode; } ); >- $mockILS->mock( 'supports', sub { return; } ); >- $mockILS->mock( 'renew_all', sub { >- shift; >- return C4::SIP::ILS->renew_all(@_); >- }); >+ $mockILS->mock( 'supports', sub { return; } ); >+ $mockILS->mock( >+ 'renew_all', >+ sub { >+ shift; >+ return C4::SIP::ILS->renew_all(@_); >+ } >+ ); > my $today = dt_from_string; >- t::lib::Mocks::mock_userenv({ branchcode => $branchcode, flags => 1 }); >+ t::lib::Mocks::mock_userenv( { branchcode => $branchcode, flags => 1 } ); > >- my $issue_1 = Koha::Checkout->new({ branchcode => $branchcode, borrowernumber => $patron1->{borrowernumber}, itemnumber => $item_object_1->itemnumber })->store; >- my $issue_2 = Koha::Checkout->new({ branchcode => $branchcode, borrowernumber => $patron1->{borrowernumber}, itemnumber => $item_object_2->itemnumber })->store; >+ my $issue_1 = Koha::Checkout->new( >+ { >+ branchcode => $branchcode, >+ borrowernumber => $patron1->{borrowernumber}, >+ itemnumber => $item_object_1->itemnumber >+ } >+ )->store; >+ my $issue_2 = Koha::Checkout->new( >+ { >+ branchcode => $branchcode, >+ borrowernumber => $patron1->{borrowernumber}, >+ itemnumber => $item_object_2->itemnumber >+ } >+ )->store; > >- my $siprequest = RENEW_ALL . siprequestdate($today) . >- FID_INST_ID . $branchcode . '|'. >- FID_PATRON_ID . $sip_patron1->id . '|' . >- FID_TERMINAL_PWD . 'ignored' . '|'; >+ my $siprequest = >+ RENEW_ALL >+ . siprequestdate($today) >+ . FID_INST_ID >+ . $branchcode . '|' >+ . FID_PATRON_ID >+ . $sip_patron1->id . '|' >+ . FID_TERMINAL_PWD >+ . 'ignored' . '|'; > > undef $response; > my $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 ); >- $msg->handle_renew_all( $server ); >- isnt( index($response, "BM" . $item_object_1->barcode), -1, "Found corrent BM for item renewed successfully" ); >- isnt( index($response, "BN" . $item_object_2->barcode), -1, "Found corrent BN for item not renewed" ); >- is( index($response, "C4::SIP::SIPServer" . $item_object_2->barcode), -1, "String 'C4::SIP::SIPServer' not found in reponse ( Bug 35461 )" ); >- >+ $msg->handle_renew_all($server); >+ isnt( index( $response, "BM" . $item_object_1->barcode ), >+ -1, "Found correct BM for item renewed successfully" ); >+ isnt( index( $response, "BN" . $item_object_2->barcode ), >+ -1, "Found correct BN for item not renewed" ); >+ is( index( $response, "C4::SIP::SIPServer" . $item_object_2->barcode ), >+ -1, "String 'C4::SIP::SIPServer' not found in response ( Bug 35461 )" ); > } > > sub test_renew_desensitize { >-- >2.30.2
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 35461
:
160419
|
160420
|
160421
|
160436
|
160437
|
160438
|
160453
|
160454
|
160496
|
160497
|
160685
|
161501
|
161502