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