about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-21 07:41:54 +0000
committerEric Wong <e@80x24.org>2021-09-21 19:18:35 +0000
commit1ed1a566c7d300ab8afb604b2e7c939299318005 (patch)
tree11d98ef0c48983c0dfcd5def0c97f9aee4f28b48 /t
parent3b23743ec90a4cb67dbc0b8bd94cc342c78e7a67 (diff)
downloadpublic-inbox-1ed1a566c7d300ab8afb604b2e7c939299318005.tar.gz
NNTP URLs are probably more prevalent in public message archives
than IMAP URLs.
Diffstat (limited to 't')
-rw-r--r--t/lei-import-nntp.t23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/lei-import-nntp.t b/t/lei-import-nntp.t
index 0b080781..eb1ae312 100644
--- a/t/lei-import-nntp.t
+++ b/t/lei-import-nntp.t
@@ -25,6 +25,11 @@ test_lei({ tmpdir => $tmpdir }, sub {
         is(ref(json_utf8->decode($lei_out)), 'ARRAY', 'ls-mail-source JSON');
 
         lei_ok('import', $url);
+        lei_ok "lcat", "nntp://$host_port/testmessage\@example.com";
+        my $local = $lei_out;
+        lei_ok "lcat", "nntp://example.com/testmessage\@example.com";
+        my $remote = $lei_out;
+        is($local, $remote, 'Message-ID used even from unknown host');
         lei_ok(qw(q z:1..));
         $out = json_utf8->decode($lei_out);
         ok(scalar(@$out) > 1, 'got imported messages');
@@ -57,6 +62,11 @@ test_lei({ tmpdir => $tmpdir }, sub {
         lei_ok('inspect', "$url/$high");
         my $x = json_utf8->decode($lei_out);
         like($x->{$url}->{$high}, qr/\A[a-f0-9]{40,}\z/, 'inspect shows blob');
+        lei_ok qw(lcat -f json), "$url/$high";
+        my $lcat = json_utf8->decode($lei_out);
+        is($lcat->[1], undef, 'only one result for lcat');
+        is($lcat->[0]->{blob}, $x->{$url}->{$high},
+                'lcat showed correct blob');
 
         lei_ok 'ls-mail-sync';
         is($lei_out, "$url\n", 'article number not stored as folder');
@@ -78,6 +88,19 @@ test_lei({ tmpdir => $tmpdir }, sub {
         is(scalar(grep(/\A[a-f0-9]{40,}\z/, values %{$x->{$url}})),
                 $end - $low + 1, 'all values are git blobs');
 
+        lei_ok qw(lcat -f json), "$url/$low";
+        $lcat = json_utf8->decode($lei_out);
+        is($lcat->[1], undef, 'only one result for lcat');
+        is($lcat->[0]->{blob}, $x->{$url}->{$low},
+                'lcat showed correct blob');
+        lei_ok qw(lcat -f json), "$url/$low-$end";
+        $lcat = json_utf8->decode($lei_out);
+        pop @$lcat;
+        for ($low..$end) {
+                my $tip = shift @$lcat;
+                is($x->{$url}->{$_}, $tip->{blob}, "blob matches art #$_");
+        }
+
         lei_ok 'ls-mail-sync';
         is($lei_out, "$url\n", 'article range not stored as folder');
         lei_ok qw(q z:0..); my $start = json_utf8->decode($lei_out);