Add test for combination (#1151)

This commit is contained in:
Xavier Guimard 2017-02-07 06:21:23 +00:00
parent 313e016cd0
commit cd894cbc2c
4 changed files with 31 additions and 2 deletions

View File

@ -19,6 +19,11 @@
* Add test for #173
* lwpSslOpt
# Combination
* getDisplayType()
* detect changes
# Password
* Enable it during auth

View File

@ -275,6 +275,27 @@ sub tests {
# Return
return 1;
},
checkCombinations => sub {
return 1 unless ( $conf->{authentication} eq 'Combination' );
require Lemonldap::NG::Common::Combination::Parser;
return ( 0, 'No module declared for combination' )
unless ( $conf->{combModules} and %{ $conf->{combModules} } );
my $moduleList;
foreach my $md ( keys %{ $conf->{combModules} } ) {
my $entry = $conf->{combModules}->{$md};
$moduleList->{$md} = (
$entry->{for} == 2 ? [ undef, {} ]
: $entry->{for} == 1 ? [ {}, undef ]
: [ {}, {} ]
);
}
eval {
Lemonldap::NG::Common::Combination::Parser->parse( $moduleList,
$conf->{combination} );
};
return ( 0, $@ ) if ($@);
return 1;
},
};
}

View File

@ -111,7 +111,10 @@ sub setGroups {
}
sub getDisplayType {
return $_[0]->try( 0, 'getDisplayType', {} );
my ( $self, $req ) = @_;
my ( $nb, $stack ) = ( $req->datas->{multiTry}, $req->datas->{multiStack} );
my ( $res, $name ) = $stack->[$nb]->[0]->( 'getDisplayType', $req );
return $res;
}
# TODO: authLogout

View File

@ -251,7 +251,7 @@ sub display {
}
# Display authentifcation form
# Display authentication form
else {
# Authentication loop