4 use Test::More tests => 4;
9 # Here, we're going to shoot messages through a set of things that can
12 # First, we're going to send mesages to receive.
13 # To do so, we'll first send a message to submit,
14 # then send messages to the newly created bugnumber.
17 use File::Temp qw(tempdir);
19 use Debbugs::MIME qw(create_mime_message);
20 use File::Basename qw(dirname basename);
21 use Test::WWW::Mechanize;
22 # The test functions are placed here to make things easier
24 use DebbugsTest qw(:configuration);
29 %config = create_debbugs_configuration(debug => exists $ENV{DEBUG}?$ENV{DEBUG}:0);
35 # Output some debugging information if there's an error
38 foreach my $key (keys %config) {
39 diag("$key: $config{$key}\n");
45 send_message(to=>'submit@bugs.something',
46 headers => [To => 'submit@bugs.something',
47 From => 'foo@bugs.something',
48 Subject => 'Submitting a bug',
50 body => <<EOF) or fail('Unable to send message');
62 # We'd like to use soap.cgi here instead of testing the module
63 # directly, but I can't quite get it to work with
64 # HTTP::Server::Simple.
65 use_ok('Debbugs::SOAP');
66 use_ok('Debbugs::SOAP::Server');
68 our $child_pid = undef;
71 if (defined $child_pid) {
78 die "Unable to fork child" if not defined $pid;
81 # Wait for two seconds to let the child start
87 use Debbugs::SOAP::Server;
88 @Debbugs::SOAP::Server::ISA = qw(SOAP::Transport::HTTP::Daemon);
90 ->new(LocalAddr => 'localhost', LocalPort => $port)
91 ->dispatch_to('/','Debbugs::SOAP')
97 my $soap = SOAP::Lite->uri('Debbugs/SOAP')->proxy('http://localhost:'.$port.'/');
98 #ok($soap->get_soap_version->result == 1,'Version set and got correctly');
99 my $bugs = $soap->get_bugs(package => 'foo')->result;
101 ok(@{$bugs} == 1 && $bugs->[0] == 1, 'get_bugs returns bug number 1') or fail(Dumper($bugs));
102 my $status = $soap->get_status(1)->result;
103 ok($status->{1}{package} eq 'foo','get_status thinks that bug 1 belongs in foo') or fail(Dumper($status));
105 # Test the usertags at some point