use constant CGI => "blib/script/public-inbox.cgi";
my $mda = "blib/script/public-inbox-mda";
+my $index = "blib/script/public-inbox-index";
my $tmpdir = tempdir(CLEANUP => 1);
my $home = "$tmpdir/pi-home";
my $pi_home = "$home/.public-inbox";
"slashy URL generated correctly");
}
+# retrieve thread as an mbox
+{
+ local $ENV{HOME} = $home;
+ local $ENV{PATH} = $main_path;
+ my $path = "/test/t/blahblah%40example.com.mbox.gz";
+ my $res = cgi_run($path);
+ like($res->{head}, qr/^Status: 501 /, "search not-yet-enabled");
+ my $indexed = system($index, $maindir) == 0;
+ if ($indexed) {
+ $res = cgi_run($path);
+ like($res->{head}, qr/^Status: 200 /, "search returned mbox");
+ eval {
+ require IO::Uncompress::Gunzip;
+ my $in = $res->{body};
+ my $out;
+ IO::Uncompress::Gunzip::gunzip(\$in => \$out);
+ like($out, qr/^From /m, "From lines in mbox");
+ };
+ } else {
+ like($res->{head}, qr/^Status: 501 /, "search not available");
+ }
+}
+
# redirect list-name-only URLs
{
local $ENV{HOME} = $home;