diff options
author | Eric Wong <e@80x24.org> | 2014-03-31 20:16:19 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2014-04-05 06:55:35 +0000 |
commit | b949afc9edf89dd494cac6255c78b124d58e11a5 (patch) | |
tree | 0f913be48d2ddbd98449714cb4bac3e0a69e2803 /t | |
parent | 23c5bbce9529577c3a70b8ee26aa98310d5bc3b0 (diff) | |
download | public-inbox-b949afc9edf89dd494cac6255c78b124d58e11a5.tar.gz |
We will also be using the RECIPIENT env in the future, since that takes aliases into account. Reducing the possible callsites to check ENV means we can more easily update the code in the future.
Diffstat (limited to 't')
-rw-r--r-- | t/precheck.t | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/t/precheck.t b/t/precheck.t index f9d61d8e..1bfa4c9f 100644 --- a/t/precheck.t +++ b/t/precheck.t @@ -11,23 +11,21 @@ sub do_checks { my ($s) = @_; my $f = Email::Filter->new(data => $s->as_string); - local %ENV; - delete $ENV{ORIGINAL_RECIPIENT}; - ok(PublicInbox->precheck($f), - "ORIGINAL_RECIPIENT unset is OK"); + ok(PublicInbox->precheck($f, undef), + "RECIPIENT unset is OK"); - $ENV{ORIGINAL_RECIPIENT} = 'foo@example.com'; - ok(!PublicInbox->precheck($f), - "wrong ORIGINAL_RECIPIENT rejected"); + my $recipient = 'foo@example.com'; + ok(!PublicInbox->precheck($f, $recipient), + "wrong RECIPIENT rejected"); - $ENV{ORIGINAL_RECIPIENT} = 'b@example.com'; - ok(PublicInbox->precheck($f), - "ORIGINAL_RECIPIENT in To: is OK"); + $recipient = 'b@example.com'; + ok(PublicInbox->precheck($f, $recipient), + "RECIPIENT in To: is OK"); - $ENV{ORIGINAL_RECIPIENT} = 'c@example.com'; - ok(PublicInbox->precheck($f), - "ORIGINAL_RECIPIENT in Cc: is OK"); + $recipient = 'c@example.com'; + ok(PublicInbox->precheck($f, $recipient), + "RECIPIENT in Cc: is OK"); } { @@ -59,7 +57,7 @@ sub do_checks { } { - $ENV{ORIGINAL_RECIPIENT} = 'b@example.com'; + my $recipient = 'b@example.com'; my $s = Email::Simple->create( header => [ To => 'b@example.com', @@ -71,7 +69,7 @@ sub do_checks { body => "hello world\n", ); my $f = Email::Filter->new(data => $s->as_string); - ok(!PublicInbox->precheck($f), "missing From: is rejected"); + ok(!PublicInbox->precheck($f, $recipient), "missing From: is rejected"); } done_testing(); |