about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-04-15 20:50:56 +0000
committerEric Wong <e@80x24.org>2016-04-15 20:50:56 +0000
commitfdf9b900b8c35cb4259dbdf56400d44db61e7a9e (patch)
tree418244247703b6087aa12597feffad85394e8612 /t
parent474a987a2ba9183ceb9e143aeccdc49c7cb5f382 (diff)
downloadpublic-inbox-fdf9b900b8c35cb4259dbdf56400d44db61e7a9e.tar.gz
Quote-folding was a major design mistake pre-1.0.  Since this
project is still in its infancy and unlikely to be in wide
use at the moment, redirect the /f/ endpoints back to the
plain message.
Diffstat (limited to 't')
-rw-r--r--t/cgi.t8
-rw-r--r--t/plack.t32
-rw-r--r--t/view.t2
3 files changed, 25 insertions, 17 deletions
diff --git a/t/cgi.t b/t/cgi.t
index f1a2730c..d7e3ac5b 100644
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -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/");
diff --git a/t/plack.t b/t/plack.t
index 568f09f0..1ae58731 100644
--- a/t/plack.t
+++ b/t/plack.t
@@ -98,9 +98,9 @@ EOF
                         my ($cb) = @_;
                         my $u = $pfx . "/blah%40example.com/$t";
                         my $res = $cb->(GET($u));
-                        is(301, $res->code, "redirect for missing /");
+                        is(301, $res->code, "redirect for legacy /f");
                         my $location = $res->header('Location');
-                        like($location, qr!/\Q$t\E/\z!,
+                        like($location, qr!/blah%40example\.com/\z!,
                                 'redirected with missing /');
                 });
         }
@@ -125,16 +125,22 @@ EOF
                         'atom feed generated correct URL');
         });
 
-        foreach my $t (('', 'f/')) {
-                test_psgi($app, sub {
-                        my ($cb) = @_;
-                        my $path = "/blah%40example.com/$t";
-                        my $res = $cb->(GET($pfx . $path));
-                        is(200, $res->code, "success for $path");
-                        like($res->content, qr!<title>hihi - Me</title>!,
-                                "HTML returned");
-                });
-        }
+        test_psgi($app, sub {
+                my ($cb) = @_;
+                my $path = '/blah%40example.com/';
+                my $res = $cb->(GET($pfx . $path));
+                is(200, $res->code, "success for $path");
+                like($res->content, qr!<title>hihi - Me</title>!,
+                        "HTML returned");
+
+                $path .= 'f/';
+                $res = $cb->(GET($pfx . $path));
+                is(301, $res->code, "redirect for $path");
+                my $location = $res->header('Location');
+                like($location, qr!/blah%40example\.com/\z!,
+                        '/$MESSAGE_ID/f/ redirected to /$MESSAGE_ID/');
+        });
+
         test_psgi($app, sub {
                 my ($cb) = @_;
                 my $res = $cb->(GET($pfx . '/blah%40example.com/raw'));
@@ -156,7 +162,7 @@ EOF
 
         my %umap = (
                 'm' => '',
-                'f' => 'f/',
+                'f' => '',
                 't' => 't/',
         );
         while (my ($t, $e) = each %umap) {
diff --git a/t/view.t b/t/view.t
index 1f464762..1a47416f 100644
--- a/t/view.t
+++ b/t/view.t
@@ -44,7 +44,7 @@ EOF
         my $html = PublicInbox::View::msg_html(undef, $mime);
 
         # ghetto tests
-        like($html, qr!<a\nhref="\.\./raw"!s, "raw link present");
+        like($html, qr!<a\nhref="raw"!s, "raw link present");
         like($html, qr/hello world\b/, "body present");
         like($html, qr/&gt; keep this inline/, "short quoted text is inline");
 }