You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.3 KiB
66 lines
1.3 KiB
use Test::More;
|
|
use strict;
|
|
use IO::String;
|
|
use Data::Dumper;
|
|
|
|
require 't/test-lib.pm';
|
|
|
|
use_ok('Lemonldap::NG::Common::FormEncode');
|
|
count(1);
|
|
|
|
my $client = LLNG::Manager::Test->new( {
|
|
ini => {
|
|
logLevel => 'error',
|
|
ext2fActivation => 1,
|
|
ext2fCodeActivation => 'A1b2C0',
|
|
ext2FSendCommand => 't/sendCode.pl -uid $uid -code $code',
|
|
authentication => 'Demo',
|
|
userDB => 'Same',
|
|
}
|
|
}
|
|
);
|
|
|
|
my $res;
|
|
|
|
# Try to authenticate
|
|
# -------------------
|
|
ok(
|
|
$res = $client->_post(
|
|
'/',
|
|
IO::String->new('user=dwho&password=dwho'),
|
|
length => 23,
|
|
accept => 'text/html',
|
|
),
|
|
'Auth query'
|
|
);
|
|
count(1);
|
|
|
|
my ( $host, $url, $query ) =
|
|
expectForm( $res, undef, '/ext2fcheck', 'token', 'code' );
|
|
|
|
ok(
|
|
$res->[2]->[0] =~
|
|
qr%<input name="code" value="" class="form-control" id="extcode" trplaceholder="code" autocomplete="off" />%,
|
|
'Found EXTCODE input'
|
|
) or print STDERR Dumper( $res->[2]->[0] );
|
|
count(1);
|
|
|
|
$query =~ s/code=/code=A1b2C0/;
|
|
ok(
|
|
$res = $client->_post(
|
|
'/ext2fcheck',
|
|
IO::String->new($query),
|
|
length => length($query),
|
|
accept => 'text/html',
|
|
),
|
|
'Post code'
|
|
);
|
|
count(1);
|
|
|
|
my $id = expectCookie($res);
|
|
$client->logout($id);
|
|
|
|
clean_sessions();
|
|
|
|
done_testing( count() );
|
|
|
|
|