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
commitfc6209f398899f0211cfcedeb81a3cd65e04a941 (patch)
treebc1dc8876218529948413d85c17cd67508bdd38d /rt/t/api/attachment.t
parente70abd21bab68b23488f7ef1ee2e693a3b365691 (diff)
import rt 3.8.9
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;