Commit 545a6485 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛

Improve unit test

parent 043292fc
...@@ -146,7 +146,6 @@ JjTJecOOS+88fK8qL1TrYv5rapIdqUI7aQ== ...@@ -146,7 +146,6 @@ JjTJecOOS+88fK8qL1TrYv5rapIdqUI7aQ==
IO::String->new('user=dwho&password=dwho'), IO::String->new('user=dwho&password=dwho'),
length => 23, length => 23,
accept => 'text/html', accept => 'text/html',
cookie => "lemonldap=$id",
), ),
'Auth query' 'Auth query'
); );
......
...@@ -4,7 +4,7 @@ use IO::String; ...@@ -4,7 +4,7 @@ use IO::String;
use Data::Dumper; use Data::Dumper;
require 't/test-lib.pm'; require 't/test-lib.pm';
my $maintests = 6; my $maintests = 10;
use_ok('Lemonldap::NG::Common::FormEncode'); use_ok('Lemonldap::NG::Common::FormEncode');
...@@ -12,9 +12,12 @@ my $client = LLNG::Manager::Test->new( ...@@ -12,9 +12,12 @@ my $client = LLNG::Manager::Test->new(
{ {
ini => { ini => {
logLevel => 'error', logLevel => 'error',
u2fActivation => '1',
totp2fActivation => '$uid eq "dwho"',
ext2fActivation => 1, ext2fActivation => 1,
ext2FSendCommand => 't/sendOTP.pl -uid $uid', ext2FSendCommand => 't/sendOTP.pl -uid $uid',
ext2FValidateCommand => 't/vrfyOTP.pl -uid $uid -code $code', ext2FValidateCommand => 't/vrfyOTP.pl -uid $uid -code $code',
ext2fLogo => 'yubikey.png',
loginHistoryEnabled => 1, loginHistoryEnabled => 1,
authentication => 'Demo', authentication => 'Demo',
userDB => 'Same', userDB => 'Same',
...@@ -37,6 +40,39 @@ ok( ...@@ -37,6 +40,39 @@ ok(
); );
my ( $host, $url, $query ) = my ( $host, $url, $query ) =
expectForm( $res, undef, '/2fchoice', 'token', 'checkLogins' );
ok(
$res->[2]->[0] =~
qq%<img src="/static/bootstrap/u2f.png" alt="u2F" title="u2F" />%,
'Found u2f.png'
) or print STDERR Dumper( $res->[2]->[0] );
ok(
$res->[2]->[0] =~
qq%<img src="/static/bootstrap/yubikey.png" alt="ext2F" title="ext2F" />%,
'Found yubikey.png'
) or print STDERR Dumper( $res->[2]->[0] );
ok(
$res->[2]->[0] =~
qq%<img src="/static/bootstrap/totp.png" alt="totp2F" title="totp2F" />%,
'Found totp.png'
) or print STDERR Dumper( $res->[2]->[0] );
$query .= '&sf=ext';
ok(
$res = $client->_post(
'/2fchoice',
IO::String->new($query),
length => length($query),
accept => 'text/html',
),
'Post ext2f choice'
);
( $host, $url, $query ) =
expectForm( $res, undef, '/ext2fcheck', 'token', 'code', 'checkLogins' ); expectForm( $res, undef, '/ext2fcheck', 'token', 'code', 'checkLogins' );
ok( ok(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment