X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=xt%2Flei-auth-fail.t;h=06cb853353bb828eb34a7799cb0a9250b00a61a9;hb=0ae89efce11e1e3b10a067c61c5b4cde30fa2b3b;hp=78f8466d4fec226a258372ceabc9a9bb3bfadd0e;hpb=fc69b9b91323c62e8abeaa8723f4d3fffdac0e27;p=public-inbox.git diff --git a/xt/lei-auth-fail.t b/xt/lei-auth-fail.t index 78f8466d..06cb8533 100644 --- a/xt/lei-auth-fail.t +++ b/xt/lei-auth-fail.t @@ -2,20 +2,22 @@ # Copyright (C) 2021 all contributors # License: AGPL-3.0+ use strict; use v5.10.1; use PublicInbox::TestCommon; -require_mods(qw(Mail::IMAPClient)); +require_mods(qw(Mail::IMAPClient lei)); # TODO: mock IMAP server which fails at authentication so we don't # have to make external connections to test this: my $imap_fail = $ENV{TEST_LEI_IMAP_FAIL_URL} // 'imaps://AzureDiamond:Hunter2@public-inbox.org:994/INBOX'; +my ($ro_home, $cfg_path) = setup_public_inboxes; test_lei(sub { - ok(!lei(qw(convert -o mboxrd:/dev/stdout), $imap_fail), - 'IMAP auth failure on convert'); - like($lei_err, qr!\bE:.*?imaps://.*?!sm, 'error shown'); - unlike($lei_err, qr!Hunter2!s, 'password not shown'); - is($lei_out, '', 'nothing output'); - ok(!lei(qw(import), $imap_fail), 'IMAP auth failure on import'); - like($lei_err, qr!\bE:.*?imaps://.*?!sm, 'error shown'); - unlike($lei_err, qr!Hunter2!s, 'password not shown'); + for my $pfx ([qw(q z:0.. --only), "$ro_home/t1", '-o'], + [qw(convert -o mboxrd:/dev/stdout)], + [qw(convert t/utf8.eml -o), $imap_fail], + ['import'], [qw(tag +L:INBOX)]) { + ok(!lei(@$pfx, $imap_fail), "IMAP auth failure on @$pfx"); + like($lei_err, qr!\bE:.*?imaps?://.*?!sm, 'error shown'); + unlike($lei_err, qr!Hunter2!s, 'password not shown'); + is($lei_out, '', 'nothing output'); + } }); done_testing;