Skip to content

Commit

Permalink
Merge 998dc76 into 6532dbf
Browse files Browse the repository at this point in the history
  • Loading branch information
paultcochrane committed Oct 22, 2017
2 parents 6532dbf + 998dc76 commit 4d80e20
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.PL
Expand Up @@ -74,6 +74,7 @@ my %WriteMakefile = (
'Test::More' => '1',
'Test::Output' => '0',
'Test::Without::Module' => '0',
'Capture::Tiny' => '0',
},

'META_MERGE' => {
Expand Down
55 changes: 55 additions & 0 deletions t/passwords.t
@@ -0,0 +1,55 @@
#!/usr/bin/env perl

use strict;
use warnings;

use Test::More tests => 7;
use Capture::Tiny qw(capture_stderr);

use Module::Release;

BEGIN {
use File::Spec;
my $file = File::Spec->catfile(qw(. t lib setup_common.pl));
require $file;
}

my $release = Module::Release->new;

$release->turn_debug_on;

{
my $output = capture_stderr { $release->check_for_passwords };
is(
$output,
"CPAN pass is \n",
"Debug output shows empty password when password unset"
);
}

{
$ENV{'CPAN_PASS'} = 's3cr3t';
my $output = capture_stderr { $release->check_for_passwords };
is( $release->config->cpan_pass,
undef, "Password is unset when cpan username is not set" );
is(
$output,
"CPAN pass is \n",
'Debug output shows unset password when cpan username is not set'
);
}

{
$ENV{'CPAN_PASS'} = 's3cr3t';
$release->config->set( 'cpan_user', 'BDFOY' );
my $output = capture_stderr { $release->check_for_passwords };
is( $release->config->cpan_pass,
's3cr3t', "Password is set when CPAN_PASS is set" );
is(
$output,
"CPAN pass is s3cr3t\n",
'Debug output shows password when set'
);
}

# vim: expandtab shiftwidth=4

0 comments on commit 4d80e20

Please sign in to comment.