[Rt-commit] rt branch, librarize-send-dashboards, updated. rt-3.9.4-554-g365acfe

Shawn Moore sartak at bestpractical.com
Tue Nov 23 12:09:49 EST 2010


The branch, librarize-send-dashboards has been updated
       via  365acfed87f3f5c350ba887d59612c3f36c8519d (commit)
       via  1e16ddd30a159d35fcd35cdfe8c376ecc7de198d (commit)
       via  d94936d87ca3a86095d65f7720eac07360e7ddd0 (commit)
       via  c5dc8afae96ac733969dcadd5dd9c8f893a6a5d4 (commit)
       via  a8994deaa5b04d0c29d0a04d83f171486bdab447 (commit)
       via  ac75ffcbe4d00961d50b40059a70f7daa5edf461 (commit)
       via  ea5f85c1e4115b419975844aba1d6b21bc74d36e (commit)
       via  868d8efddaaf4601229d9bf9afc5984755705901 (commit)
       via  0d9bed3ed33bea1d96ba88846ed39755566794ab (commit)
      from  f08141916f1afc52bde5cd4e02c2e2fbfbc0e3b7 (commit)

Summary of changes:
 etc/RT_Config.pm.in |   12 ++++-
 t/mail/dashboards.t |  118 ++++++++++++++++++++++++++++++++++----------------
 2 files changed, 90 insertions(+), 40 deletions(-)

- Log -----------------------------------------------------------------
commit 0d9bed3ed33bea1d96ba88846ed39755566794ab
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 23 11:35:19 2010 -0500

    Factor out the dashboard mail checking into functions

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index 9583a63..ddbb638 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -56,60 +56,57 @@ $m->field('Hour' => '06:00');
 $m->click_button(name => 'Save');
 $m->content_contains("Subscribed to dashboard Testing!");
 
-RT::Dashboard::Mailer->MailDashboards(
-    All => 1,
-);
+sub got_dashboard_mail_ok { # {{{
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
 
- at mails = RT::Test->fetch_caught_mails;
-is @mails, 1, "got a dashboard mail";
-my $mail = parse_mail( $mails[0] );
-is($mail->head->get('Subject'), "[example.com] Daily Dashboard: Testing!\n");
+    my @mails = RT::Test->fetch_caught_mails;
+    is @mails, 1, "got a dashboard mail";
 
-SKIP: {
-    skip 'Weird MIME failure', 2;
-    my $body = $mail->stringify_body;
-    like($body, qr{My dashboards});
-    like($body, qr{<a href="/Dashboards/\d+/Testing!">Testing!</a>});
-};
+    my $mail = parse_mail( $mails[0] );
+    is($mail->head->get('Subject'), "[example.com] Daily Dashboard: Testing!\n");
 
-RT::Dashboard::Mailer->MailDashboards(
-    All    => 1,
-    DryRun => 1,
-);
+    SKIP: {
+        skip 'Weird MIME failure', 2;
+        my $body = $mail->stringify_body;
+        like($body, qr{My dashboards});
+        like($body, qr{<a href="/Dashboards/\d+/Testing!">Testing!</a>});
+    };
+} # }}}
 
- at mails = RT::Test->fetch_caught_mails;
-is @mails, 0, "no mail because it's a dry run";
+sub got_no_dashboard_mail_ok { # {{{
+    my $name = shift;
 
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+    @mails = RT::Test->fetch_caught_mails;
+    is @mails, 0, $name;
+} # }}}
+
+RT::Dashboard::Mailer->MailDashboards(
+    All => 1,
+);
+got_dashboard_mail_ok;
 
 RT::Dashboard::Mailer->MailDashboards(
     Time => 1290337260, # 6:01 EST on a monday
 );
+got_dashboard_mail_ok;
 
- at mails = RT::Test->fetch_caught_mails;
-is @mails, 1, "got a dashboard mail";
-$mail = parse_mail( $mails[0] );
-is($mail->head->get('Subject'), "[example.com] Daily Dashboard: Testing!\n");
 
-SKIP: {
-    skip 'Weird MIME failure', 2;
-    my $body = $mail->stringify_body;
-    like($body, qr{My dashboards});
-    like($body, qr{<a href="/Dashboards/\d+/Testing!">Testing!</a>});
-};
+RT::Dashboard::Mailer->MailDashboards(
+    All    => 1,
+    DryRun => 1,
+);
+got_no_dashboard_mail_ok "no dashboard mail it's a dry run";
 
 RT::Dashboard::Mailer->MailDashboards(
     Time   => 1290337260, # 6:01 EST on a monday
     DryRun => 1,
 );
-
- at mails = RT::Test->fetch_caught_mails;
-is @mails, 0, "no mails because of DryRun";
-
+got_no_dashboard_mail_ok "no dashboard mail it's a dry run";
 
 RT::Dashboard::Mailer->MailDashboards(
     Time => 1290340860, # 7:01 EST on a monday
 );
-
- at mails = RT::Test->fetch_caught_mails;
-is @mails, 0, "no mail because it's the wrong time";
+got_no_dashboard_mail_ok "no mail because it's the wrong time";
 

commit 868d8efddaaf4601229d9bf9afc5984755705901
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 23 11:36:58 2010 -0500

    Name the two timestamps for readability

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index ddbb638..9976053 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -82,13 +82,16 @@ sub got_no_dashboard_mail_ok { # {{{
     is @mails, 0, $name;
 } # }}}
 
+my $good_time = 1290337260; # 6:01 EST on a monday
+my $bad_time  = 1290340860; # 7:01 EST on a monday
+
 RT::Dashboard::Mailer->MailDashboards(
     All => 1,
 );
 got_dashboard_mail_ok;
 
 RT::Dashboard::Mailer->MailDashboards(
-    Time => 1290337260, # 6:01 EST on a monday
+    Time => $good_time,
 );
 got_dashboard_mail_ok;
 
@@ -100,13 +103,13 @@ RT::Dashboard::Mailer->MailDashboards(
 got_no_dashboard_mail_ok "no dashboard mail it's a dry run";
 
 RT::Dashboard::Mailer->MailDashboards(
-    Time   => 1290337260, # 6:01 EST on a monday
+    Time   => $good_time,
     DryRun => 1,
 );
 got_no_dashboard_mail_ok "no dashboard mail it's a dry run";
 
 RT::Dashboard::Mailer->MailDashboards(
-    Time => 1290340860, # 7:01 EST on a monday
+    Time => $bad_time,
 );
 got_no_dashboard_mail_ok "no mail because it's the wrong time";
 

commit ea5f85c1e4115b419975844aba1d6b21bc74d36e
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 23 11:38:38 2010 -0500

    Some more interesting combinations

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index 9976053..3c58c8e 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 27;
+use RT::Test tests => 35;
 use RT::Dashboard::Mailer;
 
 my ($baseurl, $m) = RT::Test->started_ok;
@@ -85,16 +85,30 @@ sub got_no_dashboard_mail_ok { # {{{
 my $good_time = 1290337260; # 6:01 EST on a monday
 my $bad_time  = 1290340860; # 7:01 EST on a monday
 
+# options that produce dashboard mail
+RT::Dashboard::Mailer->MailDashboards(
+    Time => $good_time,
+);
+got_dashboard_mail_ok;
+
 RT::Dashboard::Mailer->MailDashboards(
     All => 1,
 );
 got_dashboard_mail_ok;
 
 RT::Dashboard::Mailer->MailDashboards(
+    All  => 1,
     Time => $good_time,
 );
 got_dashboard_mail_ok;
 
+RT::Dashboard::Mailer->MailDashboards(
+    All  => 1,
+    Time => $bad_time,
+);
+got_dashboard_mail_ok;
+
+# options that produce no dashboard mail
 
 RT::Dashboard::Mailer->MailDashboards(
     All    => 1,

commit ac75ffcbe4d00961d50b40059a70f7daa5edf461
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 23 11:41:33 2010 -0500

    Move the MailDashboards calls into the test functions

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index 3c58c8e..ef9e301 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -56,9 +56,13 @@ $m->field('Hour' => '06:00');
 $m->click_button(name => 'Save');
 $m->content_contains("Subscribed to dashboard Testing!");
 
-sub got_dashboard_mail_ok { # {{{
+sub produces_dashboard_mail_ok { # {{{
+    my %args = @_;
+
     local $Test::Builder::Level = $Test::Builder::Level + 1;
 
+    RT::Dashboard::Mailer->MailDashboards(%args);
+
     my @mails = RT::Test->fetch_caught_mails;
     is @mails, 1, "got a dashboard mail";
 
@@ -73,11 +77,14 @@ sub got_dashboard_mail_ok { # {{{
     };
 } # }}}
 
-sub got_no_dashboard_mail_ok { # {{{
-    my $name = shift;
+sub produces_no_dashboard_mail_ok { # {{{
+    my %args = @_;
+    my $name = delete $args{Name};
 
     local $Test::Builder::Level = $Test::Builder::Level + 1;
 
+    RT::Dashboard::Mailer->MailDashboards(%args);
+
     @mails = RT::Test->fetch_caught_mails;
     is @mails, 0, $name;
 } # }}}
@@ -85,45 +92,39 @@ sub got_no_dashboard_mail_ok { # {{{
 my $good_time = 1290337260; # 6:01 EST on a monday
 my $bad_time  = 1290340860; # 7:01 EST on a monday
 
-# options that produce dashboard mail
-RT::Dashboard::Mailer->MailDashboards(
+produces_dashboard_mail_ok(
     Time => $good_time,
 );
-got_dashboard_mail_ok;
 
-RT::Dashboard::Mailer->MailDashboards(
+produces_dashboard_mail_ok(
     All => 1,
 );
-got_dashboard_mail_ok;
 
-RT::Dashboard::Mailer->MailDashboards(
+produces_dashboard_mail_ok(
     All  => 1,
     Time => $good_time,
 );
-got_dashboard_mail_ok;
 
-RT::Dashboard::Mailer->MailDashboards(
+produces_dashboard_mail_ok(
     All  => 1,
     Time => $bad_time,
 );
-got_dashboard_mail_ok;
 
-# options that produce no dashboard mail
 
-RT::Dashboard::Mailer->MailDashboards(
+produces_no_dashboard_mail_ok(
+    Name   => "no dashboard mail it's a dry run",
     All    => 1,
     DryRun => 1,
 );
-got_no_dashboard_mail_ok "no dashboard mail it's a dry run";
 
-RT::Dashboard::Mailer->MailDashboards(
+produces_no_dashboard_mail_ok(
+    Name   => "no dashboard mail it's a dry run",
     Time   => $good_time,
     DryRun => 1,
 );
-got_no_dashboard_mail_ok "no dashboard mail it's a dry run";
 
-RT::Dashboard::Mailer->MailDashboards(
+produces_no_dashboard_mail_ok(
+    Name => "no mail because it's the wrong time",
     Time => $bad_time,
 );
-got_no_dashboard_mail_ok "no mail because it's the wrong time";
 

commit a8994deaa5b04d0c29d0a04d83f171486bdab447
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 23 11:47:09 2010 -0500

    Lie less about the dashboard subject template

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 793eabd..df1c57c 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -679,8 +679,7 @@ Set($ShowBccHeader, 0);
 =item C<$DashboardSubject>
 
 Lets you set the subject of dashboards. Arguments are the frequency (Daily,
-Weekly, Monthly) of the dashboard and the dashboard's name. [_1] for the name
-of the dashboard.
+Weekly, Monthly) of the dashboard and the dashboard's name.
 
 =cut
 

commit c5dc8afae96ac733969dcadd5dd9c8f893a6a5d4
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 23 11:49:07 2010 -0500

    Document @EmailDashboardRemove which we've supported for a while

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index df1c57c..aa1cad4 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -685,6 +685,15 @@ Weekly, Monthly) of the dashboard and the dashboard's name.
 
 Set($DashboardSubject, '%s Dashboard: %s');
 
+=item C<@EmailDashboardRemove>
+
+A list of regular expressions that will be used to remove content from mailed
+dashboards.
+
+=cut
+
+Set(@EmailDashboardRemove, ());
+
 =back
 
 =head1 GnuPG Configuration

commit d94936d87ca3a86095d65f7720eac07360e7ddd0
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 23 11:59:52 2010 -0500

    Test the From address (== OwnerEmail) from dashboards

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index ef9e301..9a3aa4b 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 35;
+use RT::Test tests => 39;
 use RT::Dashboard::Mailer;
 
 my ($baseurl, $m) = RT::Test->started_ok;
@@ -68,6 +68,7 @@ sub produces_dashboard_mail_ok { # {{{
 
     my $mail = parse_mail( $mails[0] );
     is($mail->head->get('Subject'), "[example.com] Daily Dashboard: Testing!\n");
+    is($mail->head->get('From'), "root\n");
 
     SKIP: {
         skip 'Weird MIME failure', 2;

commit 1e16ddd30a159d35fcd35cdfe8c376ecc7de198d
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 23 12:03:11 2010 -0500

    Test some dashboard config

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index 9a3aa4b..857c3f0 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 39;
+use RT::Test tests => 45;
 use RT::Dashboard::Mailer;
 
 my ($baseurl, $m) = RT::Test->started_ok;
@@ -56,6 +56,10 @@ $m->field('Hour' => '06:00');
 $m->click_button(name => 'Save');
 $m->content_contains("Subscribed to dashboard Testing!");
 
+# we're done with the web side; this silences some warnings about changing
+# the config as well
+RT::Test->stop_server;
+
 sub produces_dashboard_mail_ok { # {{{
     my %args = @_;
 
@@ -129,3 +133,25 @@ produces_no_dashboard_mail_ok(
     Time => $bad_time,
 );
 
+ at mails = RT::Test->fetch_caught_mails;
+is(@mails, 0, "no mail leftover");
+
+
+RT->Config->Set('DashboardSubject' => 'a %s b %s c');
+RT->Config->Set('DashboardAddress' => 'dashboard at example.com');
+RT->Config->Set('EmailDashboardRemove' => (qr/My dashboards/, "Testing!"));
+
+RT::Dashboard::Mailer->MailDashboards(All => 1);
+ at mails = RT::Test->fetch_caught_mails;
+is(@mails, 1, "one mail");
+my $mail = parse_mail($mails[0]);
+is($mail->head->get('Subject'), "[example.com] a Daily b Testing! c\n");
+is($mail->head->get('From'), "dashboard\@example.com\n");
+
+SKIP: {
+    skip 'Weird MIME failure', 2;
+    my $body = $mail->stringify_body;
+    unlike($body, qr{My dashboards});
+    unlike($body, qr{Testing!});
+};
+

commit 365acfed87f3f5c350ba887d59612c3f36c8519d
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 23 12:09:09 2010 -0500

    URLs will have the domain in it

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index 857c3f0..7c2206a 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -78,7 +78,7 @@ sub produces_dashboard_mail_ok { # {{{
         skip 'Weird MIME failure', 2;
         my $body = $mail->stringify_body;
         like($body, qr{My dashboards});
-        like($body, qr{<a href="/Dashboards/\d+/Testing!">Testing!</a>});
+        like($body, qr{<a href="http://[^/]+/Dashboards/\d+/Testing!">Testing!</a>});
     };
 } # }}}
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list