/[notice-sender]/trunk/t/1_nos.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/t/1_nos.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 45 by dpavlin, Wed May 18 13:12:54 2005 UTC revision 56 by dpavlin, Tue Jun 21 09:14:54 2005 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use blib;  use blib;
5    
6  use Test::More tests => 38;  use Test::More tests => 50;
7    
8  BEGIN { use_ok('Nos') };  BEGIN { use_ok('Nos') };
9    
# Line 17  ok($nos->_get_list('My list'), "_get_lis Line 17  ok($nos->_get_list('My list'), "_get_lis
17  ok($nos->_get_list('another'), "_get_list");  ok($nos->_get_list('another'), "_get_list");
18  ok($nos->_get_list('test'), "_get_list");  ok($nos->_get_list('test'), "_get_list");
19    
20    my %ext_id;
21    
22  my $i = 0;  my $i = 0;
23  foreach my $email (qw(foo@example.com bar@example.com baz@example.com)) {  foreach my $email (qw(foo@example.com bar@example.com baz@example.com)) {
24          my $full_name = uc($1)." Doe" if ($email =~ m/^([^@]+)@/);          my $full_name = uc($1)." Doe" if ($email =~ m/^([^@]+)@/);
25          ok($nos->add_member_to_list( list => 'My list', email => $email, name => $full_name ), "add_member_to_list $email");          ok($nos->add_member_to_list( list => 'My list', email => $email, name => $full_name, ext_id => $i ), "add_member_to_list $email, ext_id = $i");
26          ok($nos->add_member_to_list( list => 'another', email => $email ), "add_member_to_list $email") if ($i % 2 == 0);          ok($nos->add_member_to_list( list => 'another', email => $email ), "add_member_to_list $email") if ($i % 2 == 0);
27          ok($nos->add_member_to_list( list => 'test', email => $email ), "add_member_to_list $email") if ($i % 3 == 0);          ok($nos->add_member_to_list( list => 'test', email => $email, ext_id => $i ), "add_member_to_list $email, ext_id = $i") if ($i % 3 == 0);
28            $ext_id{$email} = $i;
29          $i++;          $i++;
30  }  }
31    
# Line 37  cmp_ok(scalar $nos->list_members( list = Line 40  cmp_ok(scalar $nos->list_members( list =
40  cmp_ok(scalar $nos->list_members( list => 'another' ), '==', 2, 'members of another');  cmp_ok(scalar $nos->list_members( list => 'another' ), '==', 2, 'members of another');
41  cmp_ok(scalar $nos->list_members( list => 'test' ), '==', 1, 'members of test');  cmp_ok(scalar $nos->list_members( list => 'test' ), '==', 1, 'members of test');
42    
43    foreach my $list (('My list', 'another', 'test')) {
44            diag "checking list $list";
45            foreach my $m ( $nos->list_members( list => $list ) ) {
46                    ok(my $email = $m->{'email'}, "have email");
47                    cmp_ok($m->{'ext_id'}, 'eq', $ext_id{$email}, "ext_id($email)=$ext_id{$email}");
48            }
49    }
50    
51    
52  ok($nos->delete_member( email => 'foo@example.com' ), "delete");  ok($nos->delete_member( email => 'foo@example.com' ), "delete");
53    
54  cmp_ok(scalar $nos->list_members( list => 'My list' ), '==', 2, 'members of My list');  cmp_ok(scalar $nos->list_members( list => 'My list' ), '==', 2, 'members of My list');

Legend:
Removed from v.45  
changed lines
  Added in v.56

  ViewVC Help
Powered by ViewVC 1.1.26