2 # $Id: 05_mail.t,v 1.1 2005/08/17 21:46:17 don Exp $
4 use Test::More tests => 2;
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);
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 => 'Submiting a bug',
50 body => <<EOF) or fail('Unable to send message');
60 # start up an HTTP::Server::Simple
61 my $bugreport_cgi_handler = sub {
62 # I do not understand why this is necessary.
63 $ENV{DEBBUGS_CONFIG_FILE} = "$config{config_dir}/debbugs_config";
64 print qx(perl -I. -T cgi/bugreport.cgi);
69 ok(DebbugsTest::HTTPServer::fork_and_create_webserver($bugreport_cgi_handler,$port),
70 'forked HTTP::Server::Simple successfully');
73 my $mech = Test::WWW::Mechanize->new();
75 $mech->get_ok('http://localhost:'.$port.'/?bug=1');