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";
like($res->{head}, qr/Status: 200 OK/, "index returns 200");
my $idx = cgi_run("/test/index.html");
- $idx->{body} =~ s!/index.html(\?r=)!/$1!; # dirty...
+ $idx->{body} =~ s!/index.html(\?r=)!/$1!g; # dirty...
+ $idx->{body} = [ split(/\n/, $idx->{body}) ];
+ $res->{body} = [ split(/\n/, $res->{body}) ];
is_deeply($res, $idx,
'/$LISTNAME/ and /$LISTNAME/index.html are nearly identical');
# more checks in t/feed.t
"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;