use Test::More;
use strict;
use JSON;
use IO::String;
require 't/test-lib.pm';
my $maintests = 53;
my $res;
my $json;
my $request;
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
authentication => 'Demo',
userDB => 'Same',
useSafeJail => 1,
requireToken => 0,
findUser => 1,
impersonationRule => 1,
findUserControl => '^[\w*\s]+$',
findUserWildcard => '*',
findUserSearchingAttributes => {
'uid#fdgd#1' => undef,
'guy##1' => 'Kind',
'cn#Name#1' => 'Bad Guy; Not a good person; BB; Bad Boy'
},
findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' },
}
}
);
use Lemonldap::NG::Portal::Main::Constants 'PE_USERNOTFOUND';
## Simple access
ok( $res = $client->_get( '/', accept => 'text/html' ), 'Get Portal', );
my ( $host, $url, $query ) =
expectForm( $res, '#', undef, 'user', 'password', 'spoofId' );
$request = '';
ok(
$res = $client->_post(
'/finduser', IO::String->new($request),
accept => 'text/html',
length => length($request)
),
'Post empty FindUser request'
);
( $host, $url, $query ) =
expectForm( $res, '#', undef, 'user', 'password', 'spoofId' );
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'guy' );
ok(
$res->[2]->[0] =~
m%[2]->[0], 'value=""' );
$request = 'uid=dwho';
ok(
$res = $client->_post(
'/finduser', IO::String->new($request),
accept => 'text/html',
length => length($request)
),
'Post FindUser request'
);
ok( $res->[2]->[0] =~ m%autocomplete="off"%, 'autocomplete="off"' )
or explain( $res->[2]->[0], 'autocomplete="off"' );
ok(
$res->[2]->[0] =~
m%Search for an account%,
'Search an account'
) or explain( $res->[2]->[0], 'Search for an account' );
ok(
$res->[2]->[0] =~
m%%,
'id="findUser_guy"'
) or explain( $res->[2]->[0], 'id="findUser_guy"' );
ok(
$res->[2]->[0] =~
m%%,
'id="findUser_uid"'
) or explain( $res->[2]->[0], 'id="findUser_uid"' );
ok(
$res->[2]->[0] =~
m%