From 62a85a600ce5772b358eff9e15b42d5e05780463 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Sun, 27 Mar 2016 15:24:15 +0200 Subject: [PATCH] Extend bugreport test cases to check the output of some control messages This exposes #767327 (wrong package links in "reassigned" message) as a test failure. Signed-off-by: Don Armstrong --- t/07_bugreport.t | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/t/07_bugreport.t b/t/07_bugreport.t index 3600e1ca..80dfc922 100644 --- a/t/07_bugreport.t +++ b/t/07_bugreport.t @@ -1,7 +1,7 @@ # -*- mode: cperl;-*- -use Test::More tests => 8; +use Test::More tests => 14; use warnings; use strict; @@ -90,7 +90,44 @@ 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'\.}, + }, + 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 -- 2.39.5