Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sieve.deliver_multiple_users #4882

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions cassandane/tiny-tests/Sieve/deliver_multiple_users
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!perl
use Cassandane::Tiny;

sub test_deliver_multiple_users
:needs_component_sieve :NoAltNameSpace
{
my ($self) = @_;

# create 2 other users
$self->{instance}->create_user('other1');
$self->{instance}->create_user('other2');

# install redirect script for cassandane
$self->{instance}->install_sieve_script(<<EOF
redirect "cass\@example.com";
EOF
, username => 'cassandane');

# install fileinto script for other2
$self->{instance}->install_sieve_script(<<EOF
require ["fileinto", "mailbox", "imap4flags"];
fileinto :flags "\\\\Flagged" :create "INBOX.sub";
EOF
, username => 'other2');

# deliver a message to all 3 users
my $msg1 = $self->{gen}->generate(subject => "Message 1");
$self->{instance}->deliver($msg1,
users => [ 'cassandane', 'other1', 'other2' ]);

# message should NOT appear in cassandane INBOX
my $admintalk = $self->{adminstore}->get_client();
$admintalk->examine('user.cassandane');
$admintalk->fetch('1', '(flags)');
$self->assert_str_equals('no', $admintalk->get_last_completion_response());

# message should appear in other1 INBOX
$admintalk->examine('user.other1');
my $res = $admintalk->fetch('1', '(flags)');
$self->assert_str_equals('ok', $admintalk->get_last_completion_response());
$self->assert_deep_equals($res, { '1' => { 'flags' => [ '\\Recent'] }});

# message should NOT appear in other2 INBOX
$admintalk->examine('user.other2');
$admintalk->fetch('1', '(flags)');
$self->assert_str_equals('no', $admintalk->get_last_completion_response());

# message should appear in other2 INBOX.sub
$admintalk->examine('user.other2.sub');
$res = $admintalk->fetch('1', '(flags)');
$self->assert_str_equals('ok', $admintalk->get_last_completion_response());
$self->assert_deep_equals($res,
{ '1' => { 'flags' => [ '\\Recent', '\\Flagged'] }});
}
Loading