[Rt-commit] rt branch, 4.0/rfc822-attachment, updated. rt-4.0.0-213-g6742ab2
Thomas Sibley
trs at bestpractical.com
Thu May 12 14:02:01 EDT 2011
The branch, 4.0/rfc822-attachment has been updated
via 6742ab2bb746ef812f354a9a1eabc0e94861f8f5 (commit)
from cfd2128fd386398119f29b524cf3662835410806 (commit)
Summary of changes:
{share/html/NoAuth/images => t/data}/bpslogo.png | Bin 3929 -> 3929 bytes
t/web/ticket_forward.t | 122 ++++++++++++++++++++--
2 files changed, 115 insertions(+), 7 deletions(-)
copy {share/html/NoAuth/images => t/data}/bpslogo.png (100%)
- Log -----------------------------------------------------------------
commit 6742ab2bb746ef812f354a9a1eabc0e94861f8f5
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu May 12 13:56:11 2011 -0400
Test forwarding transactions that have an empty "content" part and non-existent "content" part
Empty (i.e. attachments only via the web UI) work, but non-existent
doesn't (i.e. attachments only via some MUAs). See also #17318.
diff --git a/t/data/bpslogo.png b/t/data/bpslogo.png
new file mode 100644
index 0000000..8a87374
Binary files /dev/null and b/t/data/bpslogo.png differ
diff --git a/t/web/ticket_forward.t b/t/web/ticket_forward.t
index e4b53b7..bd13f40 100644
--- a/t/web/ticket_forward.t
+++ b/t/web/ticket_forward.t
@@ -1,9 +1,8 @@
#!/usr/bin/perl
-
use strict;
use warnings;
-use RT::Test tests => 32;
+use RT::Test tests => undef;
use File::Temp 'tempfile';
use File::Spec;
my ( $att_fh, $att_file ) =
@@ -15,6 +14,7 @@ my $att_name = ( File::Spec->splitpath($att_file) )[-1];
my ( $baseurl, $m ) = RT::Test->started_ok;
ok $m->login, 'logged in as root';
+# Create a ticket with content and an attachment
$m->get_ok( $baseurl . '/Ticket/Create.html?Queue=1' );
$m->submit_form(
@@ -28,7 +28,7 @@ $m->submit_form(
$m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
RT::Test->clean_caught_mails;
-diag "Foward Ticket" if $ENV{TEST_VERBOSE};
+diag "Forward Ticket" if $ENV{TEST_VERBOSE};
{
$m->follow_link_ok(
{ id => 'page-actions-forward' },
@@ -56,7 +56,7 @@ diag "Foward Ticket" if $ENV{TEST_VERBOSE};
like( $mail, qr!$att_name!, 'att file name' );
}
-diag "Foward Transaction" if $ENV{TEST_VERBOSE};
+diag "Forward Transaction" if $ENV{TEST_VERBOSE};
{
$m->follow_link_ok( { text => 'Forward', n => 2 }, 'follow 2nd Forward' );
$m->submit_form(
@@ -83,7 +83,7 @@ qr/Forwarded Transaction #\d+ to rt-test, rt-to\@example.com, rt-cc\@example.com
like( $mail, qr!this is an attachment!, 'att content' );
}
-diag "Foward Ticket without content" if $ENV{TEST_VERBOSE};
+diag "Forward Ticket without content" if $ENV{TEST_VERBOSE};
{
my $ticket = RT::Test->create_ticket(
Subject => 'test forward without content',
@@ -97,7 +97,115 @@ diag "Foward Ticket without content" if $ENV{TEST_VERBOSE};
);
$m->content_contains( 'Send email successfully', 'sent mail msg' );
my ($mail) = RT::Test->fetch_caught_mails;
- like( $mail, qr/Subject: Fwd: \[example\.com #2\] test forward without content/, 'Subject field' );
+ like( $mail, qr/Subject: Fwd: \[example\.com #\d\] test forward without content/, 'Subject field' );
like( $mail, qr/To: rt-test\@example\.com/, 'To field' );
- like( $mail, qr/This is a forward of ticket #2/, 'content' );
+ like( $mail, qr/This is a forward of ticket #\d/, 'content' );
+}
+
+diag "Forward Transaction with attachments but empty content" if $ENV{TEST_VERBOSE};
+{
+ # Create a ticket without content but with a non-text/plain attachment
+ $m->get_ok( $baseurl . '/Ticket/Create.html?Queue=1' );
+
+ $m->form_name('TicketCreate');
+ my $attach = $m->current_form->find_input('Attach');
+ $attach->filename("awesome.patch");
+ $attach->headers('Content-Type' => 'text/x-diff');
+ $m->set_fields(
+ Subject => 'test forward, empty content but attachments',
+ Attach => $att_file, # from up top
+ );
+ $m->click('AddMoreAttach');
+ $m->form_name('TicketCreate');
+ $attach = $m->current_form->find_input('Attach');
+ $attach->filename("bpslogo.png");
+ $attach->headers('Content-Type' => 'image/png');
+ $m->set_fields(
+ Attach => RT::Test::get_relocatable_file('bpslogo.png', '..', 'data'), # an image!
+ );
+ $m->submit;
+ $m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
+ $m->content_like( qr/awesome\.patch/, 'uploaded patch file' );
+ $m->content_like( qr/text\/x-diff/, 'uploaded patch file content type' );
+ $m->content_like( qr/bpslogo\.png/, 'uploaded image file' );
+ $m->content_like( qr/image\/png/, 'uploaded image file content type' );
+ RT::Test->clean_caught_mails;
+
+ $m->follow_link_ok( { text => 'Forward', n => 2 }, 'follow 2nd Forward' );
+ $m->submit_form(
+ form_name => 'ForwardMessage',
+ fields => {
+ To => 'rt-test at example.com',
+ },
+ button => 'ForwardAndReturn'
+ );
+ $m->content_contains( 'Send email successfully', 'sent mail msg' );
+ $m->content_like( qr/Forwarded Transaction #\d+ to rt-test\@example\.com/, 'txn msg' );
+ my ($mail) = RT::Test->fetch_caught_mails;
+ like( $mail, qr/Subject: test forward, empty content but attachments/, 'Subject field' );
+ like( $mail, qr/To: rt-test\@example.com/, 'To field' );
+ like( $mail, qr/This is a forward of transaction/, 'content' );
+ like( $mail, qr/awesome\.patch/, 'att file name' );
+ like( $mail, qr/this is an attachment/, 'att content' );
+ like( $mail, qr/text\/x-diff/, 'att content type' );
+ like( $mail, qr/bpslogo\.png/, 'att image file name' );
+ like( $mail, qr/image\/png/, 'att image content type' );
}
+
+diag "Forward Transaction with attachments but no 'content' part" if $ENV{TEST_VERBOSE};
+{
+ my $mime = MIME::Entity->build(
+ From => 'test at example.com',
+ Subject => 'attachments for everyone',
+ Type => 'multipart/mixed',
+ );
+
+ $mime->attach(
+ Path => $att_file,
+ Type => 'text/x-diff',
+ Filename => 'awesome.patch',
+ );
+
+ $mime->attach(
+ Path => RT::Test::get_relocatable_file('bpslogo.png', '..', 'data'),
+ Type => 'image/png',
+ Filename => 'bpslogo.png',
+ Encoding => 'base64',
+ );
+
+ my $ticket = RT::Test->create_ticket(
+ Queue => 1,
+ Subject => 'test foward, attachments but no "content"',
+ MIMEObj => $mime,
+ );
+
+ $m->get_ok( $baseurl . '/Ticket/Display.html?id=' . $ticket->Id );
+ $m->content_like( qr/awesome\.patch/, 'uploaded patch file' );
+ $m->content_like( qr/text\/x-diff/, 'uploaded patch file content type' );
+ $m->content_like( qr/bpslogo\.png/, 'uploaded image file' );
+ $m->content_like( qr/image\/png/, 'uploaded image file content type' );
+ RT::Test->clean_caught_mails;
+
+ $m->follow_link_ok( { text => 'Forward', n => 2 }, 'follow 2nd Forward' );
+ $m->submit_form(
+ form_name => 'ForwardMessage',
+ fields => {
+ To => 'rt-test at example.com',
+ },
+ button => 'ForwardAndReturn'
+ );
+ $m->content_contains( 'Send email successfully', 'sent mail msg' );
+ $m->content_like( qr/Forwarded Transaction #\d+ to rt-test\@example\.com/, 'txn msg' );
+ my ($mail) = RT::Test->fetch_caught_mails;
+ like( $mail, qr/Subject: test foward, attachments but no "content"/, 'Subject field' );
+ like( $mail, qr/To: rt-test\@example.com/, 'To field' );
+ like( $mail, qr/This is a forward of transaction/, 'content' );
+ like( $mail, qr/awesome\.patch/, 'att file name' );
+ like( $mail, qr/this is an attachment/, 'att content' );
+ like( $mail, qr/text\/x-diff/, 'att content type' );
+ like( $mail, qr/bpslogo\.png/, 'att image file name' );
+ like( $mail, qr/image\/png/, 'att image content type' );
+}
+
+undef $m;
+done_testing;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list