]> Sergey Matveev's repositories - public-inbox.git/blob - t/psgi_multipart_not.t
No ext_urls
[public-inbox.git] / t / psgi_multipart_not.t
1 #!perl -w
2 # Copyright (C) 2018-2021 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 use strict;
5 use v5.10.1;
6 use PublicInbox::TestCommon;
7 use PublicInbox::Eml;
8 use PublicInbox::Config;
9 require_git 2.6;
10 my @mods = qw(DBD::SQLite Search::Xapian HTTP::Request::Common
11               Plack::Test URI::Escape Plack::Builder Plack::Test);
12 require_mods(@mods);
13 use_ok($_) for (qw(HTTP::Request::Common Plack::Test));
14 use_ok 'PublicInbox::WWW';
15 my $ibx = create_inbox 'v2', version => 2, sub {
16         my ($im) = @_;
17         $im->add(PublicInbox::Eml->new(<<'EOF')) or BAIL_OUT;
18 Message-Id: <200308111450.h7BEoOu20077@mail.osdl.org>
19 To: linux-kernel@vger.kernel.org
20 Subject: [OSDL] linux-2.6.0-test3 reaim results
21 Mime-Version: 1.0
22 Content-Type: multipart/mixed ;
23         boundary="==_Exmh_120757360"
24 Date: Mon, 11 Aug 2003 07:50:24 -0700
25 From: exmh user <x@example.com>
26
27 Freed^Wmultipart ain't what it used to be
28 EOF
29
30 };
31 my $cfgpfx = "publicinbox.v2test";
32 my $cfg = <<EOF;
33 $cfgpfx.address=$ibx->{-primary_address}
34 $cfgpfx.inboxdir=$ibx->{inboxdir}
35 EOF
36 my $www = PublicInbox::WWW->new(PublicInbox::Config->new(\$cfg));
37 my ($res, $raw);
38 test_psgi(sub { $www->call(@_) }, sub {
39         my ($cb) = @_;
40         for my $u ('/v2test/?q=%22ain\'t what it used to be%22&x=t',
41                    '/v2test/new.atom', '/v2test/new.html') {
42                 $res = $cb->(GET($u));
43                 $raw = $res->content;
44                 ok(index($raw, 'Freed^Wmultipart') >= 0, $u);
45                 ok(index($raw, 'Warning: decoded text') >= 0, $u.' warns');
46         }
47 });
48 done_testing;