]> git.donarmstrong.com Git - debbugs.git/blobdiff - t/07_bugreport.t
Fix unescaped From in bugreport (closes: #983847)
[debbugs.git] / t / 07_bugreport.t
index 5dfca0507772dd0c916a50dfbbf7224194bd5cd1..0e99f7f1ad69e4dbc7074c7fbf7eb27f6dc15f18 100644 (file)
@@ -1,7 +1,7 @@
 # -*- mode: cperl;-*-
 
 
-use Test::More tests => 18;
+use Test::More tests => 19;
 
 use warnings;
 use strict;
@@ -24,22 +24,8 @@ use HTTP::Status qw(RC_NOT_MODIFIED);
 use lib qw(t/lib);
 use DebbugsTest qw(:all);
 
-my %config;
-eval {
-     %config = create_debbugs_configuration(debug => exists $ENV{DEBUG}?$ENV{DEBUG}:0);
-};
-if ($@) {
-     BAIL_OUT($@);
-}
+my %config = create_debbugs_configuration();
 
-# Output some debugging information if there's an error
-END{
-     if ($ENV{DEBUG}) {
-         foreach my $key (keys %config) {
-              diag("$key: $config{$key}\n");
-         }
-     }
-}
 
 # create a bug
 send_message(to=>'submit@bugs.something',
@@ -51,7 +37,9 @@ send_message(to=>'submit@bugs.something',
 Package: foo
 Severity: normal
 
-This is a silly bug
+This is a silly bug which contains an unescaped From line.
+
+From line
 EOF
 
 
@@ -62,7 +50,7 @@ my $bugreport_cgi_handler = sub {
     # I do not understand why this is necessary.
     $ENV{DEBBUGS_CONFIG_FILE} = "$config{config_dir}/debbugs_config";
     my $fh;
-    open($fh,'-|',-e './cgi/version.cgi'? 'perl -I. -T ./cgi/bugreport.cgi' : 'perl -I. -T ../cgi/bugreport.cgi');
+    open($fh,'-|',-e './cgi/version.cgi'? 'perl -Ilib -T ./cgi/bugreport.cgi' : 'perl -Ilib -T ../cgi/bugreport.cgi');
     my $headers;
     my $status = 200;
     while (<$fh>) {
@@ -105,6 +93,9 @@ 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');
+ok($mech->content() =~ qr/^(>F|=46)rom line/m,
+   'From line escaped appropriately');
+print STDERR $mech->content();
 
 $mech->get_ok('http://localhost:'.$port.'/?bug=1;mboxmaint=yes',
               'Page received ok');