diff options
author | Eric Wong <normalperson@yhbt.net> | 2014-02-11 00:36:06 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2014-02-11 00:36:06 +0000 |
commit | 858f0a2960123d6d2cbced1bb18e4e5e524df21e (patch) | |
tree | fae844af890e158f116f6369935cdecf4812fe41 /t | |
parent | b5b6e0f45c5ee171d71b549146432a68d6707531 (diff) | |
download | public-inbox-858f0a2960123d6d2cbced1bb18e4e5e524df21e.tar.gz |
move pre-spamc checks to PublicInbox->precheck
We may add more checks before we go to spamc.
Diffstat (limited to 't')
-rw-r--r-- | t/precheck.t (renamed from t/recipient.t) | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/t/recipient.t b/t/precheck.t index 9cb1969e..6deead98 100644 --- a/t/recipient.t +++ b/t/precheck.t @@ -14,19 +14,19 @@ sub do_checks { local %ENV; delete $ENV{ORIGINAL_RECIPIENT}; - ok(PublicInbox->recipient_specified($f), + ok(PublicInbox->precheck($f), "ORIGINAL_RECIPIENT unset is OK"); $ENV{ORIGINAL_RECIPIENT} = 'foo@example.com'; - ok(!PublicInbox->recipient_specified($f), + ok(!PublicInbox->precheck($f), "wrong ORIGINAL_RECIPIENT rejected"); $ENV{ORIGINAL_RECIPIENT} = 'b@example.com'; - ok(PublicInbox->recipient_specified($f), + ok(PublicInbox->precheck($f), "ORIGINAL_RECIPIENT in To: is OK"); $ENV{ORIGINAL_RECIPIENT} = 'c@example.com'; - ok(PublicInbox->recipient_specified($f), + ok(PublicInbox->precheck($f), "ORIGINAL_RECIPIENT in Cc: is OK"); } @@ -56,4 +56,19 @@ sub do_checks { )); } +{ + $ENV{ORIGINAL_RECIPIENT} = 'b@example.com'; + my $s = Email::Simple->create( + header => [ + To => 'b@example.com', + Cc => 'c@example.com', + 'Content-Type' => 'text/plain', + Subject => 'this is a subject', + ], + body => "hello world\n", + ); + my $f = Email::Filter->new(data => $s->as_string); + ok(!PublicInbox->precheck($f), "missing From: is rejected"); +} + done_testing(); |