]> Sergey Matveev's repositories - public-inbox.git/blob - t/filter_mirror.t
treewide: run update-copyrights from gnulib for 2019
[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 Email::MIME;
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 $html_body = "<html><body>hi</body></html>";
13         my $parts = [
14                 Email::MIME->create(
15                         attributes => {
16                                 content_type => 'text/html; charset=UTF-8',
17                                 encoding => 'base64',
18                         },
19                         body => $html_body,
20                 ),
21                 Email::MIME->create(
22                         attributes => {
23                                 content_type => 'text/plain',
24                                 encoding => 'quoted-printable',
25                         },
26                         body => 'hi = "bye"',
27                 )
28         ];
29         my $email = Email::MIME->create(
30                 header_str => [
31                   From => 'a@example.com',
32                   Subject => 'blah',
33                   'Content-Type' => 'multipart/alternative'
34                 ],
35                 parts => $parts,
36         );
37         is($f->ACCEPT, $f->delivery($email), 'accept any trash that comes');
38 }
39
40 done_testing();