diff options
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(); |