diff options
author | Eric Wong <e@80x24.org> | 2021-05-28 00:07:56 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-05-28 09:19:58 +0000 |
commit | 9b3cd5e254fafa08c774a24f85c2b2eac12a9de5 (patch) | |
tree | f7d9ba7947272754348b2d587075d43c59f06bea /t | |
parent | 578520277aaf723b174a2567aff90c10e29abbcb (diff) | |
download | public-inbox-9b3cd5e254fafa08c774a24f85c2b2eac12a9de5.tar.gz |
"lei import" can now import a single IMAP message via <imaps://example.com/MAILBOX/;UID=$UID> Likewise, "lei inspect" can show the blob information for UID URLs and "lei lcat" can display the blob without network access if imported. "lei lcat" also gets rid of some unused code and supports "blob:$OIDHEX" syntax as described in the comments (and used by our "text" output format). v2: enforce UID in URL, fail without v3: fix error reporting (s/fail/child_error/)
Diffstat (limited to 't')
-rw-r--r-- | t/lei-import-imap.t | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/t/lei-import-imap.t b/t/lei-import-imap.t index 5283cc23..59d481d5 100644 --- a/t/lei-import-imap.t +++ b/t/lei-import-imap.t @@ -75,5 +75,20 @@ test_lei({ tmpdir => $tmpdir }, sub { lei_ok 'forget-mail-sync', $url; lei_ok 'ls-mail-sync'; unlike($lei_out, qr!\Q$host_port\E!, 'sync info gone after forget'); + my $uid_url = "$url/;UID=".$stats->{'uid.max'}; + lei_ok 'import', $uid_url; + lei_ok 'inspect', $uid_url; + $lei_out =~ /([a-f0-9]{40,})/ or + xbail 'inspect missed blob with UID URL'; + my $blob = $1; + lei_ok 'lcat', $uid_url; + like $lei_out, qr/^Subject: /sm, + 'lcat shows mail text with UID URL'; + like $lei_out, qr/\bblob:$blob\b/, 'lcat showed blob'; + my $orig = $lei_out; + lei_ok 'lcat', "blob:$blob"; + is($lei_out, $orig, 'lcat understands blob:...'); + ok(!lei('lcat', $url), "lcat doesn't work on IMAP URL w/o UID"); }); + done_testing; |