X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Flei-import-imap.t;h=3a1fff4c32162aecacddf427312e5d0baae96f63;hb=cb0e9d42b799c7489c3b8328cfcae1e1500bc7a0;hp=376a8b48673b9c84ed3bf10342a4c8af1cbca3f7;hpb=c7ec7eb31e5c770636275b850bcdc8b9ae0f59dd;p=public-inbox.git diff --git a/t/lei-import-imap.t b/t/lei-import-imap.t index 376a8b48..3a1fff4c 100644 --- a/t/lei-import-imap.t +++ b/t/lei-import-imap.t @@ -22,8 +22,12 @@ test_lei({ tmpdir => $tmpdir }, sub { is_deeply(json_utf8->decode($lei_out), {}, 'no inspect stats, yet'); lei_ok('import', $url); - lei_ok 'ls-sync'; - like($lei_out, qr!\A\Q$url\E;UIDVALIDITY=\d+\n\z!, 'ls-sync'); + lei_ok 'ls-mail-sync'; + like($lei_out, qr!\A\Q$url\E;UIDVALIDITY=\d+\n\z!, 'ls-mail-sync'); + chomp(my $u = $lei_out); + lei_ok('import', $u, \'UIDVALIDITY match in URL'); + $u =~ s/;UIDVALIDITY=(\d+)\s*/;UIDVALIDITY=9$1/s; + ok(!lei('import', $u), 'UIDVALIDITY mismatch in URL rejected'); lei_ok('inspect', $url); my $inspect = json_utf8->decode($lei_out); @@ -45,12 +49,18 @@ test_lei({ tmpdir => $tmpdir }, sub { is_deeply(\%r, { 'HASH' => scalar(@$out) }, 'all hashes'); lei_ok([qw(tag +kw:seen), $url], undef, undef); - my $f = "$ENV{HOME}/.local/share/lei/store/net_last.sqlite3"; - ok(-s $f, 'net tracked for redundant imports'); + my $f = "$ENV{HOME}/.local/share/lei/store/mail_sync.sqlite3"; + ok(-s $f, 'mail_sync tracked for redundant imports'); lei_ok('inspect', "blob:$out->[5]->{blob}"); my $x = json_utf8->decode($lei_out); is(ref($x->{'lei/store'}), 'ARRAY', 'lei/store in inspect'); is(ref($x->{sync}), 'HASH', 'sync in inspect'); is(ref($x->{sync}->{$k[0]}), 'ARRAY', 'UID arrays in inspect'); + + my $psgi_attach = 'cfa3622cbeffc9bd6b0fc66c4d60d420ba74f60d'; + lei_ok('blob', $psgi_attach); + 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'); }); done_testing;