[Rt-commit] rt branch, 4.2/attach-from-transactions, updated. rt-4.0.1-409-gf54f1b6

? sunnavy sunnavy at bestpractical.com
Wed Feb 8 08:18:31 EST 2012


The branch, 4.2/attach-from-transactions has been updated
       via  f54f1b6e56cb0dbbd347d037282c1e13c00e99f9 (commit)
      from  52dcce0024e9a336666390bc51b856439c303ac8 (commit)

Summary of changes:
 t/web/attach-from-txn.t |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit f54f1b6e56cb0dbbd347d037282c1e13c00e99f9
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Feb 8 21:17:53 2012 +0800

    test attachments selection with uploaded ones in the mean time

diff --git a/t/web/attach-from-txn.t b/t/web/attach-from-txn.t
index 9491326..b0de370 100644
--- a/t/web/attach-from-txn.t
+++ b/t/web/attach-from-txn.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 54;
+use RT::Test tests => 70;
 
 my $LogoName    = 'image.png';
 my $ImageName   = 'owls.jpg';
@@ -97,6 +97,38 @@ like $mail, qr/RT-Attach: \d+/, "found attachment we expected";
 like $mail, qr/RT-Attachment: \d+\/\d+\/\d+/, "found RT-Attachment header";
 like $mail, qr/filename=.?\Q$ImageName\E.?/, "found filename";
 
+# Reply to first correspondence, including an attachment with an uploaded one
+$m->follow_link_ok({text => 'Reply', n => 3}, "reply to the reply");
+$m->form_name('TicketUpdate');
+$m->current_form->find_input('AttachExisting', 'checkbox', 2)->check; # owls.jpg
+$m->field( 'UpdateContent', 'attachments from both list and upload' );
+$m->field('Attach', $LogoFile);
+$m->click('SubmitTicket');
+is($m->status, 200, "request successful");
+
+# yep, we got it and processed the header!
+$m->content_contains('attachments from both list and upload');
+$m->content_like(qr/(RT-Attach:.+?\Q$ImageName\E).*\1/s, 'found rt attach header');
+$m->content_like(qr/Subject:.+?\Q$LogoName\E/s, 'found rt attach header');
+
+# outgoing looks good
+$m->follow_link_ok({text => 'Show', n => 4}, "found show link");
+$m->content_like(qr/RT-Attach: \d+/, "found RT-Attach header");
+$m->content_like(qr/RT-Attachment: \d+\/\d+\/\d+/, "found RT-Attachment header");
+$m->content_lacks($ImageName);
+$m->content_lacks($LogoName);
+$m->back;
+
+# check that it got into mail
+ at mails = RT::Test->fetch_caught_mails;
+is scalar @mails, 1, "got one outgoing email";
+$mail = shift @mails;
+like $mail, qr/To: owls\@localhost/, 'got To';
+like $mail, qr/RT-Attach: \d+/, "found attachment we expected";
+like $mail, qr/RT-Attachment: \d+\/\d+\/\d+/, "found RT-Attachment header";
+like $mail, qr/filename=.?\Q$ImageName\E.?/, "found selected filename";
+like $mail, qr/filename=.?\Q$LogoName\E.?/, "found uploaded filename";
+
 # add header to template, make a normal reply, and see that it worked
 my $link = $m->find_link(text_regex => qr/\Q$LogoName\E/, url_regex => qr/Attachment/);
 ok $link;

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


More information about the Rt-commit mailing list