3 |
use strict; |
use strict; |
4 |
use blib; |
use blib; |
5 |
|
|
6 |
use Test::More tests => 36; |
use Test::More tests => 38; |
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 $debug = 0; |
16 |
my $list_name = 'SOAP test'; |
my $list_name = 'SOAP test'; |
17 |
|
|
18 |
ok(my $nos = new Nos::SOAP('dsn' => 'dbi:Pg:dbname=notices'), "new"); |
$debug = 1 if (@ARGV); |
19 |
|
|
20 |
ok(my $daemon = new SOAP::Transport::HTTP::Daemon(LocalAddr => 'localhost')->dispatch_to('Nos::SOAP'), "SOAP daemon"); |
my $aliases = Cwd::abs_path($0); |
21 |
|
$aliases =~ s#/[^/]*$#/#; |
22 |
|
$aliases .= 'aliases'; |
23 |
|
|
24 |
|
ok($aliases, "using aliases file $aliases"); |
25 |
|
|
26 |
|
ok(new Nos::SOAP( |
27 |
|
'dsn' => 'dbi:Pg:dbname=notices', |
28 |
|
'aliases' => $aliases, |
29 |
|
), "new"); |
30 |
|
|
31 |
|
ok(my $daemon = new SOAP::Transport::HTTP::Daemon(LocalAddr => 'localhost')->dispatch_to('Nos::SOAP'), "SOAP daemon"); |
32 |
|
|
33 |
# start server |
# start server |
34 |
|
|
52 |
->uri('http://localhost/Nos/SOAP/') |
->uri('http://localhost/Nos/SOAP/') |
53 |
->proxy($daemon->url); |
->proxy($daemon->url); |
54 |
|
|
55 |
|
$soap->on_debug(sub{print "## ", join("\n## ",@_), "\n";}) if ($debug); |
56 |
|
|
57 |
# NewList |
# NewList |
58 |
|
|
59 |
ok(my $list_id = $soap->NewList({ |
ok(my $list_id = $soap->NewList({ |
60 |
list => $list_name, |
list => $list_name, |
61 |
from => 'SOAP list', |
from => 'SOAP list', |
62 |
email => 'soap-test@example.com', |
email => 'soap-test@example.com', |
63 |
})->result, "NewList named"); |
})->result, "NewList named"); |
64 |
|
|
65 |
ok(my $list_id2 = $soap->NewList( |
ok(my $list_id2 = $soap->NewList( |
194 |
ok(! kill(0, $pid), "child dead"); |
ok(! kill(0, $pid), "child dead"); |
195 |
|
|
196 |
exit 1; |
exit 1; |
197 |
|
|