]> Sergey Matveev's repositories - public-inbox.git/blob - t/filter_mirror.t
694209d9e07076f5e404d1ade759ccd58886f9f4
[public-inbox.git] / t / filter_mirror.t
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>
3 use strict;
4 use warnings;
5 use Test::More;
6 use PublicInbox::TestCommon;
7 use_ok 'PublicInbox::Filter::Mirror';
8
9 my $f = PublicInbox::Filter::Mirror->new;
10 ok($f, 'created PublicInbox::Filter::Mirror object');
11 {
12         my $email = mime_load 't/filter_mirror.eml', sub {
13         my $html_body = "<html><body>hi</body></html>";
14         my $parts = [
15                 Email::MIME->create(
16                         attributes => {
17                                 content_type => 'text/html; charset=UTF-8',
18                                 encoding => 'base64',
19                         },
20                         body => $html_body,
21                 ),
22                 Email::MIME->create(
23                         attributes => {
24                                 content_type => 'text/plain',
25                                 encoding => 'quoted-printable',
26                         },
27                         body => 'hi = "bye"',
28                 )
29         ];
30         Email::MIME->create(
31                 header_str => [
32                   From => 'a@example.com',
33                   Subject => 'blah',
34                   'Content-Type' => 'multipart/alternative'
35                 ],
36                 parts => $parts,
37         )}; # mime_laod sub
38         is($f->ACCEPT, $f->delivery($email), 'accept any trash that comes');
39 }
40
41  done_testing();