diff options
author | ivan <ivan> | 2011-02-17 00:25:23 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-02-17 00:25:23 +0000 |
commit | 0fb307c305e4bc2c9c27dc25a3308beae3a4d33c (patch) | |
tree | 9d527e17db4b4d875f63f019dcd513762bb938a6 /rt/t/api/attachment_filename.t | |
parent | 6a79fae0c14b6635c67b4f224ee4a14f263b37d0 (diff) | |
parent | fc6209f398899f0211cfcedeb81a3cd65e04a941 (diff) |
This commit was generated by cvs2svn to compensate for changes in r10640,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'rt/t/api/attachment_filename.t')
-rw-r--r-- | rt/t/api/attachment_filename.t | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/rt/t/api/attachment_filename.t b/rt/t/api/attachment_filename.t new file mode 100644 index 000000000..2eced0127 --- /dev/null +++ b/rt/t/api/attachment_filename.t @@ -0,0 +1,39 @@ +use RT::Test tests => 5; +use MIME::Entity; +my $ticket = RT::Ticket->new($RT::SystemUser); +my $mime = MIME::Entity->build( + From => 'test@example.com', + Type => 'text/html', + Data => ["test attachment's filename\n"], +); + +$mime->attach( + Path => 'share/html/NoAuth/images/bplogo.gif', + Type => 'image/gif', +); + +$mime->attach( + Path => 'share/html/NoAuth/images/bplogo.gif', + Type => 'image/gif', + Filename => 'bplogo.gif', +); + +$mime->attach( + Path => 'share/html/NoAuth/images/bplogo.gif', + Filename => 'images/bplogo.gif', + Type => 'image/gif', +); + +my $id = $ticket->Create( MIMEObj => $mime, Queue => 'General' ); +ok( $id, "created ticket $id" ); + +my $atts = RT::Attachments->new( $RT::SystemUser ); +$atts->Limit( FIELD => 'ContentType', VALUE => 'image/gif' ); +is( $atts->Count, 3, 'got 3 gif files' ); + +# no matter if mime's filename include path or not, +# we should throw away the path all the time. +while ( my $att = $atts->Next ) { + is( $att->Filename, 'bplogo.gif', "attachment's filename" ); +} + |