X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=t%2F11_blocks.t;h=72f7c35b687e6f93e0893c9583950306c425b46c;hb=1a1fa6f0af2be9d4076d9aad5f5a84c5fb3d9a8a;hp=553fe251ef16e200084536eeb4828b34fc7eb447;hpb=cadd91b26d489fe0028061415ef2d3ac43f21d13;p=debbugs.git
diff --git a/t/11_blocks.t b/t/11_blocks.t
index 553fe25..72f7c35 100644
--- a/t/11_blocks.t
+++ b/t/11_blocks.t
@@ -1,6 +1,6 @@
# -*- mode: cperl;-*-
-use Test::More tests => 14;
+use Test::More tests => 20;
use warnings;
use strict;
@@ -21,28 +21,18 @@ use File::Basename qw(dirname basename);
use lib qw(t/lib);
use DebbugsTest qw(:all);
use Data::Dumper;
+use Test::WWW::Mechanize;
# HTTP::Server:::Simple defines a SIG{CHLD} handler that breaks system; undef it here.
$SIG{CHLD} = sub {};
-my %config;
-eval {
- %config = create_debbugs_configuration(debug => exists $ENV{DEBUG}?$ENV{DEBUG}:0);
-};
-if ($@) {
- BAIL_OUT($@);
-}
+my %config = create_debbugs_configuration();
+
my $sendmail_dir = $config{sendmail_dir};
my $spool_dir = $config{spool_dir};
my $config_dir = $config{config_dir};
-END{
- if ($ENV{DEBUG}) {
- diag("spool_dir: $spool_dir\n");
- diag("config_dir: $config_dir\n");
- diag("sendmail_dir: $sendmail_dir\n");
- }
-}
+
# We're going to use create mime message to create these messages, and
# then just send them to receive.
@@ -159,3 +149,36 @@ ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: P
$status = read_bug(bug=>3);
ok($status->{blockedby} eq '5','bug 3 is blocked by exactly 5');
+
+# Check how this blocked bug is presented on the web interface
+
+# start up an HTTP::Server::Simple
+my $bugreport_cgi_handler = sub {
+ # I do not understand why this is necessary.
+ $ENV{DEBBUGS_CONFIG_FILE} = "$config{config_dir}/debbugs_config";
+ my $content = qx(perl -I. -T cgi/bugreport.cgi);
+ $content =~ s/^\s*Content-Type:[^\n]+\n*//si;
+ print $content;
+};
+
+my $port = 11342;
+
+ok(DebbugsTest::HTTPServer::fork_and_create_webserver($bugreport_cgi_handler,$port),
+ 'forked HTTP::Server::Simple successfully');
+
+my $mech = Test::WWW::Mechanize->new();
+
+$mech->get_ok('http://localhost:'.$port.'/?bug=10',
+ 'Page received ok');
+
+ok($mech->content() =~ qr//i,
+ 'Title of bug is \'Submitting a bug\'');
+
+ok($mech->content() =~ qr/Added blocking bug\(s\) of ]+10[^>]+>10<\/a>: ]+2[^>]+>2<\/a>/i,
+ '\'Added blocking bug(s) of x: y\' received markup');
+
+$mech->get_ok('http://localhost:'.$port.'/?bug=2',
+ 'Page received ok');
+
+ok($mech->content() =~ qr/Added indication that bug ]+2[^>]+>2<\/a> blocks ]+10[^>]+>10<\/a>/i,
+ '\'indication that bug x blocks y\' received markup');