4 use Test::More tests => 3;
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(:all);
28 %config = create_debbugs_configuration(debug => exists $ENV{DEBUG}?$ENV{DEBUG}:0);
34 # Output some debugging information if there's an error
37 foreach my $key (keys %config) {
38 diag("$key: $config{$key}\n");
44 send_message(to=>'submit@bugs.something',
45 headers => [To => 'submit@bugs.something',
46 From => 'foo@bugs.something',
47 Subject => 'Submitting a bug',
49 body => <<EOF) or fail('Unable to send message');
59 # start up an HTTP::Server::Simple
60 my $bugreport_cgi_handler = sub {
61 # I do not understand why this is necessary.
62 $ENV{DEBBUGS_CONFIG_FILE} = "$config{config_dir}/debbugs_config";
63 my $content = qx(perl -I. -T cgi/bugreport.cgi);
64 $content =~ s/^\s*Content-Type:[^\n]+\n*//si;
70 ok(DebbugsTest::HTTPServer::fork_and_create_webserver($bugreport_cgi_handler,$port),
71 'forked HTTP::Server::Simple successfully');
73 my $mech = Test::WWW::Mechanize->new();
75 $mech->get_ok('http://localhost:'.$port.'/?bug=1',
77 ok($mech->content() =~ qr/\<title\>\#1.+Submitting a bug/i,
78 'Title of bug is submitting a bug');
80 # Other tests for bugs in the page should be added here eventually