Bugzilla – Attachment 144579 Details for
Bug 32455
Don't send hold notices from the library's inbound email address
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32455: Unit tests
Bug-32455-Unit-tests.patch (text/plain), 4.13 KB, created by
Nick Clemens (kidclamp)
on 2022-12-14 14:22:43 UTC
(
hide
)
Description:
Bug 32455: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-12-14 14:22:43 UTC
Size:
4.13 KB
patch
obsolete
>From 09fc4ecd92f5e9f04ae7b95bc7dd181e2426cac2 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 14 Dec 2022 13:46:24 +0000 >Subject: [PATCH] Bug 32455: Unit tests > >--- > t/db_dependent/Holds/ExpireReservesAutoFill.t | 27 ++++++++++++++++--- > t/db_dependent/Reserves.t | 24 ++++++++++++++--- > 2 files changed, 43 insertions(+), 8 deletions(-) > >diff --git a/t/db_dependent/Holds/ExpireReservesAutoFill.t b/t/db_dependent/Holds/ExpireReservesAutoFill.t >index ab1eaf3c0f..b05a8a2e75 100755 >--- a/t/db_dependent/Holds/ExpireReservesAutoFill.t >+++ b/t/db_dependent/Holds/ExpireReservesAutoFill.t >@@ -29,8 +29,22 @@ my $builder = t::lib::TestBuilder->new(); > my $dbh = C4::Context->dbh; > > # Create two random branches >-my $library_1 = $builder->build({ source => 'Branch' })->{ branchcode }; >-my $library_2 = $builder->build({ source => 'Branch' })->{ branchcode }; >+my $branch_1 = $builder->build_object({ >+ class => 'Koha::Libraries', >+ value => { >+ branchemail => 'branch1@e.mail', >+ branchreplyto => 'branch1@reply.to' >+ } >+}); >+my $library_1 = $branch_1->branchcode; >+my $branch_2 = $builder->build_object({ >+ class => 'Koha::Libraries', >+ value => { >+ branchemail => 'branch2@e.mail', >+ branchreplyto => 'branch2@reply.to' >+ } >+}); >+my $library_2 = $branch_2->branchcode; > > my $biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' }); > my $biblionumber = $biblio->id; >@@ -132,7 +146,7 @@ subtest 'Test automatically canceled expired waiting holds to fill the next hold > }; > > subtest 'Test automatically canceled expired waiting holds to fill the next hold, with a transfer' => sub { >- plan tests => 5; >+ plan tests => 6; > > $dbh->do('DELETE FROM reserves'); > $dbh->do('DELETE FROM message_queue'); >@@ -187,5 +201,10 @@ subtest 'Test automatically canceled expired waiting holds to fill the next hold > > my @messages = $schema->resultset('MessageQueue') > ->search( { letter_code => 'HOLD_CHANGED' } ); >- is( @messages, 1, 'Nessage is generated in the message queue when generating transfer' ); >+ is( @messages, 1, 'Message is generated in the message queue when generating transfer' ); >+ >+ my $email = $messages[0]; >+ is( $email->from_address, $branch_2->branchemail, "Message is sent from library's email"); > }; >+ >+$schema->storage->txn_rollback; >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 1f368e36b6..3371c9539d 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -789,7 +789,20 @@ $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); > > subtest '_koha_notify_reserve() tests' => sub { > >- plan tests => 2; >+ plan tests => 3; >+ >+ my $branch = $builder->build_object({ >+ class => 'Koha::Libraries', >+ value => { >+ branchemail => 'branch@e.mail', >+ branchreplyto => 'branch@reply.to', >+ pickup_location => 1 >+ } >+ }); >+ my $item = $builder->build_sample_item({ >+ homebranch => $branch->branchcode, >+ holdingbranch => $branch->branchcode >+ }); > > my $wants_hold_and_email = { > wants_digest => '0', >@@ -852,12 +865,15 @@ subtest '_koha_notify_reserve() tests' => sub { > })->next()->to_address(); > is($sms_message_address, undef ,"We should not populate the sms message with the sms number, sending will do so"); > >- my $email_message_address = $schema->resultset('MessageQueue')->search({ >+ my $email = $schema->resultset('MessageQueue')->search({ > letter_code => 'HOLD', > message_transport_type => 'email', > borrowernumber => $hold_borrower, >- })->next()->to_address(); >- is($email_message_address, undef ,"We should not populate the hold message with the email address, sending will do so"); >+ })->next(); >+ my $email_to_address = $email->to_address(); >+ is($email_to_address, undef ,"We should not populate the hold message with the email address, sending will do so"); >+ my $email_from_address = $email->from_address(); >+ is($email_from_address,'branch@e.mail',"Library's from address is used for sending"); > > }; > >-- >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 32455
:
144552
|
144579
|
144580
|
145783
|
145784
|
145785
|
145940
|
145941
|
145942