- my $res = cgi_run("/test/");
- like($res->{head}, qr/Status: 200 OK/, "index returns 200");
- # more checks in t/feed.t
-}
-
+ my $path = "/test/blahblah\@example.com/t.mbox.gz";
+ my $res = cgi_run($path);
+ like($res->{head}, qr/^Status: 501 /, "search not-yet-enabled");
+ my $cmd = ['-index', $ibx->{inboxdir}, '--max-size=2k'];
+ my $opt = { 2 => \(my $err) };
+ my $indexed = run_script($cmd, undef, $opt);
+ 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");
+ };
+ $res = cgi_run('/test/toobig@example.com/');
+ like($res->{head}, qr/^Status: 300 /,
+ 'did not index or return >max-size message');
+ like($err, qr/skipping [a-f0-9]{40,}/,
+ 'warned about skipping large OID');
+ } else {
+ like($res->{head}, qr/^Status: 501 /, "search not available");
+ SKIP: { skip 'DBD::SQLite not available', 4 };
+ }