From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 3E36D1FA12 for ; Sat, 3 Apr 2021 02:24:28 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 6/6] xt/lei-auth-fail: test more failure cases Date: Sat, 3 Apr 2021 02:24:27 +0000 Message-Id: <20210403022427.2430-7-e@80x24.org> In-Reply-To: <20210403022427.2430-1-e@80x24.org> References: <20210403022427.2430-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Because failures are often overlooked, unfortunately. --- xt/lei-auth-fail.t | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xt/lei-auth-fail.t b/xt/lei-auth-fail.t index e352aab3..06cb8533 100644 --- a/xt/lei-auth-fail.t +++ b/xt/lei-auth-fail.t @@ -2,17 +2,20 @@ # 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 { - for my $pfx ([qw(convert -o mboxrd:/dev/stdout)], ['import'], - [qw(tag +L:INBOX)]) { + 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'); + like($lei_err, qr!\bE:.*?imaps?://.*?!sm, 'error shown'); unlike($lei_err, qr!Hunter2!s, 'password not shown'); is($lei_out, '', 'nothing output'); }