4 use Test::More tests => 4;
10 use File::Temp qw(tempdir);
12 use Debbugs::MIME qw(create_mime_message);
13 use File::Basename qw(dirname basename);
14 use Test::WWW::Mechanize;
15 # The test functions are placed here to make things easier
17 use DebbugsTest qw(:configuration);
20 my %config = create_debbugs_configuration();
24 send_message(to=>'submit@bugs.something',
25 headers => [To => 'submit@bugs.something',
26 From => 'foo@bugs.something',
27 Subject => 'Submitting a bug',
29 body => <<EOF) or fail('Unable to send message');
37 # test the soap server
41 # We'd like to use soap.cgi here instead of testing the module
42 # directly, but I can't quite get it to work with
43 # HTTP::Server::Simple.
44 use_ok('Debbugs::SOAP');
45 use_ok('Debbugs::SOAP::Server');
47 our $child_pid = undef;
50 if (defined $child_pid) {
59 die "Unable to fork child" if not defined $pid;
62 # Wait for two seconds to let the child start
68 use Debbugs::SOAP::Server;
69 @Debbugs::SOAP::Server::ISA = qw(SOAP::Transport::HTTP::Daemon);
72 # Ignore stupid warning because elements (hashes) can't start with
74 local $SIG{__WARN__} = sub {$warnings .= $_[0] unless $_[0] =~ /Cannot encode unnamed element/};
76 ->new(LocalAddr => 'localhost', LocalPort => $port)
77 ->dispatch_to('/','Debbugs::SOAP')
81 warn $warnings if length $warnings;
87 my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://localhost:'.$port.'/');
88 #ok($soap->get_soap_version->result == 1,'Version set and got correctly');
89 my $bugs_result = $soap->get_bugs(package => 'foo');
90 my $bugs = $bugs_result->result;
92 #print STDERR Dumper($bugs_result);
93 ok(@{$bugs} == 1 && $bugs->[0] == 1, 'get_bugs returns bug number 1') or fail(Dumper($bugs));
94 my $status_result = $soap->get_status(1);
95 #print STDERR Dumper($status_result);
96 my $status = $status_result->result;
97 ok($status->{1}{package} eq 'foo','get_status thinks that bug 1 belongs in foo') or fail(Dumper($status));
99 # Test the usertags at some point