]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/v2mda.t
disambiguate OverIdx and Over by field name
[public-inbox.git] / t / v2mda.t
index 94b63310b5a30bab420eb0cb31ef7c6a91ecde89..7666eb2dacd3a22f2accf7252b1367376af09d1d 100644 (file)
--- a/t/v2mda.t
+++ b/t/v2mda.t
@@ -6,10 +6,11 @@ use Test::More;
 use Fcntl qw(SEEK_SET);
 use Cwd;
 use PublicInbox::TestCommon;
+use PublicInbox::Eml;
 require_git(2.6);
 
 my $V = 2;
-require_mods(qw(DBD::SQLite Search::Xapian Email::MIME));
+require_mods(qw(DBD::SQLite Search::Xapian));
 use_ok 'PublicInbox::V2Writable';
 my ($tmpdir, $for_destroy) = tmpdir();
 my $ibx = {
@@ -17,18 +18,16 @@ my $ibx = {
        name => 'test-v2writable',
        address => [ 'test@example.com' ],
 };
-my $mime = Email::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' => '<foo@bar>',
-               'List-ID' => '<test.example.com>',
-       ],
-       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: <foo@bar>
+List-ID: <test.example.com>
 
+hello world
+EOF
 my $main_bin = getcwd()."/t/main-bin";
 my $fail_bin = getcwd()."/t/fail-bin";
 local $ENV{PI_DIR} = "$tmpdir/foo";
@@ -53,8 +52,8 @@ if ($V == 1) {
 }
 my $msgs = $ibx->search->query('');
 is(scalar(@$msgs), 1, 'only got one message');
-my $saved = $ibx->smsg_mime($msgs->[0]);
-is($saved->{mime}->as_string, $mime->as_string, 'injected message');
+my $eml = $ibx->smsg_eml($msgs->[0]);
+is($eml->as_string, $mime->as_string, 'injected message');
 
 {
        my @new = glob("$faildir/new/*");