about summary refs log tree commit homepage
path: root/t/html_index.t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-04-25 09:50:01 +0000
committerEric Wong <e@80x24.org>2016-04-25 09:50:32 +0000
commitfe3d2447badd595df784541556311137b920b0a2 (patch)
tree6e37ab61406654680fd6757593cf810370055ecb /t/html_index.t
parent51c59323fffbfbb6ebc60f58da905e88ac323da5 (diff)
downloadpublic-inbox-fe3d2447badd595df784541556311137b920b0a2.tar.gz
By converting to using ourt git-fast-import-based Import
module.  This should allow us to be more easily installed.
Diffstat (limited to 't/html_index.t')
-rw-r--r--t/html_index.t23
1 files changed, 13 insertions, 10 deletions
diff --git a/t/html_index.t b/t/html_index.t
index adbadaf4..6896eb41 100644
--- a/t/html_index.t
+++ b/t/html_index.t
@@ -3,11 +3,15 @@
 use strict;
 use warnings;
 use Test::More;
-use Email::Simple;
+use Email::MIME;
 use PublicInbox::Feed;
+use PublicInbox::Git;
+use PublicInbox::Import;
 use File::Temp qw/tempdir/;
 my $tmpdir = tempdir('pi-http-XXXXXX', TMPDIR => 1, CLEANUP => 1);
 my $git_dir = "$tmpdir/gittest";
+my $git = PublicInbox::Git->new($git_dir);
+my $im = PublicInbox::Import->new($git, 'tester', 'test@example');
 
 # setup
 {
@@ -15,19 +19,18 @@ my $git_dir = "$tmpdir/gittest";
         my $prev = "";
 
         foreach my $i (1..6) {
-                local $ENV{GIT_DIR} = $git_dir;
-                my $pid = open(my $pipe, "|-");
-                defined $pid or die "fork/pipe failed: $!\n";
-                if ($pid == 0) {
-                        exec("ssoma-mda", $git_dir);
-                }
+                # my $pid = open(my $pipe, "|-");
+                # defined $pid or die "fork/pipe failed: $!\n";
+                # if ($pid == 0) {
+                        # exec("ssoma-mda", $git_dir);
+                # }
                 my $mid = "<$i\@example.com>";
                 my $mid_line = "Message-ID: $mid";
                 if ($prev) {
                         $mid_line .= "In-Reply-To: $prev";
                 }
                 $prev = $mid;
-                my $simple = Email::Simple->new(<<EOF);
+                my $mime = Email::MIME->new(<<EOF);
 From: ME <me\@example.com>
 To: U <u\@example.com>
 $mid_line
@@ -43,9 +46,9 @@ msg $i
 
 keep me
 EOF
-                print $pipe $simple->as_string or die "print failed: $!\n";
-                close $pipe or die "close pipe failed: $!\n";
+                like($im->add($mime), qr/\A:\d+\z/, 'inserted message');
         }
+        $im->done;
 }
 
 # check HTML index