1 |
#!/usr/bin/perl -w |
2 |
|
3 |
use strict; |
4 |
use blib; |
5 |
|
6 |
use Test::More tests => 23; |
7 |
|
8 |
BEGIN { use_ok('Nos') }; |
9 |
|
10 |
ok(my $nos = new Nos('dsn' => 'dbi:Pg:dbname=notices'), "new"); |
11 |
|
12 |
ok($nos->new_list( list => 'My list', email => 'my-list@example.com'), "new_list my-list"); |
13 |
ok($nos->new_list( list => 'My list', email => 'my2@example.com'), "new_list my2"); |
14 |
|
15 |
ok($nos->_add_list( list => 'Another list', email => 'list2@example.com'), "_add_list"); |
16 |
ok($nos->_get_list('Another list'), "_get_list"); |
17 |
|
18 |
foreach my $email (qw(foo@example.com bar@example.com baz@example.com)) { |
19 |
ok($nos->add_member_to_list( list => 'My list', email => $email ), "add_member_to_list $email"); |
20 |
ok($nos->add_member_to_list( list => 'Another list', email => $email ), "add_member_to_list $email"); |
21 |
} |
22 |
|
23 |
ok($nos->add_message_to_list( list => 'My list', message => "Subject: test\nJust a test" ), "add_message_to_list"); |
24 |
|
25 |
foreach my $i ( 1 .. 10 ) { |
26 |
ok($nos->add_message_to_list( list => 'Another list', message => "Subject: test $i" ), "add_message_to_list"); |
27 |
} |