X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=t%2F07_bugreport.t;h=78d89b1d0e1c060442b11793eaa831589476e40a;hb=ec74d9703b7f7045ec85d9c66ae19a0710fd0bd9;hp=18ccbc5c9cc472dbf759da64d87e74bac9416d41;hpb=343464a69a83b5b2f1e956386482baaaccbc835c;p=debbugs.git diff --git a/t/07_bugreport.t b/t/07_bugreport.t index 18ccbc5..78d89b1 100644 --- a/t/07_bugreport.t +++ b/t/07_bugreport.t @@ -1,7 +1,7 @@ # -*- mode: cperl;-*- -use Test::More tests => 3; +use Test::More tests => 16; use warnings; use strict; @@ -77,4 +77,61 @@ $mech->get_ok('http://localhost:'.$port.'/?bug=1', ok($mech->content() =~ qr/\\#1.+Submitting a bug/i, 'Title of bug is submitting a bug'); +$mech->get_ok('http://localhost:'.$port.'/?bug=1;mbox=yes', + 'Page received ok'); +ok($mech->content() =~ qr/Subject: Submitting a bug/i, + 'Subject of bug maibox is right'); +ok($mech->content() =~ qr/^From /m, + 'Starts with a From appropriately'); + +$mech->get_ok('http://localhost:'.$port.'/?bug=1;mboxmaint=yes', + 'Page received ok'); +print STDERR $mech->content(); +ok($mech->content() !~ qr/[\x01\x02\x03\x05\x06\x07]/i, + 'No unescaped states'); + +# now test the output of some control commands +my @control_commands = + ( + reassign_foo => {command => 'reassign', + value => 'bar', + regex => qr{bug reassigned from package 'foo' to 'bar}, + }, + forwarded_foo => {command => 'forwarded', + value => 'https://foo.invalid/bugs?id=1', + regex => qr{Set bug forwarded-to-address to 'https://foo\.invalid/bugs\?id=1'\.}, + }, + forwarded_foo_2 => {command => 'forwarded', + value => 'https://foo.example/bugs?id=1', + regex => qr{Changed bug forwarded-to-address to 'https://foo\.example/bugs\?id=1' from 'https://foo\.invalid/bugs\?id=1'\.}, + }, + clone => {command => 'clone', + value => '-1', + regex => qr{Bug 1 cloned as bug 2}, + }, + ); + +while (my ($command,$control_command) = splice(@control_commands,0,2)) { + # just check to see that control doesn't explode + $control_command->{value} = " $control_command->{value}" if length $control_command->{value} + and $control_command->{value} !~ /^\s/; + send_message(to => 'control@bugs.something', + headers => [To => 'control@bugs.something', + From => 'foo@bugs.something', + Subject => "Munging a bug with $command", + ], + body => <{command} 1$control_command->{value} +thanks +EOF + ; + # Now test that the output has changed accordingly + $mech->get_ok('http://localhost:'.$port.'/?bug=1', + 'Page received ok'); + like($mech->content(), $control_command->{regex}, + 'Page matches regex'); +} + # Other tests for bugs in the page should be added here eventually +