about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-08-21 01:29:04 +0000
committerEric Wong <e@80x24.org>2015-08-21 10:25:28 +0000
commitf71e9e9b67a6ff23642ccd119390bd6b3cb0d91e (patch)
tree432b1afa027048b608797651719d97ff1beb7480 /t
parent6a8f5c169911d1ee9338bb77a3d5302deb86fdb4 (diff)
downloadpublic-inbox-f71e9e9b67a6ff23642ccd119390bd6b3cb0d91e.tar.gz
Some folks may not want to download and install Perl code like
ssoma, so allow downloading an mbox containing the entire
thread.
Diffstat (limited to 't')
-rw-r--r--t/cgi.t19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/cgi.t b/t/cgi.t
index a16ebd8d..2747a159 100644
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -10,6 +10,7 @@ use IPC::Run qw/run/;
 
 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";
@@ -178,6 +179,24 @@ EOF
                 "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";
+        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);
+                # use Data::Dumper; print STDERR Dumper($res);
+                like($res->{head}, qr/^Status: 200 /, "search returned mbox");
+                like($res->{body}, 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;