1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#!perl
use strict;
use lib 't/lib';
use MyAdapter;
use MyCache;
use MyLog;
use Test::More tests => 5;
my $credentials = {
user => 'password'
};
my $adapter = MyAdapter->new(
credentials => $credentials,
log => MyLog->new
);
ok( $adapter );
ok( $adapter->authenticate( 'user', 'password' ) );
ok( !$adapter->authenticate( 'john', 'password' ) );
like( $adapter->log->messages->[0], qr/Successfully authenticated user 'user'/ );
like( $adapter->log->messages->[1], qr/Failed to authenticate user 'john'/ );
|