]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/plack.t
No ext_urls
[public-inbox.git] / t / plack.t
index 20f5d8d5e96b25487859b149ae5bfd4d5ad41f8e..7f80f488aef9131582043eec14de8898ff5fe179 100644 (file)
--- a/t/plack.t
+++ b/t/plack.t
@@ -1,5 +1,5 @@
 #!perl -w
-# Copyright (C) 2014-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use v5.10.1;
@@ -13,7 +13,7 @@ my ($tmpdir, $for_destroy) = tmpdir();
 my $pfx = 'http://example.com/test';
 my $eml = eml_load('t/iso-2202-jp.eml');
 # ensure successful message deliveries
-my $ibx = create_inbox('test-1', sub {
+my $ibx = create_inbox('u8-2', sub {
        my ($im, $ibx) = @_;
        my $addr = $ibx->{-primary_address};
        $im->add($eml) or xbail '->add';
@@ -39,6 +39,8 @@ EOF
        # multipart with attached patch + filename
        $im->add(eml_load('t/plack-attached-patch.eml')) or BAIL_OUT '->add';
 
+       $im->add(eml_load('t/data/attached-mbox-with-utf8.eml')) or xbail 'add';
+
        # multipart collapsed to single quoted-printable text/plain
        $im->add(eml_load('t/plack-qp.eml')) or BAIL_OUT '->add';
        my $crlf = <<EOF;
@@ -154,9 +156,12 @@ my $c1 = sub {
        $res = $cb->(GET($pfx . $path));
        is(200, $res->code, "success for $path");
        my $html = $res->content;
+       like($html, qr!\bhref="\Q../_/text/help/"!, 'help available');
        like($html, qr!<title>hihi - Me</title>!, 'HTML returned');
-       like($html, qr!<a\nhref="raw"!s, 'raw link present');
+       like($html, qr!<a\nhref=raw!s, 'raw link present');
        like($html, qr!&gt; quoted text!s, 'quoted text inline');
+       unlike($html, qr!thread overview!,
+               'thread overview not shown w/o ->over');
 
        $path .= 'f/';
        $res = $cb->(GET($pfx . $path));
@@ -178,6 +183,9 @@ my $c1 = sub {
        $res = $cb->(GET($pfx . '/qp@example.com/'));
        like($res->content, qr/\bhi = bye\b/, "HTML output decoded QP");
 
+       $res = $cb->(GET($pfx . '/attached-mbox-with-utf8@example/'));
+       like($res->content, qr/: Bj&#248;rn /, 'UTF-8 in mbox #1');
+       like($res->content, qr/: j &#379;en/, 'UTF-8 in mbox #2');
 
        $res = $cb->(GET($pfx . '/blah@example.com/raw'));
        is(200, $res->code, 'success response received for /*/raw');
@@ -243,7 +251,6 @@ my $c1 = sub {
                        'redirect from x40 MIDs works');
        }
 
-
        # dumb HTTP clone/fetch support
        $path = '/test/info/refs';
        my $req = HTTP::Request->new('GET' => $path);