diff --git a/test/fixtures/mail24.box b/test/fixtures/mail24.box new file mode 100644 index 000000000..3bac30941 --- /dev/null +++ b/test/fixtures/mail24.box @@ -0,0 +1,48 @@ +Return-Path: oracle@ELIG0-1-DB01.example.com +Received: by ELIG0-1-DB01 (Postfix, from userid 1000) + id 1F4D8383B7; Thu, 18 Sep 2014 09:30:01 +0200 (CEST) +Received: from ELIG0-1-DB01 (static-62-50-37-197.irtnet.net [62.50.37.197]) + by mail2.mail.example.com (Postfix) with ESMTP + id 43854316E9; Thu, 18 Sep 2014 09:30:01 +0200 (CEST) +Received: from mail2.mail.example.com (perls.mail.example.com [195.30.107.84]) + by mail.example.com (Postfix) with ESMTP id 4DE3C471003F; + Thu, 18 Sep 2014 09:30:01 +0200 (CEST) +Received: from mail.example.com ([127.0.0.1]) + by localhost (mail.example.com [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id AtfOMc9Eru0V; Thu, 18 Sep 2014 09:30:01 +0200 (CEST) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.example.com (Postfix) with ESMTP id 3C7B54710042; + Thu, 18 Sep 2014 09:30:06 +0200 (CEST) +Received: from mail.example.com (LHLO mail.example.com) (195.30.107.40) by + mail.example.com with LMTP; Thu, 18 Sep 2014 09:30:06 +0200 (CEST) +Date: Thu, 18 Sep 2014 09:30:01 +0200 (CEST) +From: oracle@IG0-1-DB01.example.com +To: support@example.com +Subject: Regelsets im Test-Status gefunden: 1 +Message-ID: <279749720.2270042.1412150446700.JavaMail.root@mail.example.com> +Content-Type: multipart/mixed; + boundary="=_ddc0e1e5-3d61-45a1-88f4-7f1b332d2495"; generated=true +X-Virus-Scanned: amavisd-new at mail.example.com +X-Spam-Flag: NO +X-Spam-Score: -1.897 +X-Spam-Level: +X-Spam-Status: No, score=-1.897 tagged_above=-10 required=6.6 + tests=[BAYES_00=-1.9, FSL_HELO_NON_FQDN_1=0.001, HELO_NO_DOMAIN=0.001, + TO_NO_BRKTS_PCNT=0.001] autolearn=ham +MIME-Version: 1.0 + +--=_ddc0e1e5-3d61-45a1-88f4-7f1b332d2495 +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + + + +--=_ddc0e1e5-3d61-45a1-88f4-7f1b332d2495 +Content-Type: text/csv +Content-Disposition: attachment; filename=rulesets-report.csv +Content-Transfer-Encoding: 7bit + +RULESET_ID;NAME;ACTIV;RUN_MODE;AUDIT_MODIFY_DATE +387;DP DHL JOIN - EN : Einladung eAC;T;SM;1.09.14 + +--=_ddc0e1e5-3d61-45a1-88f4-7f1b332d2495-- diff --git a/test/fixtures/mail25.box b/test/fixtures/mail25.box new file mode 100644 index 000000000..1fb67a639 --- /dev/null +++ b/test/fixtures/mail25.box @@ -0,0 +1,36 @@ +Return-Path: oracle@IG0-1-DB01.example.com +Received: from mail.example.com (LHLO mail.example.com) (195.30.107.40) by + mail.example.com with LMTP; Thu, 18 Sep 2014 09:30:06 +0200 (CEST) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.example.com (Postfix) with ESMTP id 3C7B54710042; + Thu, 18 Sep 2014 09:30:06 +0200 (CEST) +X-Virus-Scanned: amavisd-new at mail.example.com +X-Spam-Flag: NO +X-Spam-Score: -1.897 +X-Spam-Level: +X-Spam-Status: No, score=-1.897 tagged_above=-10 required=6.6 + tests=[BAYES_00=-1.9, FSL_HELO_NON_FQDN_1=0.001, HELO_NO_DOMAIN=0.001, + TO_NO_BRKTS_PCNT=0.001] autolearn=ham +Received: from mail.example.com ([127.0.0.1]) + by localhost (mail.example.com [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id AtfOMc9Eru0V; Thu, 18 Sep 2014 09:30:01 +0200 (CEST) +Received: from mail2.mail.example.com (perls.mail.example.com [195.30.107.84]) + by mail.example.com (Postfix) with ESMTP id 4DE3C471003F; + Thu, 18 Sep 2014 09:30:01 +0200 (CEST) +Received: from IG0-1-DB01 (static-62-50-37-197.irtnet.net [62.50.37.197]) + by mail2.mail.example.com (Postfix) with ESMTP + id 43854316E9; Thu, 18 Sep 2014 09:30:01 +0200 (CEST) +Received: by IG0-1-DB01 (Postfix, from userid 1000) + id 1F4D8383B7; Thu, 18 Sep 2014 09:30:01 +0200 (CEST) +To: support@example.com +Subject: Regelsets im Test-Status gefunden: 1 +Message-Id: <20140918073001.1F4D8383B7@IG0-1-DB01> +Date: Thu, 18 Sep 2014 09:30:01 +0200 (CEST) +From: oracle@IG0-1-DB01.example.com + +begin 644 rulesets-report.csv +M4E5,15-%5%])1#M.04U%.T%#5$E6.U)53E]-3T1%.T%51$E47TU/1$E&65]$ +M051%"C,X-SM$4"!$2$P@2D])3B`M($5.(#H@16EN;&%D=6YG(&5!0SM4.U-- +*.S$W+C`Y+C$T"@`` +` +end diff --git a/test/unit/email_parser_test.rb b/test/unit/email_parser_test.rb index b6e164a0d..28f27e327 100644 --- a/test/unit/email_parser_test.rb +++ b/test/unit/email_parser_test.rb @@ -492,6 +492,45 @@ Freemont and pulling out several minutes. :to => 'undisclosed-recipients: ;', }, }, + { + :data => IO.read('test/fixtures/mail24.box'), + :body_md5 => 'd41d8cd98f00b204e9800998ecf8427e', + :params => { + :from => 'oracle@IG0-1-DB01.example.com', + :from_email => 'oracle@IG0-1-DB01.example.com', + :from_display_name => '', + :subject => 'Regelsets im Test-Status gefunden: 1', + :to => 'support@example.com', + :body => '', + }, + :attachments => [ + { + :data => 'RULESET_ID;NAME;ACTIV;RUN_MODE;AUDIT_MODIFY_DATE +387;DP DHL JOIN - EN : Einladung eAC;T;SM;1.09.14 +', + :md5 => 'a61c76479fdc2f107fe2697ac5ad60ae', + :filename => 'rulesets-report.csv', + }, + ], + }, + { + :data => IO.read('test/fixtures/mail25.box'), + :body_md5 => '436f71d8d8a4ffbd3f18fc9de7d7f767', + :params => { + :from => 'oracle@IG0-1-DB01.example.com', + :from_email => 'oracle@IG0-1-DB01.example.com', + :from_display_name => '', + :subject => 'Regelsets im Test-Status gefunden: 1', + :to => 'support@example.com', + :body => "begin 644 rulesets-report.csv +M4E5,15-%5%])1#M.04U%.T%#5$E6.U)53E]-3T1%.T%51$E47TU/1$E&65]$ +M051%\"C,X-SM$4\"!$2$P@2D])3B`M($5.(#H@16EN;&%D=6YG(&5!0SM4.U-- +*.S$W+C`Y+C$T\"@`` +` +end +", + }, + }, ] files.each { |file| @@ -524,7 +563,7 @@ Freemont and pulling out several minutes. data[:attachments].each { |attachment_parser| next if found file_md5 = Digest::MD5.hexdigest( attachment_parser[:data] ) -# puts 'Attachment:' + attachment_parser.inspect + '-' + file_md5 + #puts 'Attachment:' + attachment_parser.inspect + '-' + file_md5 if attachment[:md5] == file_md5 found = true assert_equal( attachment[:filename], attachment_parser[:filename] )