/[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 75 by dpavlin, Wed Aug 24 21:27:40 2005 UTC revision 76 by dpavlin, Wed Aug 24 22:11:00 2005 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use blib;  use blib;
5    
6  use Test::More tests => 89;  use Test::More tests => 100;
7  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
8    
9  BEGIN {  BEGIN {
# Line 81  foreach my $list (('My list', 'another', Line 81  foreach my $list (('My list', 'another',
81          }          }
82  }  }
83    
84  # now test sending  # test sending
85    
86  ok(my $sent = $nos->send_queued_messages(  ok(my $sent = $nos->send_queued_messages(
87          list => 'My list',          list => 'My list',
# Line 91  ok(my $sent = $nos->send_queued_messages Line 91  ok(my $sent = $nos->send_queued_messages
91    
92  cmp_ok( scalar(Email::Send::Test->emails), '==', $sent, "sent $sent emails" );  cmp_ok( scalar(Email::Send::Test->emails), '==', $sent, "sent $sent emails" );
93    
94  # now test received  # replay to messages
95    
96    for (my $i = 0; $i < $sent; $i++) {
97            ok(my $msg = $Email::Send::Test::emails[$i], "email $i");
98            isa_ok($msg, 'Email::Simple');
99            my ($from, $to);
100            ok($from = $msg->header("From"), "found From: $from");
101            ok($to = $msg->header("To"), "found To: $to");
102    
103            ok($nos->inbox_message(
104                    list => 'My list',
105                    message => "From: $to
106    To: $from
107    Subject: reply $i
108    X-Mailer: test of notice-sender
109    Mailer: just to make Mail::Alias happy
110    
111    test reply $i",
112            ), "inbox_message $i");
113    
114    }
115    
116    # test received
117    
118    ok(my @r = $nos->received_messages( email => 'foo@example.com' ), 'received from foo@example.com');
119    cmp_ok( scalar @r, '==', $sent, "received $sent messages");
120    
 ok($nos->received_messages( email => 'foo@example.com' ), 'received from foo@example.com');  
121  ok($nos->received_messages( list => 'My list' ), 'received to My list');  ok($nos->received_messages( list => 'My list' ), 'received to My list');
122    
123  # do some changes  # do some changes
# Line 143  foreach my $list (( 'My list', 'test', ' Line 167  foreach my $list (( 'My list', 'test', '
167          ok(! $nos->_get_list($list), "$list doesn't exist");          ok(! $nos->_get_list($list), "$list doesn't exist");
168  }  }
169    
170    exit;
171    
172    # make warn happy
173    @Email::Send::Test::emails = [];
174    

Legend:
Removed from v.75  
changed lines
  Added in v.76

  ViewVC Help
Powered by ViewVC 1.1.26