diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fixtures/files/track-response-exchange-oof-1.email | 102 | ||||
-rw-r--r-- | spec/fixtures/files/track-response-generic-oof.email | 8 | ||||
-rw-r--r-- | spec/script/handle-mail-replies_spec.rb | 10 |
3 files changed, 120 insertions, 0 deletions
diff --git a/spec/fixtures/files/track-response-exchange-oof-1.email b/spec/fixtures/files/track-response-exchange-oof-1.email new file mode 100644 index 000000000..6bb696119 --- /dev/null +++ b/spec/fixtures/files/track-response-exchange-oof-1.email @@ -0,0 +1,102 @@ +Delivered-To: mysociety.robin@gmail.com +Received: by 10.216.187.197 with SMTP id y47cs73028wem; + Tue, 6 Sep 2011 00:02:08 -0700 (PDT) +Received: by 10.216.229.167 with SMTP id h39mr1763951weq.57.1315292527401; + Tue, 06 Sep 2011 00:02:07 -0700 (PDT) +Return-Path: <Firstname.Surname@example.com> +Received: from wildfire.ukcod.org.uk (wildfire.ukcod.org.uk [89.238.145.74]) + by mx.google.com with ESMTPS id i56si7850683wed.12.2011.09.06.00.02.05 + (version=TLSv1/SSLv3 cipher=OTHER); + Tue, 06 Sep 2011 00:02:06 -0700 (PDT) +Received-SPF: neutral (google.com: 89.238.145.74 is neither permitted nor denied by domain of Firstname.Surname@example.com) client-ip=89.238.145.74; +Authentication-Results: mx.google.com; spf=neutral (google.com: 89.238.145.74 is neither permitted nor denied by domain of Firstname.Surname@example.com) smtp.mail=Firstname.Surname@example.com +Received: from gweuoutb1.linde.com ([94.100.245.173]:15826) + by wildfire.ukcod.org.uk with esmtp (Exim 4.69) + (envelope-from <Firstname.Surname@example.com>) + id 1R0pfT-00074Q-Bb + for team@whatdotheyknow.com; Tue, 06 Sep 2011 08:01:59 +0100 +X-IronPort-AV: E=Sophos;i="4.68,337,1312149600"; + d="scan'208,217";a="16336258" +X-Header: No Trailer +Received: from unknown (HELO mlgmuc00mail099.boc.com) ([10.138.224.206]) + by gweub1.linde.grp with ESMTP; 06 Sep 2011 09:01:48 +0200 +Received: from mlgmuc00mail096.boc.com ([10.138.224.203]) by mlgmuc00mail099.boc.com with Microsoft SMTPSVC(6.0.3790.4675); + Tue, 6 Sep 2011 09:02:24 +0200 +Received: from VSUK4EX01.eu.boc.com ([172.18.77.27]) by mlgmuc00mail096.boc.com with Microsoft SMTPSVC(6.0.3790.4675); + Tue, 6 Sep 2011 09:01:32 +0200 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01CC6C62.CEC3EF3C" +Subject: Out of Office AutoReply: Was the response you got to your FOI request any good? +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Date: Tue, 6 Sep 2011 08:01:31 +0100 +Message-ID: <E75A6D7A72D76346A4BF6A27672C39AB11BFF525@VSUK4EX01.eu.boc.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Was the response you got to your FOI request any good? +Thread-Index: AcxsYs6PUz9cAAJDScO38LEWgNj/CQAAAA2I +From: "Surname,Firstname" <Firstname.Surname@example.com> +To: "WhatDoTheyKnow" <team@whatdotheyknow.com> +X-OriginalArrivalTime: 06 Sep 2011 07:01:32.0883 (UTC) FILETIME=[CF626A30:01CC6C62] +List-Id: Admin Team for What Do They Know <team@whatdotheyknow.com> + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01CC6C62.CEC3EF3C +Content-Type: text/plain; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +I am out of the office and have limited access to my emails until Thursday = +nth Bartember. If you have an urgent query the please telephone me on 1234= +5678. + + +The information contained in this email and any attachments may be confiden= +tial and is provided solely for the use of the intended recipient(s). If yo= +u are not the intended recipient, you are hereby notified that any disclosu= +re, distribution, or use of this e-mail, its attachments or any information= + contained therein is unauthorized and prohibited. If you have received thi= +s in error, please contact the sender immediately and delete this e-mail an= +d any attachments. + +No responsibility is accepted for any virus or defect that might arise from= + opening this e-mail or attachments, whether or not it has been checked by = +anti-virus software. + +------_=_NextPart_001_01CC6C62.CEC3EF3C +Content-Type: text/html; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<HTML> +<HEAD> +<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Diso-8859-= +1"> +<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version 6.5.7654.12"> +<TITLE>Out of Office AutoReply: Was the response you got to your FOI reques= +t any good?</TITLE> +</HEAD> +<BODY> +<!-- Converted from text/plain format --> + +<P><FONT SIZE=3D2>I am out of the office and have limited access to my emai= +ls until Thursday 8th September. If you have an urgent query the plea= +se telephone me on 12345678.</FONT></P> + +<font face=3D"monospace"><br> +<br> +The information contained in this email and any attachments may be confiden= +tial and is provided solely for the use of the intended recipient(s). If yo= +u are not the intended recipient, you are hereby notified that any disclosu= +re, distribution, or use of this e-mail, its attachments or any information= + contained therein is unauthorized and prohibited. If you have received thi= +s in error, please contact the sender immediately and delete this e-mail an= +d any attachments.<br> +<br> +No responsibility is accepted for any virus or defect that might arise from= + opening this e-mail or attachments, whether or not it has been checked by = +anti-virus software.</font></BODY> +</HTML> +------_=_NextPart_001_01CC6C62.CEC3EF3C-- + diff --git a/spec/fixtures/files/track-response-generic-oof.email b/spec/fixtures/files/track-response-generic-oof.email new file mode 100644 index 000000000..bf1e3e8fe --- /dev/null +++ b/spec/fixtures/files/track-response-generic-oof.email @@ -0,0 +1,8 @@ +From: Someone <someone@example.com> +Subject: Out of Office: Notification blah blah blah +To: track@whatdotheyknow.com +Return-Path: <> +Content-Type: text/plain; charset=utf-8 + +I am out of the office till the 12th of February, hunting lions in Africa. + diff --git a/spec/script/handle-mail-replies_spec.rb b/spec/script/handle-mail-replies_spec.rb index 856476c3f..2ef8d6afa 100644 --- a/spec/script/handle-mail-replies_spec.rb +++ b/spec/script/handle-mail-replies_spec.rb @@ -29,5 +29,15 @@ describe "When filtering" do r.status.should == 1 r.out.should == "FailedUser@example.com\n" end + + it "should detect a generic out-of-office" do + r = mail_reply_test("track-response-generic-oof.email") + r.status.should == 2 + end + + it "should detect an Exchange-style out-of-office" do + r = mail_reply_test("track-response-exchange-oof-1.email") + r.status.should == 2 + end end |