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);
22 %config = create_debbugs_configuration();
29 send_message(to=>'submit@bugs.something',
30 headers => [To => 'submit@bugs.something',
31 From => 'foo@bugs.something',
32 Subject => 'Submitting a bug',
34 body => <<EOF) or fail('Unable to send message');
42 # test the soap server
46 # We'd like to use soap.cgi here instead of testing the module
47 # directly, but I can't quite get it to work with
48 # HTTP::Server::Simple.
49 use_ok('Debbugs::SOAP');
50 use_ok('Debbugs::SOAP::Server');
52 our $child_pid = undef;
55 if (defined $child_pid) {
64 die "Unable to fork child" if not defined $pid;
67 # Wait for two seconds to let the child start
73 use Debbugs::SOAP::Server;
74 @Debbugs::SOAP::Server::ISA = qw(SOAP::Transport::HTTP::Daemon);
77 # Ignore stupid warning because elements (hashes) can't start with
79 local $SIG{__WARN__} = sub {$warnings .= $_[0] unless $_[0] =~ /Cannot encode unnamed element/};
81 ->new(LocalAddr => 'localhost', LocalPort => $port)
82 ->dispatch_to('/','Debbugs::SOAP')
86 warn $warnings if length $warnings;
92 my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://localhost:'.$port.'/');
93 #ok($soap->get_soap_version->result == 1,'Version set and got correctly');
94 my $bugs_result = $soap->get_bugs(package => 'foo');
95 my $bugs = $bugs_result->result;
97 #print STDERR Dumper($bugs_result);
98 ok(@{$bugs} == 1 && $bugs->[0] == 1, 'get_bugs returns bug number 1') or fail(Dumper($bugs));
99 my $status_result = $soap->get_status(1);
100 #print STDERR Dumper($status_result);
101 my $status = $status_result->result;
102 ok($status->{1}{package} eq 'foo','get_status thinks that bug 1 belongs in foo') or fail(Dumper($status));
104 # Test the usertags at some point