[Rt-commit] rt branch, 4.2/create-squelching-with-tests, updated. rt-4.2.10-3-g4e5b94e
Dave Goehrig
dave at bestpractical.com
Mon Jan 9 11:34:04 EST 2017
The branch, 4.2/create-squelching-with-tests has been updated
via 4e5b94ef806d4005fc195805867c574d7bfd98d9 (commit)
from d0e2bd33a92b1de7efed92adfc24bc900da69c2a (commit)
Summary of changes:
t/mail/squelched-email-recipients.t | 109 ++++++++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)
create mode 100644 t/mail/squelched-email-recipients.t
- Log -----------------------------------------------------------------
commit 4e5b94ef806d4005fc195805867c574d7bfd98d9
Author: Dave Goehrig <dave at bestpractical.com>
Date: Mon Jan 9 11:33:45 2017 -0500
adding more email squelching tests
diff --git a/t/mail/squelched-email-recipients.t b/t/mail/squelched-email-recipients.t
new file mode 100644
index 0000000..addb22f
--- /dev/null
+++ b/t/mail/squelched-email-recipients.t
@@ -0,0 +1,109 @@
+use strict;
+use warnings;
+
+use RT::Test tests => undef;
+use RT::Test::Email;
+use Test::Warn;
+
+my $queue = RT::Test->load_or_create_queue(
+ Name => 'General',
+ CorrespondAddress => 'rt-recipient at example.com',
+ CommentAddress => 'rt-recipient at example.com',
+);
+ok $queue && $queue->id, 'loaded or created queue';
+
+my $user = RT::Test->load_or_create_user(
+ Name => 'root',
+ EmailAddress => 'root at localhost',
+);
+ok $user && $user->id, 'loaded or created root user';
+
+my $test_user = RT::Test->load_or_create_user(
+ Name => 'test',
+ EmailAddress => 'test at localhost',
+);
+ok $test_user && $test_user->id, 'loaded or created test user';
+
+my $nobody_user = RT::Test->load_or_create_user(
+ Name => 'nobody',
+ EmailAddress => 'nobody at localhost',
+);
+ok $nobody_user && $nobody_user->id, 'loaded or created test user';
+
+
+diag "Test creation of emails with a squelched requestor";
+warnings_are {
+ my $ticket = RT::Ticket->new( RT::CurrentUser->new( $user ) );
+ mail_ok {
+ my ($status, undef, $msg) = $ticket->Create(
+ Queue => $queue->id,
+ Subject => 'test',
+ Requestor => [ 'root at localhost', 'test at localhost', 'nobody at localhost' ],
+ SquelchMailTo => [ 'test at localhost' ],
+ );
+ ok $status, "created ticket";
+ } { To => 'nobody at localhost, root at localhost' };
+
+ RT->Config->Set( NotifyActor => 1 );
+ mail_ok {
+ my ($status, $msg) = $ticket->Correspond(
+ Content => 'test mail',
+ );
+ ok $status, "replied to a ticket";
+ } { To => 'nobody at localhost, root at localhost' };
+
+ RT->Config->Set( NotifyActor => 0 );
+ mail_ok {
+ my ($status, $msg) = $ticket->Correspond(
+ Content => 'test mail',
+ );
+ ok $status, "replied to a ticket";
+ } { To => 'nobody at localhost' };
+
+ mail_ok {
+ my ($status, $msg) = $ticket->Correspond(
+ Content => 'test mail',
+ CcMessageTo => 'root at localhost',
+ );
+ ok $status, "replied to a ticket";
+ } { Cc => 'root at localhost'},{ To => 'nobody at localhost' };
+} [];
+
+diag "Reply to ticket with multiple requestors squelched";
+warnings_are {
+ my $ticket = RT::Ticket->new( RT::CurrentUser->new( $user ) );
+ mail_ok {
+ my ($status, undef, $msg) = $ticket->Create(
+ Queue => $queue->id,
+ Subject => 'test',
+ Requestor => [ 'root at localhost', 'test at localhost', 'nobody at localhost' ],
+ SquelchMailTo => [ 'root at localhost', 'nobody at localhost' ]
+ );
+ ok $status, "created ticket";
+ } { To => 'test at localhost' };
+
+ mail_ok {
+ my ($status, $msg) = $ticket->Correspond(
+ Content => 'test mail',
+ );
+ ok $status, "replied to a ticket";
+ } { To => 'test at localhost' };
+
+ $ticket->SquelchMailTo('test at localhost');
+ mail_ok {
+ my ($status, $msg) = $ticket->Correspond(
+ Content => 'test mail',
+ );
+ ok $status, "replied to a ticket";
+ };
+
+ mail_ok {
+ my ($status, $msg) = $ticket->Correspond(
+ Content => 'test mail',
+ CcMessageTo => 'test at localhost',
+ );
+ ok $status, "replied to a ticket";
+ } { Cc => 'test at localhost' };
+}[];
+
+done_testing;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list