DBIx-Class-Schema-Config
view release on metacpan or search on metacpan
t/02_load_credentials.t view on Meta::CPAN
user => 'BleeBaz',
password => 'Foobar',
TRACE_LEVEL => 10,
},
title => "Overriding the user and password works.",
},
# Mojo-like postgresql connection lines.
{
put => [ 'postgresql://username:password@hostname:5433/minion' ],
get => {
dsn => 'dbi:Pg:dbname=minion;host=hostname;port=5433',
user => 'username',
password => 'password',
},
title => "Mojo-like postgresql:// connect line, with port.",
},
{
put => [ 'postgresql://username:password@hostname/minion' ],
get => {
dsn => 'dbi:Pg:dbname=minion;host=hostname',
user => 'username',
password => 'password',
},
title => "Mojo-like postgresql:// connect line.",
},
{
put => [ 'postgresql://:password@hostname/minion' ],
get => {
dsn => 'dbi:Pg:dbname=minion;host=hostname',
user => '',
password => 'password',
},
title => "Mojo-like postgresql:// connect line, no user.",
},
{
put => [ 'postgresql://username:@hostname/minion' ],
get => {
dsn => 'dbi:Pg:dbname=minion;host=hostname',
user => 'username',
password => '',
},
title => "Mojo-like postgresql:// connect line, no password.",
},
{
put => [ 'postgresql://username@hostname/minion' ],
get => {
dsn => 'dbi:Pg:dbname=minion;host=hostname',
user => 'username',
password => '',
},
title => "Mojo-like postgresql:// connect line, ambiguous user@ is username.",
},
{
put => [ 'postgresql://hostname/minion' ],
get => {
dsn => 'dbi:Pg:dbname=minion;host=hostname',
user => '',
password => '',
},
title => "Mojo-like postgresql:// connect line, no credentials.",
},
];
for my $test ( @$tests ) {
is_deeply(
DBIx::Class::Schema::Config->load_credentials(
DBIx::Class::Schema::Config->_make_connect_attrs(
ref $test->{put} eq 'ARRAY' ? @{$test->{put}} : $test->{put})
), $test->{get}, $test->{title} );
}
done_testing;
( run in 2.500 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )