[Rt-commit] rt branch, librarize-send-dashboards, updated. rt-3.9.4-545-gf081419

Shawn Moore sartak at bestpractical.com
Tue Nov 23 10:49:52 EST 2010


The branch, librarize-send-dashboards has been updated
       via  f08141916f1afc52bde5cd4e02c2e2fbfbc0e3b7 (commit)
       via  d1c6caacf4d8438a63d70bf110212556e39cf537 (commit)
       via  11c470f7469e98f2bd7f13d70bbcbf442fc02bc4 (commit)
       via  dec24ea9cef03b7be65cda6bccf78aef64bceab4 (commit)
       via  415007961b3cea27fd848e14368cf593400aa6db (commit)
      from  e72ab2bfc5110d34daf1782d742369700e7c4cae (commit)

Summary of changes:
 lib/RT/Dashboard/Mailer.pm |    8 ++++--
 t/mail/dashboards.t        |   55 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 415007961b3cea27fd848e14368cf593400aa6db
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 22 17:23:08 2010 -0500

    set_mail_catcher is unneeded

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index f6112ea..edf684b 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -6,7 +6,6 @@ use RT::Test tests => 17;
 use RT::Dashboard::Mailer;
 
 my ($baseurl, $m) = RT::Test->started_ok;
-RT::Test->set_mail_catcher;
 ok($m->login, 'logged in');
 
 # first, create and populate a dashboard

commit dec24ea9cef03b7be65cda6bccf78aef64bceab4
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 22 17:31:44 2010 -0500

    "RT::Logger->debug and return" is not always going to return
    
        This was painful to figure out :| ->debug can return false which
        makes that statement not return even though that was the intent.

diff --git a/lib/RT/Dashboard/Mailer.pm b/lib/RT/Dashboard/Mailer.pm
index 32c3078..07e3d01 100644
--- a/lib/RT/Dashboard/Mailer.pm
+++ b/lib/RT/Dashboard/Mailer.pm
@@ -278,10 +278,12 @@ sub EmailDashboard {
         Entity => $entity,
     );
 
-    $RT::Logger->debug("Done sending dashboard to ".$currentuser->Name." <$email>")
-        and return if $ok;
+    if (!$ok) {
+        $RT::Logger->error("Failed to email dashboard to user ".$currentuser->Name." <$email>");
+        return;
+    }
 
-    $RT::Logger->error("Failed to email dashboard to user ".$currentuser->Name." <$email>");
+    $RT::Logger->debug("Done sending dashboard to ".$currentuser->Name." <$email>");
 }
 
 sub BuildEmail {

commit 11c470f7469e98f2bd7f13d70bbcbf442fc02bc4
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 22 17:51:03 2010 -0500

    Test the dashboard mail subject

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index edf684b..ab0d54d 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 17;
+use RT::Test tests => 18;
 use RT::Dashboard::Mailer;
 
 my ($baseurl, $m) = RT::Test->started_ok;
@@ -60,4 +60,6 @@ RT::Dashboard::Mailer->MailDashboards(
 
 @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");
 

commit d1c6caacf4d8438a63d70bf110212556e39cf537
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 22 18:03:52 2010 -0500

    Explicitly set Frequency and Hour

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index ab0d54d..7bb1e18 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -51,6 +51,8 @@ is @mails, 0, "no mail yet since there's no subscription";
 $m->follow_link_ok({text => 'Subscription'});
 $m->title_is('Subscribe to dashboard Testing!');
 $m->form_name('SubscribeDashboard');
+$m->field('Frequency' => 'daily');
+$m->field('Hour' => '06:00');
 $m->click_button(name => 'Save');
 $m->content_contains("Subscribed to dashboard Testing!");
 

commit f08141916f1afc52bde5cd4e02c2e2fbfbc0e3b7
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 22 18:04:00 2010 -0500

    More tests for various dashboard times etc

diff --git a/t/mail/dashboards.t b/t/mail/dashboards.t
index 7bb1e18..9583a63 100644
--- a/t/mail/dashboards.t
+++ b/t/mail/dashboards.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 18;
+use RT::Test tests => 27;
 use RT::Dashboard::Mailer;
 
 my ($baseurl, $m) = RT::Test->started_ok;
@@ -65,3 +65,51 @@ is @mails, 1, "got a dashboard mail";
 my $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,
+);
+
+ at mails = RT::Test->fetch_caught_mails;
+is @mails, 0, "no mail because it's a dry run";
+
+
+RT::Dashboard::Mailer->MailDashboards(
+    Time => 1290337260, # 6:01 EST on a monday
+);
+
+ 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(
+    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";
+
+
+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";
+

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


More information about the Rt-commit mailing list