Bugzilla – Attachment 172384 Details for
Bug 23426
Empty AV field returned in 'patron info' in addition to those requested
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23426: (follow-up) Add tests
Bug-23426-follow-up-Add-tests.patch (text/plain), 3.79 KB, created by
Marcel de Rooy
on 2024-10-04 09:38:29 UTC
(
hide
)
Description:
Bug 23426: (follow-up) Add tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2024-10-04 09:38:29 UTC
Size:
3.79 KB
patch
obsolete
>From 33d04fa77113cd9e3920ba40accabceba7fcbe90 Mon Sep 17 00:00:00 2001 >From: Jan Kissig <jkissig@th-wildau.de> >Date: Mon, 22 Jul 2024 12:41:40 +0200 >Subject: [PATCH] Bug 23426: (follow-up) Add tests >Content-Type: text/plain; charset=utf-8 > >Test plan: >[1] Prove t/db_dependent/SIP/Message.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >EDIT: Tidied inline. >--- > t/db_dependent/SIP/Message.t | 86 +++++++++++++++++++++++++++++++++++- > 1 file changed, 85 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t >index b7c01b4f71..7975619b07 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 => 19; >+use Test::More tests => 20; > use Test::Exception; > use Test::MockObject; > use Test::MockModule; >@@ -249,6 +249,90 @@ subtest 'Lastseen response patron info' => sub { > > }; > >+subtest 'Fine items, currency, start and end item response in patron info' => sub { >+ >+ plan tests => 6; >+ >+ my $schema = Koha::Database->new->schema; >+ $schema->storage->txn_begin; >+ >+ my $builder = t::lib::TestBuilder->new(); >+ my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode}; >+ my ( $response, $findpatron ); >+ my $mocks = create_mocks( \$response, \$findpatron, \$branchcode ); >+ my $patron_with_fines = $builder->build( >+ { >+ source => 'Borrower', >+ value => { >+ password => hash_password(PATRON_PW), >+ branchcode => $branchcode, >+ }, >+ } >+ ); >+ >+ # SIP2 currency field is limited to 3 chars >+ my $currency = substr Koha::Acquisition::Currencies->get_active->currency, >+ 0, 3; >+ >+ my $account = Koha::Account->new( { patron_id => $patron_with_fines->{borrowernumber} } ); >+ >+ my $amount1 = '1.00'; >+ my $amount2 = '2.00'; >+ my $amount3 = '3.00'; >+ >+ my $debt1 = $account->add_debit( { type => 'ACCOUNT', amount => $amount1, interface => 'commandline' } ); >+ my $debt2 = $account->add_debit( { type => 'ACCOUNT', amount => $amount2, interface => 'commandline' } ); >+ my $debt3 = $account->add_debit( { type => 'ACCOUNT', amount => $amount3, interface => 'commandline' } ); >+ >+ my $cardnum = $patron_with_fines->{cardnumber}; >+ my $sip_patron = C4::SIP::ILS::Patron->new($cardnum); >+ $findpatron = $sip_patron; >+ >+ my $siprequest = >+ PATRON_INFO >+ . 'engYYYYMMDDZZZZHHMMSS' >+ . ' Y ' >+ . FID_INST_ID >+ . $branchcode . '|' >+ . FID_PATRON_ID >+ . $cardnum . '|' >+ . FID_PATRON_PWD >+ . PATRON_PW . '|' >+ . FID_START_ITEM . '2|' >+ . FID_END_ITEM . '3|'; >+ 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' ); >+ >+ check_field( >+ $respcode, $response, FID_CURRENCY, $currency, >+ 'Verified active currency' >+ ); >+ >+ # the following checks apply to fields which can occur several times >+ isnt( >+ $response =~ /\|${\FID_FINE_ITEMS} $amount1/, >+ 1, 'Verified fine item 1 is not in response' >+ ); >+ is( >+ $response =~ /\|${\FID_FINE_ITEMS}\s$amount2/, >+ 1, 'Verified fine item 2' >+ ); >+ is( >+ $response =~ /\|${\FID_FINE_ITEMS}\s$amount3/, >+ 1, 'Verified fine item 3' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >+ >+ > subtest "Test patron_status_string" => sub { > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >-- >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 23426
:
91992
|
165507
|
165508
|
165509
|
165654
|
166240
|
169272
|
170931
|
172383
| 172384 |
174232
|
174233
|
174234
|
174464
|
174465
|
174479