From 561dcb678dd6e8520e927365f3737315c0fe0577 Mon Sep 17 00:00:00 2001 From: dakkar Date: Fri, 24 Mar 2017 16:32:52 +0000 Subject: allow List-Post: NO --- t/tests/sietima/role/headers.t | 56 +++++++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 9 deletions(-) (limited to 't') 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; -- cgit v1.2.3