diff options
author | dakkar <dakkar@thenautilus.net> | 2017-03-24 16:32:52 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2017-03-24 16:32:52 +0000 |
commit | 561dcb678dd6e8520e927365f3737315c0fe0577 (patch) | |
tree | 6788bc69a924a3dd39d080b804776fb681d85457 /t/tests | |
parent | fix list headers (diff) | |
download | Sietima-561dcb678dd6e8520e927365f3737315c0fe0577.tar.gz Sietima-561dcb678dd6e8520e927365f3737315c0fe0577.tar.bz2 Sietima-561dcb678dd6e8520e927365f3737315c0fe0577.zip |
allow List-Post: NO
Diffstat (limited to 't/tests')
-rw-r--r-- | t/tests/sietima/role/headers.t | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/t/tests/sietima/role/headers.t b/t/tests/sietima/role/headers.t index eb96dd2..6dcfff3 100644 --- a/t/tests/sietima/role/headers.t +++ b/t/tests/sietima/role/headers.t @@ -17,17 +17,30 @@ package Sietima::Role::ForTesting { }; }; -my $s = make_sietima( - with_traits => ['Headers','WithOwner','ForTesting'], - name => 'test-list', - owner => 'owner@example.com', - subscribers => [ - 'one@users.example.com', - 'two@users.example.com', - ], -); +package Sietima::Role::ForTesting2 { + use Moo::Role; + use Sietima::Policy; + use Sietima::Types qw(AddressFromStr); + + around list_addresses => sub($orig,$self) { + return { + $self->$orig->%*, + post => 0, + }; + }; +}; subtest 'list headers should be added' => sub { + my $s = make_sietima( + with_traits => ['Headers','WithOwner','ForTesting'], + name => 'test-list', + owner => 'owner@example.com', + subscribers => [ + 'one@users.example.com', + 'two@users.example.com', + ], + ); + test_sending( sietima => $s, mails => [ @@ -55,4 +68,29 @@ subtest 'list headers should be added' => sub { ); }; +subtest 'no-post list' => sub { + my $s = make_sietima( + with_traits => ['Headers','WithOwner','ForTesting2'], + name => 'test-list', + owner => 'owner@example.com', + subscribers => [ + 'one@users.example.com', + 'two@users.example.com', + ], + ); + + test_sending( + sietima => $s, + mails => [ + object { + call sub { +{ shift->header_raw_pairs } } => hash { + field 'List-Post' => 'NO'; + + etc; + }; + }, + ], + ); +}; + done_testing; |