X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=t%2F11_blocks.t;h=11c765ac5cdaaebf07d69b503eb694db9dd87551;hb=4c244879af2b9e8c0055968d7ffb054646cb7607;hp=553fe251ef16e200084536eeb4828b34fc7eb447;hpb=e7c19ba4fddf6b342fc3467e10f18b2f685c612a;p=debbugs.git diff --git a/t/11_blocks.t b/t/11_blocks.t index 553fe25..11c765a 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,6 +21,7 @@ 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 {}; @@ -159,3 +160,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');