X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Ft%2Fmail%2Fdashboards.t;h=6bf4ba520de3ce4dd49d576ac372b78b0fffba36;hp=7a7a54ce6f822ab72fb5272a25c330e338616920;hb=e9e0cf0989259b94d9758eceff448666a2e5a5cc;hpb=85e677b86fc37c54e6de2b06340351a28f5a5916 diff --git a/rt/t/mail/dashboards.t b/rt/t/mail/dashboards.t index 7a7a54ce6..6bf4ba520 100644 --- a/rt/t/mail/dashboards.t +++ b/rt/t/mail/dashboards.t @@ -1,8 +1,7 @@ -#!/usr/bin/perl use strict; use warnings; -use RT::Test tests => 187; +use RT::Test tests => undef; use Test::Warn; use RT::Dashboard::Mailer; @@ -103,15 +102,13 @@ sub produces_dashboard_mail_ok { # {{{ my $mail = parse_mail( $mails[0] ); is($mail->head->get('Subject'), $subject); is($mail->head->get('From'), "root\n"); + is($mail->head->get('Content-Transfer-Encoding'), "base64\n"); is($mail->head->get('X-RT-Dashboard-Id'), "$dashboard_id\n"); is($mail->head->get('X-RT-Dashboard-Subscription-Id'), "$subscription_id\n"); - SKIP: { - skip 'Weird MIME failure', 2; - my $body = $mail->stringify_body; - like($body, qr{My dashboards}); - like($body, qr{Testing!}); - }; + my $body = $mail->bodyhandle->as_string; + like($body, qr{My dashboards}); + like($body, qr{Testing!}); } # }}} sub produces_no_dashboard_mail_ok { # {{{ @@ -138,17 +135,6 @@ sub delete_dashboard { # {{{ ok($ok, $msg); } # }}} -sub delete_subscriptions { # {{{ - my $subscription_id = shift; - # delete the dashboard and make sure we get exactly one subscription failure - # notice - my $user = RT::User->new(RT->SystemUser); - $user->Load('root'); - for my $subscription ($user->Attributes->Named('Subscription')) { - $subscription->Delete; - } -} # }}} - my $good_time = 1290423660; # 6:01 EST on a monday my $bad_time = 1290427260; # 7:01 EST on a monday @@ -214,30 +200,15 @@ is($mail->head->get('From'), "dashboard\@example.com\n"); is($mail->head->get('X-RT-Dashboard-Id'), "$dashboard_id\n"); is($mail->head->get('X-RT-Dashboard-Subscription-Id'), "$subscription_id\n"); -SKIP: { - skip 'Weird MIME failure', 2; - my $body = $mail->stringify_body; - unlike($body, qr{My dashboards}); - unlike($body, qr{Testing!}); -}; +my $body = $mail->bodyhandle->as_string; +unlike($body, qr{My dashboards}); +unlike($body, qr{Testing!}); delete_dashboard($dashboard_id); -warning_like { - RT::Dashboard::Mailer->MailDashboards(All => 1); -} qr/Unable to load dashboard $dashboard_id of subscription $subscription_id for user root/; - -@mails = RT::Test->fetch_caught_mails; -is(@mails, 1, "one mail for subscription failure"); -$mail = parse_mail($mails[0]); -is($mail->head->get('Subject'), "[example.com] Missing dashboard!\n"); -is($mail->head->get('From'), "dashboard\@example.com\n"); -is($mail->head->get('X-RT-Dashboard-Id'), "$dashboard_id\n"); -is($mail->head->get('X-RT-Dashboard-Subscription-Id'), "$subscription_id\n"); - RT::Dashboard::Mailer->MailDashboards(All => 1); @mails = RT::Test->fetch_caught_mails; -is(@mails, 0, "no mail because the subscription notice happens only once"); +is(@mails, 0, "no mail because the subscription is deleted"); RT::Test->stop_server; RT::Test->clean_caught_mails; @@ -277,7 +248,6 @@ RT->Config->Set('EmailDashboardRemove' => (qr/My dashboards/, "Testing!")); ($baseurl, $m) = RT::Test->started_ok; delete_dashboard($dashboard_id); -delete_subscriptions(); RT::Test->clean_caught_mails; @@ -330,7 +300,6 @@ RT->Config->Set('EmailDashboardRemove' => (qr/My dashboards/, "Testing!")); ($baseurl, $m) = RT::Test->started_ok; delete_dashboard($dashboard_id); -delete_subscriptions(); RT::Test->clean_caught_mails; @@ -373,7 +342,6 @@ RT->Config->Set('EmailDashboardRemove' => (qr/My dashboards/, "Testing!")); ($baseurl, $m) = RT::Test->started_ok; delete_dashboard($dashboard_id); -delete_subscriptions(); RT::Test->clean_caught_mails; @@ -395,3 +363,4 @@ produces_no_dashboard_mail_ok( Time => $bad_time, ); +done_testing;