[Rt-commit] rt branch, html-templates, updated. rt-3.9.6-45-g22f2263
Thomas Sibley
trs at bestpractical.com
Fri Dec 3 14:23:40 EST 2010
The branch, html-templates has been updated
via 22f2263c71a03c297d996276c2000f9ce58d4353 (commit)
via 0573b2638a608448aa7b67ed6418b3f67d47fdf6 (commit)
from 9d8002beaf841d73a995c40bfc274d55f94a806e (commit)
Summary of changes:
lib/RT/Interface/Email.pm | 5 ++++
t/mail/html-outgoing.t | 56 ++++++++++++++++++++++++++++++++++----------
2 files changed, 48 insertions(+), 13 deletions(-)
- Log -----------------------------------------------------------------
commit 0573b2638a608448aa7b67ed6418b3f67d47fdf6
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Dec 3 13:36:15 2010 -0500
Make a note of options we should enable in the (hopefully) near future
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 1afe7b9..79ea67c 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1859,6 +1859,11 @@ sub ConvertHTMLToText {
after_link => ' (%l)',
footnote => '',
skip_linked_urls => 1,
+ # XXX TODO: These should be enabled once the patch (rt.cpan.org
+ # #63571) to HTML::FormatText::WithLinks is accepted and released
+ #with_emphasis => 1,
+ #bold_marker => '"',
+ #italic_marker => '"',
}
);
}
commit 22f2263c71a03c297d996276c2000f9ce58d4353
Author: Thomas Sibley <trs at bestpractical.com>
Date: Fri Dec 3 14:19:03 2010 -0500
Add tests for HTML versions of the admin and normal correspondence
Also add a helper function for generating the body parts regexes
diff --git a/t/mail/html-outgoing.t b/t/mail/html-outgoing.t
index 0cb2ce7..9d9650d 100644
--- a/t/mail/html-outgoing.t
+++ b/t/mail/html-outgoing.t
@@ -35,7 +35,7 @@ for my $user_name (qw(enduser tech)) {
my $t = RT::Ticket->new(RT->SystemUser);
my ($tid, $ttrans, $tmsg);
-# Autoreply and AdminCc (Transaction)
+diag "Autoreply and AdminCc (Transaction)";
mail_ok {
($tid, $ttrans, $tmsg) =
$t->Create(Subject => "The internet is broken",
@@ -44,23 +44,53 @@ mail_ok {
} { from => qr/The default queue/,
to => 'enduser at example.com',
subject => qr/\Q[example.com #1] AutoReply: The internet is broken\E/,
- body => qr{
- Content-Type:\stext/plain.+?
- trouble\sticket\sregarding\sThe\sinternet\sis\sbroken.+?
- Content-Type:\stext/html.+?
- trouble\sticket\sregarding\s<b>The\sinternet\sis\sbroken</b>
- }xs,
+ body => parts_regex(
+ 'trouble ticket regarding The internet is broken',
+ 'trouble ticket regarding <b>The internet is broken</b>'
+ ),
'Content-Type' => qr{multipart},
},{ from => qr/RT System/,
bcc => 'root at localhost',
subject => qr/\Q[example.com #1] The internet is broken\E/,
- body => qr{
- Content-Type:\stext/plain.+?
- Request\s1\s\(http://localhost:\d+/Ticket/Display\.html\?id=1\)\s+was\sacted\supon\sby\sRT_System.+?
- Content-Type:\stext/html.+?
- Request\s<a\shref="http://localhost:\d+/Ticket/Display\.html\?id=1">1</a>\swas\sacted\supon\sby\sRT_System\.</b>
- }xs,
+ body => parts_regex(
+ 'Request 1 \(http://localhost:\d+/Ticket/Display\.html\?id=1\)\s+?was acted upon by RT_System',
+ 'Request <a href="http://localhost:\d+/Ticket/Display\.html\?id=1">1</a> was acted upon by RT_System\.</b>'
+ ),
'Content-Type' => qr{multipart},
};
+diag "Autoreply and AdminCc (Transaction)";
+mail_ok {
+ ($ok, $tmsg) = $t->Correspond(
+ Content => 'This is a test of correspondence using HTML templates.',
+ );
+} { from => qr/RT System/,
+ bcc => 'root at localhost',
+ subject => qr/\Q[example.com #1] The internet is broken\E/,
+ body => parts_regex(
+ 'Ticket URL: http://localhost:\d+/Ticket/Display\.html\?id=1.+?'.
+ 'This is a test of correspondence using HTML templates\.',
+ 'Ticket URL: <a href="(http://localhost:\d+/Ticket/Display\.html\?id=1)">\1</a>.+?'.
+ '<pre>This is a test of correspondence using HTML templates\.</pre>'
+ ),
+ 'Content-Type' => qr{multipart},
+},{ from => qr/RT System/,
+ to => 'enduser at example.com',
+ subject => qr/\Q[example.com #1] The internet is broken\E/,
+ body => parts_regex(
+ 'This is a test of correspondence using HTML templates\.',
+ '<pre>This is a test of correspondence using HTML templates\.</pre>'
+ ),
+ 'Content-Type' => qr{multipart},
+};
+
+sub parts_regex {
+ my ($text, $html) = @_;
+
+ my $pattern = 'Content-Type: text/plain.+?' . $text . '.+?' .
+ 'Content-Type: text/html.+?' . $html;
+
+ return qr/$pattern/s;
+}
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list