]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/psgi_v2.t
update copyrights for 2021
[public-inbox.git] / t / psgi_v2.t
index 11aef5b3380c9c860e50161ae6e83fa83f27af6a..7ab60adcc46f00f33cec66b2b64ccbeb4903204a 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2018-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
@@ -40,7 +40,11 @@ my $run_httpd = sub {
                Plack::Test::ExternalServer::test_psgi(client => $client);
                $td->join('TERM');
                open my $fh, '<', $err or BAIL_OUT $!;
-               is(do { local $/; <$fh> }, '', 'no errors');
+               my $e = do { local $/; <$fh> };
+               if ($e =~ s/^Plack::Middleware::ReverseProxy missing,\n//gms) {
+                       $e =~ s/^URL generation for redirects .*\n//gms;
+               }
+               is($e, '', 'no errors');
        }
 };
 
@@ -83,12 +87,11 @@ like($$msg, qr/\AFrom oldbug/s,
        '"From_" line stored to test old bug workaround');
 
 my $cfgpfx = "publicinbox.v2test";
-my $cfg = <<EOF;
+my $cfg = PublicInbox::Config->new(\<<EOF);
 $cfgpfx.address=$ibx->{-primary_address}
 $cfgpfx.inboxdir=$inboxdir
 EOF
-my $config = PublicInbox::Config->new(\$cfg);
-my $www = PublicInbox::WWW->new($config);
+my $www = PublicInbox::WWW->new($cfg);
 my ($res, $raw, @from_);
 my $client0 = sub {
        my ($cb) = @_;
@@ -150,7 +153,7 @@ my $client1 = sub {
        like($raw, qr/^hello ghosts$/m, 'got third message');
        @from_ = ($raw =~ m/^From /mg);
        is(scalar(@from_), 3, 'three From_ lines');
-       $config->each_inbox(sub { $_[0]->search->reopen });
+       $cfg->each_inbox(sub { $_[0]->search->reopen });
 
        SKIP: {
                eval { require IO::Uncompress::Gunzip };
@@ -240,7 +243,7 @@ $run_httpd->($client1, 38);
        $im->done;
        my @h = $mime->header('Message-ID');
        is_deeply($exp, \@h, 'reused existing Message-ID');
-       $config->each_inbox(sub { $_[0]->search->reopen });
+       $cfg->each_inbox(sub { $_[0]->search->reopen });
 }
 
 my $client2 = sub {
@@ -279,7 +282,7 @@ $run_httpd->($client2, 8);
                ok($im->add($mime), "added attachment $body");
        }
        $im->done;
-       $config->each_inbox(sub { $_[0]->search->reopen });
+       $cfg->each_inbox(sub { $_[0]->search->reopen });
 }
 
 my $client3 = sub {