[otrs-cvs] otrs/scripts/test/EmailParser Win7SnippingTool.t, NONE, 1.1

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/scripts/test/EmailParser
In directory lancelot:/tmp/cvs-serv22719/scripts/test/EmailParser

Added Files:
	Win7SnippingTool.t 
Log Message:
Added test case for an email from the Win7 snipping tool which is invalid and therefore cannot be parsed by MIME::Tools correctly.

Author: mg

--- NEW FILE: Win7SnippingTool.t ---
# --
# Win7SnippingTool.t - email parser tests
# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
# --
# $Id: Win7SnippingTool.t,v 1.1 2013/01/29 15:18:00 mg Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

use strict;
use warnings;
use vars (qw($Self));
use utf8;

=cut
This is a test for an email from the Win7 snipping tool. This email is an invalid
mime message and therefore cannot be parsed by MIME::Tools correctly.

See also: http://bugs.otrs.org/show_bug.cgi?id=8092
=cut

use Kernel::System::EmailParser;

my $Home = $Self->{ConfigObject}->Get('Home');

# test for bug#1970
my @Array = ();
open( IN, "< $Home/scripts/test/sample/EmailParser/Win7SnippingTool.box" );
while (<IN>) {
    push( @Array, $_ );
}
close(IN);

# create local object
my $EmailParserObject = Kernel::System::EmailParser->new(
    %{$Self},
    Email => \@Array,
);

my @Attachments = $EmailParserObject->GetAttachments();

#use MIME::Parser;
#my $parser = new MIME::Parser;
#$parser->output_under("/tmp");
#my $entity = $parser->parse_open("$Home/scripts/test/sample/EmailParser/Win7SnippingTool.box");
#
#use Data::Dumper;
#print STDERR "Dump: " . Dumper(\@Attachments) . "\n";

$Self->Is(
    scalar @Attachments,
    2,
    "Found files",
);

$Self->Is(
    $Attachments[0]->{'ContentType'} || '',
    'multipart/alternative; ',
    "Unparseable content part",
);

1;
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.