+{
+ my $id = send_via_mailgate('binary-asc-attach-marked-plain-text.txt');
+
+ my $tick = RT::Ticket->new( $RT::SystemUser );
+ $tick->Load( $id );
+ ok ($tick->id, "loaded ticket #$id");
+
+ my $txn = $tick->Transactions->First;
+ my ($msg, @attachs) = @{$txn->Attachments->ItemsArrayRef};
+
+ is (scalar @attachs, 3, 'text, attachment and original');
+ my $bin = $attachs[1];
+ is(
+ (split /;/, $bin->GetHeader('Content-Type'))[0],
+ 'application/octet-stream',
+ 'binary attachment'
+ );
+ is(md5_hex($bin->Content), '1e35f1aa90c98ca2bab85c26ae3e1ba7', "correct png");
+}
+
+{
+ my $id = send_via_mailgate('inline-binary-attachment-with-wrap.txt');
+
+ my $tick = RT::Ticket->new( $RT::SystemUser );
+ $tick->Load( $id );
+ ok ($tick->id, "loaded ticket #$id");
+
+ my $txn = $tick->Transactions->First;
+ my ($msg, @attachs) = @{$txn->Attachments->ItemsArrayRef};
+
+ is (scalar @attachs, 3, 'text, attachment and original');
+ my $bin = $attachs[1];
+ is(
+ (split /;/, $bin->GetHeader('Content-Type'))[0],
+ 'application/octet-stream',
+ 'binary attachment'
+ );
+ is(md5_hex($bin->Content), '1e35f1aa90c98ca2bab85c26ae3e1ba7', "correct png");
+}
+