aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/exim_log_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/exim_log_spec.rb')
-rw-r--r--spec/models/exim_log_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/exim_log_spec.rb b/spec/models/exim_log_spec.rb
index 48dc9876e..563ca5d06 100644
--- a/spec/models/exim_log_spec.rb
+++ b/spec/models/exim_log_spec.rb
@@ -61,4 +61,26 @@ describe EximLog do
EximLog.load_file("/var/log/exim4/exim-mainlog-2012-10-10.gz")
end
end
+
+ context "Postfix" do
+ let(:log) {[
+"Oct 3 16:39:35 host postfix/pickup[2257]: CB55836EE58C: uid=1003 from=<foitest+request-14-e0e09f97@example.com>",
+"Oct 3 16:39:35 host postfix/cleanup[7674]: CB55836EE58C: message-id=<ogm-15+506bdda7a4551-20ee@example.com>",
+"Oct 3 16:39:35 host postfix/qmgr[1673]: 9634B16F7F7: from=<foitest+request-10-1234@example.com>, size=368, nrcpt=1 (queue active)",
+"Oct 3 16:39:35 host postfix/qmgr[15615]: CB55836EE58C: from=<foitest+request-14-e0e09f97@example.com>, size=1695, nrcpt=1 (queue active)",
+"Oct 3 16:39:38 host postfix/smtp[7676]: CB55836EE58C: to=<foi@some.gov.au>, relay=aspmx.l.google.com[74.125.25.27]:25, delay=2.5, delays=0.13/0.02/1.7/0.59, dsn=2.0.0, status=sent (250 2.0.0 OK 1349246383 j9si1676296paw.328)",
+"Oct 3 16:39:38 host postfix/smtp[1681]: 9634B16F7F7: to=<kdent@example.com>, relay=none, delay=46, status=deferred (connect to 216.150.150.131[216.150.150.131]: No route to host)",
+"Oct 3 16:39:38 host postfix/qmgr[15615]: CB55836EE58C: removed",
+ ]}
+
+ describe ".scan_for_postfix_queue_ids" do
+ it "returns the queue ids of interest with the connected email addresses" do
+ Configuration.stub!(:incoming_email_domain).and_return("example.com")
+ EximLog.scan_for_postfix_queue_ids(log).should == {
+ "CB55836EE58C" => ["request-14-e0e09f97@example.com"],
+ "9634B16F7F7" => ["request-10-1234@example.com"]
+ }
+ end
+ end
+ end
end