Dancer2-Plugin-Argon2
view release on metacpan or search on metacpan
t/01_default_settings.t view on Meta::CPAN
subtest 'passphrase object' => sub {
my $passphrase_obj = passphrase($password);
isa_ok( $passphrase_obj, 'Dancer2::Plugin::Argon2::Passphrase' );
eval { passphrase() };
like $@, qr/^Please provide password argument/, 'die with empty password argument';
};
subtest 'passphrase->encoded' => sub {
$passphrase_generated = passphrase($password)->encoded;
like $passphrase_generated, qr/^\$argon2id\$v=19\$m=32768,t=3,p=1\$[\w\+\$\/]+\z/, 'with default settings';
};
subtest 'passphrase->matches' => sub {
ok passphrase($password)->matches($passphrase_generated), 'correct password matched';
ok !passphrase('bad-password')->matches($passphrase_generated), 'incorrect password doesn\'t match';
};
t/02_custom_settings.t view on Meta::CPAN
}
subtest 'test app with custom settings' => sub {
my $app = t::lib::TestApp->to_app;
is( ref $app, "CODE", "Got a code ref" );
test_psgi $app => sub {
my $cb = shift;
{
my $res = $cb->( GET '/passphrase' );
like $res->content, qr/^\$argon2id\$v=19\$m=32768,t=4,p=2\$[\w\+\$\/]+\z/, 'with default settings';
}
};
};
( run in 0.228 second using v1.01-cache-2.11-cpan-cc502c75498 )