summaryrefslogtreecommitdiff
path: root/rt/t/api/attachment.t
diff options
context:
space:
mode:
authorivan <ivan>2011-02-17 00:25:23 +0000
committerivan <ivan>2011-02-17 00:25:23 +0000
commit0fb307c305e4bc2c9c27dc25a3308beae3a4d33c (patch)
tree9d527e17db4b4d875f63f019dcd513762bb938a6 /rt/t/api/attachment.t
parent6a79fae0c14b6635c67b4f224ee4a14f263b37d0 (diff)
parentfc6209f398899f0211cfcedeb81a3cd65e04a941 (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.t')
-rw-r--r--rt/t/api/attachment.t26
1 files changed, 25 insertions, 1 deletions
diff --git a/rt/t/api/attachment.t b/rt/t/api/attachment.t
index 07c46bad0..282d2a3de 100644
--- a/rt/t/api/attachment.t
+++ b/rt/t/api/attachment.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 4;
+use RT::Test tests => 7;
{
@@ -42,4 +42,28 @@ is ($#headers, 2, "testing a bunch of singline multiple headers" );
}
+
+{
+ my $iso_8859_1_ticket_email =
+ RT::Test::get_relocatable_file( 'new-ticket-from-iso-8859-1',
+ ( File::Spec->updir(), 'data', 'emails' ) );
+ my $content = RT::Test->file_content($iso_8859_1_ticket_email);
+
+ my $parser = RT::EmailParser->new;
+ $parser->ParseMIMEEntityFromScalar($content);
+ my $attachment = RT::Attachment->new( $RT::SystemUser );
+ my ( $id, $msg ) =
+ $attachment->Create( TransactionId => 1, Attachment => $parser->Entity );
+ ok( $id, $msg );
+ my $mime = $attachment->ContentAsMIME;
+ like( $mime->head->get('Content-Type'),
+ qr/charset="iso-8859-1"/, 'content type of ContentAsMIME is original' );
+ require Encode;
+ is(
+ Encode::decode( 'iso-8859-1', $mime->stringify_body ),
+ Encode::decode( 'utf8', "HÃ¥vard\n" ),
+ 'body of ContentAsMIME is original'
+ );
+}
+
1;