root/t/20policy-subscribe.t

Revision 303:6f57b7328cb8, 1.1 KB (checked in by Anselm Lingnau <anselm@…>, 9 months ago)

The Great Renaming: Change all command names to 'pl-*' and directory to '.pl'.
The idea behind this is to emphasise that the software is called ?*Project*
Lancelot? as opposed to plain ?Lancelot?. There is apparently a KDE tool that
goes by the name of ?Lancelot?, and we want to make clear that this is separate
and different. Also, Project Lancelot has been around for a lot longer!

Line 
1
2use strict;
3
4BEGIN { chdir 't' if -d 't' }
5use lib '../lib';
6
7use Test::More tests => 4;
8use File::Path;
9
10use Lancelot::DB;
11use Lancelot::Template;
12use Lancelot::Message;
13
14sub copy_msg {
15    return Lancelot::Message->new($_[0]->as_string);
16}
17
18BEGIN { use_ok('Lancelot::Module::policy_subscribe'); }
19
20my ($listname) = 'pl-testlist@example.com';
21
22rmtree("$ENV{HOME}/.pl/$listname", 0);
23
24my $db = new Lancelot::DB $listname, { create => 1 };
25$db->set_config('list.name', 'Pl-testlist');
26
27
28my $msg = Lancelot::Message->new('From: hugo@example.com
29To: susi@example.net
30Subject: Test
31
32This is a test.
33');
34
35# Tests for closed list
36
37$db->set_config('subscribe.type', 'open');
38my $result = Lancelot::Module::policy_subscribe::execute($db, $msg);
39is($result, "", "subscribe.type is open");
40
41$db->set_config('subscribe.type', 'closed');
42$result = Lancelot::Module::policy_subscribe::execute($db, $msg);
43is($result, "closed-list-message", "subscribe.type is closed");
44
45$db->delete_configs('subscribe.type');
46$result = Lancelot::Module::policy_subscribe::execute($db, $msg);
47is($result, "", "default for subscribe.type is open");
Note: See TracBrowser for help on using the browser.