[Rt-commit] rt branch, html-templates, updated. rt-3.9.6-46-g23eeb59

Thomas Sibley trs at bestpractical.com
Fri Dec 3 16:02:20 EST 2010


The branch, html-templates has been updated
       via  23eeb5995ff298b4ccc114ec7d862b464a8bb3ef (commit)
      from  22f2263c71a03c297d996276c2000f9ce58d4353 (commit)

Summary of changes:
 t/mail/html-outgoing.t |   68 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 23eeb5995ff298b4ccc114ec7d862b464a8bb3ef
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Dec 3 16:02:08 2010 -0500

    Test the rest of the HTML templates

diff --git a/t/mail/html-outgoing.t b/t/mail/html-outgoing.t
index 9d9650d..3149f52 100644
--- a/t/mail/html-outgoing.t
+++ b/t/mail/html-outgoing.t
@@ -4,7 +4,7 @@ use RT::Test tests => undef;
 BEGIN {
     plan skip_all => 'Email::Abstract and Test::Email required.'
         unless eval { require Email::Abstract; require Test::Email; 1 };
-    plan 'no_plan';
+    plan tests => 19;
 }
 
 RT::Test->switch_templates_ok('html');
@@ -60,7 +60,7 @@ mail_ok {
 };
 
 
-diag "Autoreply and AdminCc (Transaction)";
+diag "Admin Correspondence and Correspondence";
 mail_ok {
     ($ok, $tmsg) = $t->Correspond(
         Content => 'This is a test of correspondence using HTML templates.',
@@ -85,6 +85,70 @@ mail_ok {
     'Content-Type' => qr{multipart},
 };
 
+
+diag "Admin Comment in HTML";
+mail_ok {
+    ($ok, $tmsg) = $t->Comment(
+        Content => 'Comment test, please!',
+    );
+} { from    => qr/RT System/,
+    bcc     => 'root at localhost',
+    subject => qr/\Q[example.com #1] [Comment] The internet is broken\E/,
+    body    => parts_regex(
+        'This is a comment about ticket 1 \(http://localhost:\d+/Ticket/Display\.html\?id=1\)\..+?'.
+        'It is not sent to the Requestor\(s\):.+?'.
+        'Comment test, please!',
+
+        '<p>This is a comment about <a href="http://localhost:\d+/Ticket/Display\.html\?id=1">ticket 1</a>\. '.
+        'It is not sent to the Requestor\(s\):</p>.+?'.
+        '<pre>Comment test, please!</pre>',
+    ),
+    'Content-Type' => qr{multipart},
+};
+
+
+diag "Resolved in HTML templates";
+mail_ok {
+    ($ok, $tmsg) = $t->SetStatus('resolved');
+} { from    => qr/RT System/,
+    to      => 'enduser at example.com',
+    subject => qr/\Q[example.com #1] Resolved: The internet is broken\E/,
+    body    => parts_regex(
+        'According to our records, your request has been resolved\.',
+        '<p>According to our records, your request has been resolved\.',
+    ),
+    'Content-Type' => qr{multipart},
+};
+
+
+diag "Status changes in HTML";
+my $scrip = RT::Scrip->new(RT->SystemUser);
+my ($sval, $smsg) =$scrip->Create(
+    ScripCondition => 'On Status Change',
+    ScripAction => 'Notify Requestors',
+    Template => 'Status Change in HTML',
+    Queue => $q->Id,
+    Description => 'Tell requestors about status changes'
+);
+ok ($sval, $smsg);
+ok ($scrip->Id, "Created the scrip");
+ok ($scrip->TemplateObj->Id, "Created the scrip template");
+ok ($scrip->ConditionObj->Id, "Created the scrip condition");
+ok ($scrip->ActionObj->Id, "Created the scrip action");
+
+mail_ok {
+    ($ok, $tmsg) = $t->SetStatus('stalled');
+} { from    => qr/RT System/,
+    to      => 'enduser at example.com',
+    subject => qr/\Q[example.com #1] Status Changed to: stalled\E/,
+    body    => parts_regex(
+        'http://localhost:\d+/Ticket/Display\.html\?id=1.+?',
+        '<a href="(http://localhost:\d+/Ticket/Display\.html\?id=1)">\1</a>'
+    ),
+    'Content-Type' => qr{multipart},
+};
+
+
 sub parts_regex {
     my ($text, $html) = @_;
 

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


More information about the Rt-commit mailing list