user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
blob ae248de3c44c64ad51dd60aa6703981b22f51624 1893 bytes (raw)
name: t/psgi_multipart_not.t 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
# Copyright (C) 2018-2019 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use warnings;
use Test::More;
use File::Temp qw/tempdir/;
use Email::MIME;
use PublicInbox::Config;
use PublicInbox::WWW;
my @mods = qw(DBD::SQLite Search::Xapian HTTP::Request::Common
              Plack::Test URI::Escape Plack::Builder Plack::Test);
foreach my $mod (@mods) {
	eval "require $mod";
	plan skip_all => "$mod missing for psgi_multipart_not.t" if $@;
}
use_ok($_) for @mods;
use_ok 'PublicInbox::V2Writable';
my $repo = tempdir('pi-psgi-multipart-not.XXXXXX', TMPDIR => 1, CLEANUP => 1);
my $ibx = PublicInbox::Inbox->new({
	mainrepo => $repo,
	name => 'multipart-not',
	version => 2,
	-primary_address => 'test@example.com',
});
my $im = PublicInbox::V2Writable->new($ibx, 1);
$im->{parallel} = 0;

my $mime = PublicInbox::MIME->new(<<'EOF');
Message-Id: <200308111450.h7BEoOu20077@mail.osdl.org>
To: linux-kernel@vger.kernel.org
Subject: [OSDL] linux-2.6.0-test3 reaim results
Mime-Version: 1.0
Content-Type: multipart/mixed ;
	boundary="==_Exmh_120757360"
Date: Mon, 11 Aug 2003 07:50:24 -0700
From: exmh user <x@example.com>

Freed^Wmultipart ain't what it used to be
EOF

ok($im->add($mime), 'added broken multipart message');
$im->done;

my $cfgpfx = "publicinbox.v2test";
my $cfg = {
	"$cfgpfx.address" => $ibx->{-primary_address},
	"$cfgpfx.mainrepo" => $repo,
};
my $config = PublicInbox::Config->new($cfg);
my $www = PublicInbox::WWW->new($config);

my ($res, $raw);
test_psgi(sub { $www->call(@_) }, sub {
	my ($cb) = @_;
	for my $u ('/v2test/?q=%22ain\'t what it used to be%22&x=t',
	           '/v2test/new.atom', '/v2test/new.html') {
		$res = $cb->(GET($u));
		$raw = $res->content;
		ok(index($raw, 'Freed^Wmultipart') >= 0, $u);
		ok(index($raw, 'Warning: decoded text') >= 0, $u.' warns');
	}
});

done_testing();
1;

debug log:

solving ae248de3 ...
found ae248de3 in https://80x24.org/public-inbox.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).