]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/cgi.t
www: redirect /$MESSAGE_ID/f/ endpoints
[public-inbox.git] / t / cgi.t
diff --git a/t/cgi.t b/t/cgi.t
index ebf141604beedaa0d2ecd75b2fac827b91061ff8..d7e3ac5b0173a886773abf8674dc39d0f457f8ec 100644 (file)
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -11,7 +11,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 $tmpdir = tempdir('pi-cgi-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $home = "$tmpdir/pi-home";
 my $pi_home = "$home/.public-inbox";
 my $pi_config = "$pi_home/config";
@@ -188,9 +188,11 @@ EOF
        like($res->{head}, qr/Status: 300 Multiple Choices/, "mid html miss");
 
        $res = cgi_run("/test/blahblah\@example.com/f/");
-       like($res->{body}, qr/\A<html>/, "mid html");
-       like($res->{head}, qr/Status: 200 OK/, "200 response");
-       $res = cgi_run("/test/blahblah\@example.con/f/");
+       like($res->{head}, qr/Status: 301 Moved/, "301 response");
+       like($res->{head},
+               qr!^Location: http://[^/]+/test/blahblah%40example\.com/\r\n!ms,
+               '301 redirect location');
+       $res = cgi_run("/test/blahblah\@example.con/");
        like($res->{head}, qr/Status: 300 Multiple Choices/, "mid html miss");
 
        $res = cgi_run("/test/");