Fix unit tests (#2589)

This commit is contained in:
Christophe Maudoux 2021-08-12 21:06:39 +02:00
parent b59ba39e05
commit 30fd065134
12 changed files with 57 additions and 50 deletions

View File

@ -18,12 +18,12 @@ my $client = LLNG::Manager::Test->new( {
'2_ssl' => 'SSL;Demo;Null',
},
authChoiceFindUser => '1_dem',
useSafeJail => 1,
requireToken => 1,
findUser => 1,
impersonationRule => 1,
useSafeJail => 1,
requireToken => 1,
findUser => 1,
impersonationRule => 1,
findUserSearchingAttributes =>
{ uid => 'Login', guy => 'Kind', cn => 'Name' },
{ 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' },
}
@ -53,12 +53,12 @@ ok(
'Post FindUser request'
);
ok(
$res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""'
) or explain( $res->[2]->[0], 'value=""' );
$res->[2]->[0] =~
m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""'
) or explain( $res->[2]->[0], 'value=""' );
( $host, $url, $query ) =
expectForm( $res, '#', undef, 'uid', 'guy', 'cn', 'token' );
expectForm( $res, '#', undef, 'uid', 'guy', 'cn', 'token' );
$query =~ s/user=/user=rtyler/;
$query =~ s/password=/password=rtyler/;
$query =~ s/2_ssl/1_demo/;

View File

@ -24,7 +24,7 @@ my $client = LLNG::Manager::Test->new( {
findUser => 1,
impersonationRule => 1,
findUserSearchingAttributes =>
{ uid => 'Login', guy => 'Kind', cn => 'Name' },
{ 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' },
}
@ -57,7 +57,7 @@ ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
or print STDERR "$@\n" . Dumper($res);
ok( $json->{user} eq 'dwho', ' Good user' )
or explain( $json, 'user => dwho' );
ok( $token = $json->{token}, 'Found token' );
ok( $token = $json->{token}, 'Found token' );
count(4);
ok( $res = $client->_get( '/', accept => 'text/html' ), 'Get Portal', );
@ -79,7 +79,7 @@ ok( $json->{error} == 82, ' Token expired' )
or explain( $json, 'Token expired' );
ok( $json->{result} == 0, ' result => 0' )
or explain( $json, 'Result => 0' );
ok( $token = $json->{token}, 'Found token' );
ok( $token = $json->{token}, 'Found token' );
count(6);
clean_sessions();

View File

@ -27,10 +27,11 @@ SKIP: {
'LDAP' => { 'for' => 0, 'type' => 'LDAP' },
'Demo' => { 'for' => 0, 'type' => 'Demo' }
},
combination => '[Demo, Demo] or [LDAP, LDAP]',
findUser => 1,
impersonationRule => 1,
findUserSearchingAttributes => { uid => 'Login', cn => 'Name' },
combination => '[Demo, Demo] or [LDAP, LDAP]',
findUser => 1,
impersonationRule => 1,
findUserSearchingAttributes =>
{ 'uid##1' => 'Login', 'cn##1' => 'Name' },
findUserExcludingAttributes => { uid => 'rtyler' },
}
}

View File

@ -58,10 +58,10 @@ SKIP: {
findUserWildcard => '#',
impersonationRule => 1,
findUserSearchingAttributes => {
uid => 'Login',
guy => 'Kind',
cn => 'Name',
room => 'Room'
'uid##1' => 'Login',
'guy##1' => 'Kind',
'cn##1' => 'Name',
'room##1' => 'Room'
},
findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler # davrosjr # ' },
@ -91,7 +91,7 @@ SKIP: {
expectForm( $res, '#', undef, 'uid', 'guy', 'cn', 'room' );
ok(
$res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""'
) or explain( $res->[2]->[0], 'value=""' );

View File

@ -17,15 +17,18 @@ SKIP: {
}
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
authentication => 'Demo',
userDB => 'Same',
useSafeJail => 1,
captcha_login_enabled => 1,
findUser => 1,
impersonationRule => 1,
findUserSearchingAttributes =>
{ uid => 'Login', guy => 'Kind', cn => 'Name' }
logLevel => 'error',
authentication => 'Demo',
userDB => 'Same',
useSafeJail => 1,
captcha_login_enabled => 1,
findUser => 1,
impersonationRule => 1,
findUserSearchingAttributes => {
'uid##1' => 'Login',
'guy##1' => 'Kind',
'cn##1' => 'Name'
}
}
}
);

View File

@ -21,8 +21,8 @@ my $client = LLNG::Manager::Test->new( {
findUserControl => '^[\w*\s]+$',
findUserWildcard => '*',
findUserSearchingAttributes => {
uid => 'Name',
guy => 'Kind',
'uid##1' => 'Name',
'guy##1' => 'Kind',
'type#Type#1' => 'mutant; mutant; character',
'cn#Name#0' => 'Bad Guy; Not a good person; The Daleks; daleks'
},
@ -52,7 +52,7 @@ ok(
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'guy' );
ok(
$res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""'
) or explain( $res->[2]->[0], 'value=""' );

View File

@ -17,7 +17,7 @@ my $client = LLNG::Manager::Test->new( {
findUser => 1,
impersonationRule => 1,
findUserSearchingAttributes =>
{ uid => 'Login', guy => 'Kind', cn => 'Name' },
{ 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' },
}

View File

@ -22,8 +22,8 @@ my $client = LLNG::Manager::Test->new( {
findUserControl => '^[\w*\s]+$',
findUserWildcard => '*',
findUserSearchingAttributes => {
uid => undef,
guy => 'Kind',
'uid#fdgd#1' => undef,
'guy##1' => 'Kind',
'cn#Name#1' => 'Bad Guy; Not a good person; BB; Bad Boy'
},
findUserExcludingAttributes =>
@ -52,7 +52,7 @@ ok(
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid', 'guy' );
ok(
$res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""'
) or explain( $res->[2]->[0], 'value=""' );

View File

@ -32,13 +32,16 @@ SKIP: {
roomNumber => 'roomNumber',
mail => 'mail'
},
requireToken => 0,
findUser => 1,
impersonationRule => 1,
findUserWildcard => '#',
findUserControl => '^[\w#\s]+$',
findUserSearchingAttributes =>
{ uid => 'Login', roomNumber => 'Room', cn => 'Name' },
requireToken => 0,
findUser => 1,
impersonationRule => 1,
findUserWildcard => '#',
findUserControl => '^[\w#\s]+$',
findUserSearchingAttributes => {
'uid##1' => 'Login',
'roomNumber##1' => 'Room',
'cn##1' => 'Name'
},
findUserExcludingAttributes =>
{ mail => 'french@badwolf.org', uid => 'russian' },
}
@ -66,7 +69,7 @@ SKIP: {
expectForm( $res, '#', undef, 'uid', 'roomNumber', 'cn' );
ok(
$res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""'
) or explain( $res->[2]->[0], 'value=""' );

View File

@ -87,7 +87,7 @@ my $client = LLNG::Manager::Test->new( {
impersonationRule => 1,
useSafeJail => 1,
findUserSearchingAttributes =>
{ uid => 'Login', guy => 'Kind', cn => 'Name' },
{ 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' },
}

View File

@ -23,7 +23,7 @@ my $client = LLNG::Manager::Test->new( {
findUserControl => '^[\w*\s]+$',
findUserWildcard => '*',
findUserSearchingAttributes => {
uid => 'User',
'uid##1' => 'User',
},
authChoiceModules => {
strong => 'Apache;Demo;Null;;;{}',
@ -63,7 +63,7 @@ ok(
( $host, $url, $query ) = expectForm( $res, '#', undef, 'uid' );
ok(
$res->[2]->[0] =~
m%<input id="spoofIdfield" name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
m%<input name="spoofId" type="text" class="form-control" value="" autocomplete="off"%,
'value=""'
) or explain( $res->[2]->[0], 'value=""' );
ok(

View File

@ -19,7 +19,7 @@ my $client = LLNG::Manager::Test->new( {
findUser => 1,
impersonationRule => 0,
findUserSearchingAttributes =>
{ uid => 'Login', guy => 'Kind', cn => 'Name' },
{ 'uid##1' => 'Login', 'guy##1' => 'Kind', 'cn##1' => 'Name' },
findUserExcludingAttributes =>
{ type => 'mutant', uid => 'rtyler' },
}