X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=blobdiff_plain;f=t%2Fpsgi_attach.t;h=0dde9323dc3943a265284be192abf63022caa48b;hp=2376bba7bf2f042e099588da5499429cd679193d;hb=5d8dbb4aca5afcc6b98a4d951f03003fb7eaf356;hpb=58852a50f6a72265cce1e4729aae3875bba5aa96 diff --git a/t/psgi_attach.t b/t/psgi_attach.t index 2376bba7..0dde9323 100644 --- a/t/psgi_attach.t +++ b/t/psgi_attach.t @@ -26,13 +26,11 @@ my $im = PublicInbox::Import->new($git, 'test', $addr); $im->init_bare; { - open my $fh, '<', '/dev/urandom' or die "unable to open urandom: $!\n"; - sysread($fh, my $buf, 8); - is(8, length($buf), 'read some random data'); my $qp = "abcdef=g\n==blah\n"; - my $b64 = 'b64'.$buf."\n"; + my $b64 = "b64\xde\xad\xbe\xef\n"; my $txt = "plain\ntext\npass\nthrough\n"; my $dot = "dotfile\n"; + my $mime = mime_load 't/psgi_attach.eml', sub { my $parts = [ Email::MIME->create( attributes => { @@ -61,14 +59,11 @@ $im->init_bare; }, body => $dot), ]; - my $mime = Email::MIME->create( + Email::MIME->create( parts => $parts, header_str => [ From => 'root@z', 'Message-Id' => '', Subject => 'hi'] - ); - $mime = $mime->as_string; - $mime =~ s/\r\n/\n/g; # normalize to LF only - $mime = PublicInbox::MIME->new($mime); + )}; # mime_load sub $im->add($mime); $im->done;