1 # Copyright (C) 2018 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
6 use File::Temp qw/tempdir/;
8 use PublicInbox::Config;
10 my @mods = qw(DBD::SQLite Search::Xapian HTTP::Request::Common
11 Plack::Test URI::Escape Plack::Builder Plack::Test);
12 foreach my $mod (@mods) {
14 plan skip_all => "$mod missing for psgi_multipart_not.t" if $@;
17 use_ok 'PublicInbox::V2Writable';
18 my $repo = tempdir('pi-psgi-multipart-not.XXXXXX', TMPDIR => 1, CLEANUP => 1);
19 my $ibx = PublicInbox::Inbox->new({
21 name => 'multipart-not',
23 -primary_address => 'test@example.com',
25 my $im = PublicInbox::V2Writable->new($ibx, 1);
28 my $mime = PublicInbox::MIME->new(<<'EOF');
29 Message-Id: <200308111450.h7BEoOu20077@mail.osdl.org>
30 To: linux-kernel@vger.kernel.org
31 Subject: [OSDL] linux-2.6.0-test3 reaim results
33 Content-Type: multipart/mixed ;
34 boundary="==_Exmh_120757360"
35 Date: Mon, 11 Aug 2003 07:50:24 -0700
36 From: exmh user <x@example.com>
38 Freed^Wmultipart ain't what it used to be
41 ok($im->add($mime), 'added broken multipart message');
44 my $cfgpfx = "publicinbox.v2test";
46 "$cfgpfx.address" => $ibx->{-primary_address},
47 "$cfgpfx.mainrepo" => $repo,
49 my $config = PublicInbox::Config->new($cfg);
50 my $www = PublicInbox::WWW->new($config);
53 test_psgi(sub { $www->call(@_) }, sub {
55 for my $u ('/v2test/?q=%22ain\'t what it used to be%22&x=t',
56 '/v2test/new.atom', '/v2test/new.html') {
57 $res = $cb->(GET($u));
59 ok(index($raw, 'Freed^Wmultipart') >= 0, $u);
60 ok(index($raw, 'Warning: decoded text') >= 0, $u.' warns');