Improve unit test (#1773)

This commit is contained in:
Christophe Maudoux 2019-05-26 18:29:18 +02:00
parent 74b9960afb
commit 5ec8904d17

View File

@ -4,12 +4,15 @@ BEGIN {
require 't/test-psgi-lib.pm';
}
init('Lemonldap::NG::Handler::Server');
init(
'Lemonldap::NG::Handler::Server',
{
handlerServiceTokenTTL => 2,
}
);
my $res;
my $crypt = Lemonldap::NG::Common::Crypto->new('qwertyui');
my $token = $crypt->encrypt( join ':', time, $sessionId, 'test1.example.com' );
ok(
@ -23,6 +26,19 @@ ok(
ok( $res->[0] == 200, 'Code is 200' ) or explain( $res->[0], 200 );
count(2);
sleep 3;
ok(
$res = $client->_get(
'/', undef, 'test1.example.com', undef,
VHOSTTYPE => 'ServiceToken',
'HTTP_X_LLNG_TOKEN' => $token,
),
'Query with token'
);
ok( $res->[0] == 302, 'Code is 302' ) or explain( $res->[0], 302 );
count(2);
done_testing( count() );
clean();