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(debug => exists $ENV{DEBUG}?$ENV{DEBUG}:0);
28 # Output some debugging information if we're debugging
31 foreach my $key (keys %config) {
32 diag("$key: $config{$key}\n");
38 send_message(to=>'submit@bugs.something',
39 headers => [To => 'submit@bugs.something',
40 From => 'foo@bugs.something',
41 Subject => 'Submitting a bug',
43 body => <<EOF) or fail('Unable to send message');
51 # test the soap server
55 # We'd like to use soap.cgi here instead of testing the module
56 # directly, but I can't quite get it to work with
57 # HTTP::Server::Simple.
58 use_ok('Debbugs::SOAP');
59 use_ok('Debbugs::SOAP::Server');
61 our $child_pid = undef;
64 if (defined $child_pid) {
73 die "Unable to fork child" if not defined $pid;
76 # Wait for two seconds to let the child start
82 use Debbugs::SOAP::Server;
83 @Debbugs::SOAP::Server::ISA = qw(SOAP::Transport::HTTP::Daemon);
86 # Ignore stupid warning because elements (hashes) can't start with
88 local $SIG{__WARN__} = sub {$warnings .= $_[0] unless $_[0] =~ /Cannot encode unnamed element/};
90 ->new(LocalAddr => 'localhost', LocalPort => $port)
91 ->dispatch_to('/','Debbugs::SOAP')
95 warn $warnings if length $warnings;
101 my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://localhost:'.$port.'/');
102 #ok($soap->get_soap_version->result == 1,'Version set and got correctly');
103 my $bugs_result = $soap->get_bugs(package => 'foo');
104 my $bugs = $bugs_result->result;
106 #print STDERR Dumper($bugs_result);
107 ok(@{$bugs} == 1 && $bugs->[0] == 1, 'get_bugs returns bug number 1') or fail(Dumper($bugs));
108 my $status_result = $soap->get_status(1);
109 #print STDERR Dumper($status_result);
110 my $status = $status_result->result;
111 ok($status->{1}{package} eq 'foo','get_status thinks that bug 1 belongs in foo') or fail(Dumper($status));
113 # Test the usertags at some point