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();
35 send_message(to=>'submit@bugs.something',
36 headers => [To => 'submit@bugs.something',
37 From => 'foo@bugs.something',
38 Subject => 'Submitting a bug',
40 body => <<EOF) or fail('Unable to send message');
50 # start up an HTTP::Server::Simple
51 my $pkgreport_cgi_handler = sub {
52 # I do not understand why this is necessary.
53 $ENV{DEBBUGS_CONFIG_FILE} = "$config{config_dir}/debbugs_config";
54 # We cd here because pkgreport uses require ./common.pl
55 my $content = qx(cd cgi; perl -I.. -T pkgreport.cgi);
56 # Strip off the Content-Type: stuff
57 $content =~ s/^\s*Content-Type:[^\n]+\n*//si;
63 ok(DebbugsTest::HTTPServer::fork_and_create_webserver($pkgreport_cgi_handler,$port),
64 'forked HTTP::Server::Simple successfully');
67 my $mech = Test::WWW::Mechanize->new(autocheck => 1);
69 $mech->get_ok('http://localhost:'.$port.'/?pkg=foo');
71 # I'd like to use $mech->title_ok(), but I'm not sure why it doesn't
73 ok($mech->content()=~ qr/package foo/i,
74 'Package title seems ok',
77 # Test more stuff here