about summary refs log tree commit homepage
path: root/t/psgi_v2.t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-04-25 05:52:22 +0000
committerEric Wong <e@yhbt.net>2020-04-26 07:03:14 +0000
commite39585ee2bdcbeaab7b6bd33b3568021042d0879 (patch)
treeb130b0ce73d8ce9624424c4de6999481ab96439d /t/psgi_v2.t
parent5d8dbb4aca5afcc6b98a4d951f03003fb7eaf356 (diff)
downloadpublic-inbox-e39585ee2bdcbeaab7b6bd33b3568021042d0879.tar.gz
tests: remove Email::MIME->create use entirely
Replace them with .eml files generated with the help of
Email::MIME, but without some extraneous and unnecessary
headers, and strip mime_load down to just loading files.

This will give us more freedom to experiment with other mail
libraries which may be more correct, better maintained, use
less memory and/or be faster than Email::MIME.
Diffstat (limited to 't/psgi_v2.t')
-rw-r--r--t/psgi_v2.t23
1 files changed, 2 insertions, 21 deletions
diff --git a/t/psgi_v2.t b/t/psgi_v2.t
index 5d212ca6..9c19b041 100644
--- a/t/psgi_v2.t
+++ b/t/psgi_v2.t
@@ -9,7 +9,7 @@ use PublicInbox::MIME;
 use PublicInbox::Config;
 use PublicInbox::MID qw(mids);
 require_mods(qw(DBD::SQLite Search::Xapian HTTP::Request::Common Plack::Test
-                URI::Escape Plack::Builder Email::MIME));
+                URI::Escape Plack::Builder));
 use_ok($_) for (qw(HTTP::Request::Common Plack::Test));
 use_ok 'PublicInbox::WWW';
 use_ok 'PublicInbox::V2Writable';
@@ -225,26 +225,7 @@ test_psgi(sub { $www->call(@_) }, sub {
 
         # ensure conflicted attachments can be resolved
         foreach my $body (qw(old new)) {
-                $mime = mime_load "t/psgi_v2-$body.eml", sub {
-                my $parts = [
-                        Email::MIME->create(
-                                attributes => { content_type => 'text/plain' },
-                                body => 'blah',
-                        ),
-                        Email::MIME->create(
-                                attributes => {
-                                        filename => 'attach.txt',
-                                        content_type => 'text/plain',
-                                },
-                                body => $body
-                        )
-                ];
-                Email::MIME->create(
-                        parts => $parts,
-                        header_str => [ From => 'root@z',
-                                'Message-ID' => '<a@dup>',
-                                Subject => 'hi']
-                )}; # mime_load sub
+                $mime = mime_load "t/psgi_v2-$body.eml";
                 ok($im->add($mime), "added attachment $body");
         }
         $im->done;