]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/psgi_scan_all.t
init: use Import::run_die instead of system()
[public-inbox.git] / t / psgi_scan_all.t
index e9c439ec6b0e8e7bab0ec6afa41dbf4fe97ed921..09ed96e0477e5636beb89945f76e3160cf3d4e5f 100644 (file)
@@ -4,28 +4,27 @@ use strict;
 use warnings;
 use Test::More;
 use Email::MIME;
-use File::Temp qw/tempdir/;
 use PublicInbox::Config;
-my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape Search::Xapian
-       DBD::SQLite);
-foreach my $mod (@mods) {
-       eval "require $mod";
-       plan skip_all => "$mod missing for psgi_scan_all.t" if $@;
-}
+use PublicInbox::TestCommon;
+my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape DBD::SQLite);
+require_mods(@mods);
 use_ok 'PublicInbox::V2Writable';
 foreach my $mod (@mods) { use_ok $mod; }
-my $tmp = tempdir('pi-scan_all-XXXXXX', TMPDIR => 1, CLEANUP => 1);
-my $cfg = {};
+my ($tmp, $for_destroy) = tmpdir();
+my $cfg = '';
 
 foreach my $i (1..2) {
        my $cfgpfx = "publicinbox.test-$i";
-       my $addr = $cfg->{"$cfgpfx.address"} = "test-$i\@example.com";
-       my $mainrepo = $cfg->{"$cfgpfx.mainrepo"} = "$tmp/$i";
-       $cfg->{"$cfgpfx.url"} = "http://example.com/$i";
+       my $addr = "test-$i\@example.com";
+       my $inboxdir = "$tmp/$i";
+       $cfg .= "$cfgpfx.address=$addr\n";
+       $cfg .= "$cfgpfx.inboxdir=$inboxdir\n";
+       $cfg .= "$cfgpfx.url=http://example.com/$i\n";
        my $opt = {
-               mainrepo => $mainrepo,
+               inboxdir => $inboxdir,
                name => "test-$i",
                version => 2,
+               indexlevel => 'basic',
                -primary_address => $addr,
        };
        my $ibx = PublicInbox::Inbox->new($opt);
@@ -45,7 +44,7 @@ EOF
        ok($im->add($mime), "added message to $i");
        $im->done;
 }
-my $config = PublicInbox::Config->new($cfg);
+my $config = PublicInbox::Config->new(\$cfg);
 use_ok 'PublicInbox::WWW';
 my $www = PublicInbox::WWW->new($config);