X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fv2mda.t;h=36f43ff096c09c58e8df91e1e3053f2ac8b924e0;hb=0283273a14e1871955f6a9132f4f3f7884ec8a3f;hp=11a517e4bd677fd13bc79032a32adea1954d2884;hpb=ad6f26f3b9f0e428020d05667987556f8fcbec2f;p=public-inbox.git diff --git a/t/v2mda.t b/t/v2mda.t index 11a517e4..36f43ff0 100644 --- a/t/v2mda.t +++ b/t/v2mda.t @@ -1,19 +1,16 @@ -# Copyright (C) 2018-2019 all contributors +# Copyright (C) 2018-2020 all contributors # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use PublicInbox::MIME; use Fcntl qw(SEEK_SET); use Cwd; -require './t/common.perl'; +use PublicInbox::TestCommon; +use PublicInbox::Eml; require_git(2.6); my $V = 2; -foreach my $mod (qw(DBD::SQLite Search::Xapian)) { - eval "require $mod"; - plan skip_all => "$mod missing for v2mda.t" if $@; -} +require_mods(qw(DBD::SQLite Search::Xapian)); use_ok 'PublicInbox::V2Writable'; my ($tmpdir, $for_destroy) = tmpdir(); my $ibx = { @@ -21,18 +18,16 @@ my $ibx = { name => 'test-v2writable', address => [ 'test@example.com' ], }; -my $mime = PublicInbox::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - 'Message-ID' => '', - 'List-ID' => '', - ], - body => "hello world\n", -); +my $mime = PublicInbox::Eml->new(<<'EOF'); +From: a@example.com +To: test@example.com +Subject: this is a subject +Date: Fri, 02 Oct 1993 00:00:00 +0000 +Message-ID: +List-ID: +hello world +EOF my $main_bin = getcwd()."/t/main-bin"; my $fail_bin = getcwd()."/t/fail-bin"; local $ENV{PI_DIR} = "$tmpdir/foo"; @@ -75,7 +70,7 @@ is($saved->{mime}->as_string, $mime->as_string, 'injected message'); my $config = "$ENV{PI_DIR}/config"; ok(-f $config, 'config exists'); my $k = 'publicinboxmda.spamcheck'; - is(system('git', 'config', "--file=$config", $k, 'none'), 0, + is(xsys('git', 'config', "--file=$config", $k, 'none'), 0, 'disabled spamcheck for mda'); ok(run_script(['-mda'], undef, $rdr), 'mda did not die');