aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2017-01-29 13:40:19 +0000
committerdakkar <dakkar@thenautilus.net>2017-01-29 13:40:19 +0000
commit9f49c7ceed9906522ae81f5e0443852df7b416e3 (patch)
tree6c9497f28ee0deda22a9e37af62cb119746fc25b
parentmoderation messages work enough, kill TODO (diff)
downloadSietima-9f49c7ceed9906522ae81f5e0443852df7b416e3.tar.gz
Sietima-9f49c7ceed9906522ae81f5e0443852df7b416e3.tar.bz2
Sietima-9f49c7ceed9906522ae81f5e0443852df7b416e3.zip
fix SubscriberFromHashRef
it made it easy to set prefs, but impossible to set aliases
-rw-r--r--lib/Sietima/Types.pm2
-rw-r--r--t/tests/sietima/role/nomail.t4
-rw-r--r--t/tests/sietima/role/replyto.t4
-rw-r--r--t/tests/sietima/role/subscriberonly/drop.t12
4 files changed, 16 insertions, 6 deletions
diff --git a/lib/Sietima/Types.pm b/lib/Sietima/Types.pm
index 49312b4..39b9f8e 100644
--- a/lib/Sietima/Types.pm
+++ b/lib/Sietima/Types.pm
@@ -48,6 +48,6 @@ declare_coercion SubscriberFromStr,
declare_coercion SubscriberFromHashRef,
to_type Subscriber, from HashRef,
- q{ my $a = delete $_->{address};Sietima::Subscriber->new({raw_address => $a, prefs => $_ }) };
+ q{ my $a = delete $_->{address};Sietima::Subscriber->new({raw_address => $a, $_->%* }) };
1;
diff --git a/t/tests/sietima/role/nomail.t b/t/tests/sietima/role/nomail.t
index 1622fb4..1ff724c 100644
--- a/t/tests/sietima/role/nomail.t
+++ b/t/tests/sietima/role/nomail.t
@@ -8,7 +8,7 @@ subtest 'disabled' => sub {
subscribers => [
{
address => 'one@users.example.com',
- wants_mail => 0,
+ prefs => { wants_mail => 0 },
},
'two@users.example.com',
],
@@ -26,7 +26,7 @@ subtest 'enabled' => sub {
subscribers => [
{
address => 'one@users.example.com',
- wants_mail => 1,
+ prefs => { wants_mail => 1 },
},
'two@users.example.com',
],
diff --git a/t/tests/sietima/role/replyto.t b/t/tests/sietima/role/replyto.t
index bae1bdf..0ede95e 100644
--- a/t/tests/sietima/role/replyto.t
+++ b/t/tests/sietima/role/replyto.t
@@ -82,7 +82,7 @@ subtest 'enabled for some' => sub {
subscribers => [
{
address => 'one@users.example.com',
- munge_reply_to => 1,
+ prefs => { munge_reply_to => 1 },
},
'two@users.example.com',
],
@@ -115,7 +115,7 @@ subtest 'disabled for some' => sub {
subscribers => [
{
address => 'one@users.example.com',
- munge_reply_to => 0,
+ prefs => { munge_reply_to => 0 },
},
'two@users.example.com',
],
diff --git a/t/tests/sietima/role/subscriberonly/drop.t b/t/tests/sietima/role/subscriberonly/drop.t
index 6229bb3..77b4b5f 100644
--- a/t/tests/sietima/role/subscriberonly/drop.t
+++ b/t/tests/sietima/role/subscriberonly/drop.t
@@ -4,7 +4,10 @@ use Test::Sietima;
my @subscriber_addresses = (
'one@users.example.com',
- 'two@users.example.com',
+ {
+ address => 'two@users.example.com',
+ aliases => [ 'two-two@users.example.com' ],
+ },
);
my $s = make_sietima(
with_traits => ['SubscriberOnly::Drop'],
@@ -18,6 +21,13 @@ subtest 'from subscriber' => sub {
);
};
+subtest 'from subscriber alias' => sub {
+ test_sending(
+ sietima => $s,
+ mail => { from=>'two-two@users.example.com' },
+ );
+};
+
subtest 'from non-subscriber' => sub {
test_sending(
sietima => $s,