lemonldap-ng/lemonldap-ng-portal/t/27-AuthProxy.t

39 lines
967 B
Perl
Raw Normal View History

2016-06-07 23:04:24 +02:00
use Test::More;
use strict;
use IO::String;
my $res;
SKIP: {
skip 'REMOTELLNG is not set', 10 unless ( $ENV{REMOTELLNG} );
require 't/test-lib.pm';
2016-11-14 13:34:46 +01:00
my $client = LLNG::Manager::Test->new(
2016-06-07 23:04:24 +02:00
{
2016-11-14 13:34:46 +01:00
ini => {
logLevel => 'error',
useSafeJail => 1,
authentication => 'Proxy',
userDB => 'Proxy',
soapAuthService => $ENV{REMOTELLNG},
}
2016-06-07 23:04:24 +02:00
}
);
ok(
2016-11-14 13:34:46 +01:00
$res = $client->_post(
2016-06-07 23:04:24 +02:00
'/',
IO::String->new('user=dwho&password=dwho'),
length => 23
),
'Auth query'
);
ok( $res->[0] == 200, 'Response is 200' ) or explain( $res->[0], 200 );
2016-11-14 13:34:46 +01:00
my $cookies = $client->getCookies($res);
2016-06-07 23:04:24 +02:00
my $id;
ok( $id = $cookies->{lemonldap}, 'Get cookie' )
or explain( $res, 'Set-Cookie: something' );
2016-11-14 13:34:46 +01:00
$client->logout($id);
2016-06-07 23:04:24 +02:00
clean_sessions();
}
done_testing(10);