/[notice-sender]/trunk/t/2_soap.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/2_soap.t

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

revision 62 by dpavlin, Wed Jun 22 12:31:45 2005 UTC revision 67 by dpavlin, Fri Jul 8 17:00:20 2005 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use blib;  use blib;
5    
6  use Test::More tests => 29;  use Test::More tests => 36;
7    
8  BEGIN {  BEGIN {
9          use_ok('Nos');          use_ok('Nos');
10          use_ok('SOAP::Transport::HTTP');          use_ok('SOAP::Transport::HTTP');
11          use_ok('SOAP::Lite');          use_ok('SOAP::Lite');
12            use_ok('Cwd');
13  };  };
14    
15  my $list_name = 'SOAP test';  my $list_name = 'SOAP test';
16    
17  ok(my $nos = new Nos::SOAP('dsn' => 'dbi:Pg:dbname=notices'), "new");  my $aliases = Cwd::abs_path($0);
18    $aliases =~ s#/[^/]*$#/#;
19    $aliases .= 'aliases';
20    
21    ok($aliases, "using aliases file $aliases");
22    
23    ok(my $nos = new Nos::SOAP(
24            'dsn' => 'dbi:Pg:dbname=notices',
25            'aliases' => $aliases,
26    ), "new");
27    
28  ok(my $daemon = new SOAP::Transport::HTTP::Daemon(LocalAddr => 'localhost')->dispatch_to('Nos::SOAP'), "SOAP daemon");  ok(my $daemon = new SOAP::Transport::HTTP::Daemon(LocalAddr => 'localhost')->dispatch_to('Nos::SOAP'), "SOAP daemon");
29    
   
30  # start server  # start server
31    
32  my $pid;  my $pid;
# Line 43  my $soap = SOAP::Lite Line 52  my $soap = SOAP::Lite
52  # NewList  # NewList
53    
54  ok(my $list_id = $soap->NewList({  ok(my $list_id = $soap->NewList({
55          list => $list_name,                  list => $list_name,
56          from => 'SOAP list',                  from => 'SOAP list',
57          email => 'soap-test@example.com',                  email => 'soap-test@example.com',
58  })->result, "NewList named");  })->result, "NewList named");
59    
60  ok(my $list_id2 = $soap->NewList(  ok(my $list_id2 = $soap->NewList(
# Line 143  ok($arr = $soap->ListMembers({ Line 152  ok($arr = $soap->ListMembers({
152    
153  cmp_ok($#{$arr}, '==', 0, "member deleted");  cmp_ok($#{$arr}, '==', 0, "member deleted");
154    
155    # DeleteList
156    
157    ok($soap->DeleteList({
158            list => $list_name,
159    })->result, "DeleteList named");
160    
161    ok(my $has_members = $soap->ListMembers({
162            list => $list_name,
163    })->result, "ListMembers for $list_name");
164    
165    cmp_ok($#{$has_members}, '==', -1, "ok, no members");
166    
167    ok($list_id = $soap->NewList({
168            list => $list_name,
169            from => 'SOAP list',
170            email => 'soap-test@example.com',
171    })->result, "NewList $list_name (recreated)");
172    
173    ok($soap->DeleteList(
174            $list_name,
175    )->result, "DeleteList positional");
176    
177    ok($has_members = $soap->ListMembers({
178            list => $list_name,
179    })->result, "ListMembers for $list_name");
180    
181    cmp_ok($#{$has_members}, '==', -1, "ok, no members");
182    
183  # kill server  # kill server
184    
185  ok(kill('HUP' => $pid), "kill $pid");  ok(kill('HUP' => $pid), "kill $pid");
# Line 152  ok(waitpid($pid,0), "waitpid"); Line 189  ok(waitpid($pid,0), "waitpid");
189  ok(! kill(0, $pid), "child dead");  ok(! kill(0, $pid), "child dead");
190    
191  exit 1;  exit 1;
192    

Legend:
Removed from v.62  
changed lines
  Added in v.67

  ViewVC Help
Powered by ViewVC 1.1.26