diff options
Diffstat (limited to 't')
-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; |