1 # Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
7 use PublicInbox::TestCommon;
8 my ($tmpdir, $for_destroy) = tmpdir();
9 my $maindir = "$tmpdir/main.git";
10 my $addr = 'test-public@example.com';
11 my $cfgpfx = "publicinbox.test";
12 my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape Plack::Builder);
14 use_ok $_ foreach @mods;
15 use PublicInbox::Import;
17 use PublicInbox::Config;
18 use_ok 'PublicInbox::WWW';
19 use_ok 'PublicInbox::WwwText';
20 my $config = PublicInbox::Config->new(\<<EOF);
22 $cfgpfx.inboxdir=$maindir
24 is(0, system(qw(git init -q --bare), $maindir), "git init (main)");
25 my $www = PublicInbox::WWW->new($config);
27 test_psgi(sub { $www->call(@_) }, sub {
30 $res = $cb->(GET('/test/_/text/help/'));
31 like($res->content, qr!<title>public-inbox help.*</title>!,
33 $res = $cb->(GET('/test/_/text/config/raw'));
34 my $f = "$tmpdir/cfg";
35 open my $fh, '>', $f or die;
36 print $fh $res->content or die;
38 my $cfg = PublicInbox::Config->new($f);
39 is($cfg->{"$cfgpfx.address"}, $addr, 'got expected address in config');