Bugzilla – Attachment 123469 Details for
Bug 28803
process_message_queue.pl dies if any messsages in the message queue contain an invalid to_address
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28803: Add unit tests
Bug-28803-Add-unit-tests.patch (text/plain), 2.68 KB, created by
Martin Renvoize (ashimema)
on 2021-08-05 07:49:19 UTC
(
hide
)
Description:
Bug 28803: Add unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-08-05 07:49:19 UTC
Size:
2.68 KB
patch
obsolete
>From 9e895c70d61e2c5cf9fcb4079d2c166e1a27b5f7 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 5 Aug 2021 08:43:32 +0100 >Subject: [PATCH] Bug 28803: Add unit tests > >This patch updates Letters.t to confirm that invalid email addresses in >the message_queue should not throw an exception when sending mail but >instead set the status to failed and pass error details to the end user. >--- > t/db_dependent/Letters.t | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index 7e5273fb02..5702a224bb 100755 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -921,7 +921,7 @@ subtest 'Test limit parameter for SendQueuedMessages' => sub { > > subtest 'Test message_id parameter for SendQueuedMessages' => sub { > >- plan tests => 6; >+ plan tests => 8; > > my $dbh = C4::Context->dbh; > >@@ -949,13 +949,12 @@ subtest 'Test message_id parameter for SendQueuedMessages' => sub { > 'from_address' => 'root@localhost.' # invalid KohaAdminEmailAddress > }; > my $message_id = C4::Letters::EnqueueLetter($my_message); >- throws_ok { >- C4::Letters::SendQueuedMessages( { message_id => $message_id } ); >- } 'Koha::Exceptions::BadParameter', >- 'Exception thrown if invalid email is passed'; >+ my $processed = C4::Letters::SendQueuedMessages( { message_id => $message_id } ); >+ is( $processed, 1, 'Processed 1 message when one message_id passed' ); > my $message_1 = C4::Letters::GetMessage($message_id); >- # FIXME must be 'failed' >- is( $message_1->{status}, 'pending', 'Invalid KohaAdminEmailAddress => status pending' ); >+ is( $message_1->{status}, 'failed', 'Invalid KohaAdminEmailAddress => status failed' ); >+ is( $message_1->{delivery_note}, "Invalid 'from' parameter: " . 'root@localhost.', 'Delivery note for invalid from address'); >+ is( $message_1->{error_code}, 'INVALID_EMAIL', 'Error code set correctly for invalid email parameter'); > > $my_message->{from_address} = 'root@example.org'; # valid KohaAdminEmailAddress > $message_id = C4::Letters::EnqueueLetter($my_message); >@@ -964,6 +963,6 @@ subtest 'Test message_id parameter for SendQueuedMessages' => sub { > "SendQueuedMessages is using the mocked send_or_die routine"; > $message_1 = C4::Letters::GetMessage($message_1->{message_id}); > my $message_2 = C4::Letters::GetMessage($message_id); >- is( $message_1->{status}, 'pending', 'Message 1 status is unchanged' ); # Must be 'failed' >+ is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' ); > is( $message_2->{status}, 'sent', 'Valid KohaAdminEmailAddress => status sent' ); > }; >-- >2.20.1
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 28803
:
123469
|
123470
|
123475
|
123476
|
124000
|
124001
|
124131
|
124132
|
124746
|
124829
|
124878
|
124879
|
124880
|
124886
|
124887
|
124888
|
124900
|
124901
|
124902
|
125114
|
125115
|
125343
|
125344
|
125345
|
125346