]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/lei-import-imap.t
lei: handle a single IMAP message in most places
[public-inbox.git] / t / lei-import-imap.t
index d3935c828514c4895cc4f511419b10be88e7758b..59d481d58216499fbb8bd73f24ecc58ef9074ec9 100644 (file)
@@ -71,5 +71,24 @@ test_lei({ tmpdir => $tmpdir }, sub {
        like($lei_out, qr!^Content-Type: multipart/mixed;!sm, 'got full blob');
        lei_ok('blob', "$psgi_attach:2");
        is($lei_out, "b64\xde\xad\xbe\xef\n", 'got attachment');
+
+       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;