diff options
author | Eric Wong <e@80x24.org> | 2021-02-18 23:22:25 +0300 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-02-18 20:02:22 -0400 |
commit | 725fd624277364402a86262486cdb79458db4ed8 (patch) | |
tree | a02f8f35b1419f6f8897bd7ec452d79356d330bd /xt | |
parent | d972b6711b01500181f809ef54a08aa29cb0d4a4 (diff) | |
download | public-inbox-725fd624277364402a86262486cdb79458db4ed8.tar.gz |
We need to ensure authentication failures and error codes get propagated to the parent process(es) properly. v2: update MANIFEST v3: LeiAuth.pm ->_lei_cfg bit moved to a previous commit
Diffstat (limited to 'xt')
-rw-r--r-- | xt/lei-auth-fail.t | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/xt/lei-auth-fail.t b/xt/lei-auth-fail.t new file mode 100644 index 00000000..5308d0f9 --- /dev/null +++ b/xt/lei-auth-fail.t @@ -0,0 +1,20 @@ +#!perl -w +# Copyright (C) 2021 all contributors <meta@public-inbox.org> +# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> +use strict; use v5.10.1; use PublicInbox::TestCommon; + +# 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'; +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'); +}); +done_testing; |