Refactor switch() in portal tests

This commit is contained in:
Maxime Besson 2020-02-05 17:12:07 +01:00
parent 663a7759f8
commit 7d1f35f6df
67 changed files with 245 additions and 1068 deletions

View File

@ -12,9 +12,8 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 23;
my $maintests = 21;
my $debug = 'error';
my %handlerOR = ( issuer => [], sp => [] );
SKIP: {
eval "use Lasso";
@ -24,12 +23,8 @@ SKIP: {
# Initialization
my ( $issuer, $sp );
ok( $issuer = issuer(), 'Issuer 1' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -219,13 +214,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub sp {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -10,10 +10,9 @@ BEGIN {
require 't/test-lib.pm';
}
my $maintests = 15;
my $maintests = 13;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -50,13 +49,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple authentication on IdP
switch ('issuer');
@ -163,13 +157,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -10,10 +10,9 @@ BEGIN {
require 't/test-lib.pm';
}
my $maintests = 14;
my $maintests = 12;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -49,13 +48,9 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
$issuer = register('issuer', \&issuer);
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -183,13 +178,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -7,10 +7,9 @@ BEGIN {
require 't/test-lib.pm';
}
my $maintests = 10;
my $maintests = 9;
my $debug = 'error';
my ( $issuer, $res );
my %handlerOR = ( issuer => [], sp => [] );
SKIP: {
eval "use Lasso";
@ -19,8 +18,7 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
ok( $res = $issuer->_get('/saml/metadata'), 'Get metadata' );
ok( $res->[2]->[0] =~ m#^<\?xml version="1.0"\?>#s, 'Metadata is XML' );

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 19;
my $maintests = 17;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,13 +32,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple authentication on IdP
switch ('issuer');
@ -193,13 +187,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 20;
my $maintests = 18;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,13 +32,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -215,13 +209,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 21;
my $maintests = 19;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,13 +32,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -230,13 +224,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 20;
my $maintests = 18;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,13 +32,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple authentication on IdP
switch ('issuer');
@ -176,13 +170,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 22;
my $maintests = 19;
my $debug = 'error';
my ( $issuer, $sp, $sp2, $res );
my %handlerOR = ( issuer => [], sp => [], sp2 => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,16 +32,9 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
ok( $sp2 = sp2(), 'SP2 portal' );
$handlerOR{sp2} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
$sp2 = register('sp2', \&sp2);
# Simple SP access
my $res;
@ -243,13 +235,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 26;
my $maintests = 23;
my $debug = 'error';
my ( $issuer, $sp, $sp2, $res );
my %handlerOR = ( issuer => [], sp => [], sp2 => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,16 +32,11 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
$issuer = register('issuer', \&issuer);
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$sp = register('sp', \&sp);
ok( $sp2 = sp2(), 'SP2 portal' );
$handlerOR{sp2} = \@Lemonldap::NG::Handler::Main::_onReload;
$sp2 = register('sp2', \&sp2);
# Simple SP access
my $res;
@ -300,13 +294,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 10;
my $maintests = 8;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,8 +32,7 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
# Do a user login to have an existing session
@ -53,10 +51,8 @@ SKIP: {
expectCookie($res);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -146,13 +142,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 21;
my $maintests = 19;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,13 +32,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -253,13 +247,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 20;
my $maintests = 18;
my $debug = 'error';
my ( $issuer, $sp, $cdc, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,13 +32,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
use_ok('Lemonldap::NG::Portal::CDC');
ok(
@ -210,13 +204,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 13;
my $maintests = 11;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,13 +32,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -183,16 +177,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass(" ====> $type <====");
count(1);
$main::tt = $type;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,11 +11,10 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 16;
my $maintests = 14;
my $debug = 'error';
my $timeout = 72000;
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -34,13 +33,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -200,13 +194,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,10 +12,9 @@ BEGIN {
require 't/smtp.pm';
}
my $maintests = 20;
my $maintests = 18;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -49,13 +48,8 @@ SKIP: {
close F;
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -253,13 +247,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 17;
my $maintests = 15;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -48,13 +47,8 @@ SKIP: {
close F;
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -224,13 +218,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,10 +12,9 @@ BEGIN {
}
my $userdb = tempdb();
my $maintests = 12;
my $maintests = 10;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -45,13 +44,8 @@ SKIP: {
);
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple authentication on IdP
switch ('issuer');
@ -164,13 +158,6 @@ SKIP: {
count($maintests);
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 11;
my $maintests = 9;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,13 +32,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple authentication on IdP
switch ('issuer');
@ -154,13 +148,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 6;
my $maintests = 4;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,13 +32,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -96,13 +90,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -58,15 +57,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
count(1);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
count(1);
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -182,13 +174,6 @@ expectReject($res);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -58,15 +57,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
count(1);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
count(1);
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -192,13 +184,6 @@ expectReject($res);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -58,15 +57,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
count(1);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
count(1);
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -196,13 +188,6 @@ expectRedirection( $res,
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -58,15 +57,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
count(1);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
count(1);
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -250,13 +242,6 @@ expectRedirection( $res,
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -58,15 +57,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
count(1);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
count(1);
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -250,13 +242,6 @@ expectRedirection( $res,
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -58,15 +57,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
count(1);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
count(1);
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -102,13 +94,6 @@ my $pdata = 'lemonldappdata=' . expectCookie( $res, 'lemonldappdata' );
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -58,15 +57,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
count(1);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
count(1);
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register ( 'issuer', \&issuer );
$sp = register ('sp', \&sp );
# Simple SP access
ok(
@ -221,13 +213,6 @@ expectRedirection( $res,
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -58,15 +57,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
count(1);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
count(1);
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -110,13 +102,6 @@ count(1);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -56,15 +55,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
count(1);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
count(1);
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -213,13 +205,6 @@ expectRedirection( $res,
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
}
my $userdb = tempdb();
my $maintests = 14;
my $maintests = 12;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -76,14 +75,9 @@ SKIP: {
);
# Build CAS server
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
# Build CAS app
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
# Build CAS App
$sp = register('sp', \&sp);
# Simple SP access
# Connect to CAS app
@ -148,13 +142,6 @@ clean_sessions();
count($maintests);
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
}
my $userdb = tempdb();
my $maintests = 23;
my $maintests = 21;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -76,14 +75,10 @@ SKIP: {
);
# Build CAS server
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
$issuer = register('issuer', \&issuer);
# Build CAS app
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$sp = register('sp', \&sp);
# Simple SP access
# Connect to CAS app
@ -303,13 +298,6 @@ SKIP: {
count($maintests);
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $op, $rp, $res );
my %handlerOR = ( op => [], rp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -187,15 +186,6 @@ expectReject($res);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $op, $rp, $res );
my %handlerOR = ( op => [], rp => [] );
my $access_token;
@ -299,15 +298,6 @@ $idpId = expectCookie($res);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -13,7 +13,6 @@ BEGIN {
my $debug = 'error';
my $maintests = 18;
my ( $op, $rp, $res );
my %handlerOR = ( op => [], rp => [] );
my $userdb = tempdb();
LWP::Protocol::PSGI->register(
@ -242,15 +241,6 @@ SKIP: {
count($maintests);
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $op, $rp, $res );
my %handlerOR = ( op => [], rp => [] );
my $access_token;
@ -295,15 +294,6 @@ $idpId = expectCookie($res);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $op, $rp, $res );
my %handlerOR = ( op => [], rp => [] );
my $access_token;
@ -299,15 +298,6 @@ $idpId = expectCookie($res);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $op, $rp, $res );
my %handlerOR = ( op => [], rp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -211,15 +210,6 @@ count(5);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -13,7 +13,6 @@ BEGIN {
my $debug = 'error';
my ( $op, $rp, $res );
my %handlerOR = ( op => [], rp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -203,15 +202,6 @@ $op->logout($idpId);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -13,7 +13,6 @@ BEGIN {
my $debug = 'error';
my ( $op, $rp, $res );
my %handlerOR = ( op => [], rp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -203,15 +202,6 @@ $op->logout($idpId);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $op, $rp, $res );
my %handlerOR = ( op => [], rp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -108,15 +107,6 @@ count(2);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $res );
my %handlerOR = ( issuer => [] );
eval { require XML::Simple };
plan skip_all => "Missing dependencies: $@" if ($@);
@ -85,13 +84,6 @@ count(1);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -12,7 +12,6 @@ BEGIN {
my $debug = 'error';
my ( $op, $rp, $res );
my %handlerOR = ( op => [], rp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -119,15 +118,6 @@ count(1);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -10,10 +10,9 @@ BEGIN {
require 't/test-lib.pm';
}
my $maintests = 14;
my $maintests = 12;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -50,13 +49,10 @@ SKIP: {
if ($@) {
skip 'Net::OpenID::* notfound', $maintests;
}
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -182,13 +178,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,7 +11,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res, $spId, $idpId );
my %handlerOR = ( issuer => [], sp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -63,14 +62,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
count(2);
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -304,13 +297,6 @@ clean_sessions();
done_testing( count() );
# Redefine LWP methods for tests
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -9,10 +9,9 @@ BEGIN {
require 't/test-lib.pm';
}
my $maintests = 4;
my $maintests = 2;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -55,13 +54,8 @@ SKIP: {
skip 'SOAP::Lite not found', $maintests;
}
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -134,13 +128,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,7 +11,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res, $spId );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -63,20 +62,16 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
# Test REST config backend
ok( $res = $issuer->_get('/config/latest'), 'Get latest conf metadata' );
count(1);
expectOK($res);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
$sp = register('sp', \&sp);
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
count(2);
switch ('sp');
# Simple SP access
ok(
@ -209,13 +204,6 @@ expectReject($res);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,7 +11,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res, $spId );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -62,14 +61,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
count(2);
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -116,13 +109,6 @@ count(4);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,7 +11,6 @@ BEGIN {
my $debug = 'error';
my ( $issuer, $sp, $res, $spId );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -62,14 +61,8 @@ LWP::Protocol::PSGI->register(
}
);
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
count(2);
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -152,13 +145,6 @@ expectReject($res);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -9,10 +9,9 @@ BEGIN {
require 't/test-lib.pm';
}
my $maintests = 10;
my $maintests = 8;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -53,8 +52,7 @@ SKIP: {
skip 'SOAP::Lite not found', $maintests;
}
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
# Test SOAP config backend
my $soap = SOAP::Lite->new( proxy => 'http://auth.idp.com/config' );
@ -67,12 +65,7 @@ SKIP: {
ok( $res = $soap->call('getConfig')->result(), 'Get configuration' );
ok( $res->{cfgNum} == 1, 'cfgNum is 1' );
# Test SP access
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$sp = register('sp', \&sp);
# Simple SP access
ok(
@ -126,13 +119,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -9,10 +9,9 @@ BEGIN {
require 't/test-lib.pm';
}
my $maintests = 9;
my $maintests = 7;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -53,13 +52,8 @@ SKIP: {
skip 'SOAP::Lite not found', $maintests;
}
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -117,13 +111,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 13;
my $maintests = 10;
my $debug = 'error';
my ( $idp, $proxy, $app, $res );
my %handlerOR = ( idp => [], proxy => [], app => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -64,19 +63,9 @@ SKIP: {
}
# Initialization
switch ('idp');
ok( $idp = idp(), 'IdP portal' );
$handlerOR{idp} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('proxy');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $proxy = proxy(), 'Proxy portal' );
$handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('app');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $app = app(), 'CAS app portal' );
$handlerOR{app} = \@Lemonldap::NG::Handler::Main::_onReload;
$idp = register('idp', \&idp);
$proxy = register('proxy', \&proxy);
$app = register('app', \&app);
# Query RP for auth
ok( $res = $app->_get( '/', accept => 'text/html' ),
@ -196,15 +185,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub idp {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 12;
my $maintests = 9;
my $debug = 'error';
my ( $idp, $proxy, $app, $res );
my %handlerOR = ( idp => [], proxy => [], app => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -64,19 +63,9 @@ SKIP: {
}
# Initialization
switch ('idp');
ok( $idp = idp(), 'IdP portal' );
$handlerOR{idp} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('proxy');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $proxy = proxy(), 'Proxy portal' );
$handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('app');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $app = app(), 'CAS app portal' );
$handlerOR{app} = \@Lemonldap::NG::Handler::Main::_onReload;
$idp = register('idp', \&idp);
$proxy = register('proxy', \&proxy);
$app = register('app', \&app);
# Query RP for auth
ok( $res = $app->_get( '/', accept => 'text/html' ),
@ -181,15 +170,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub idp {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 26;
my $maintests = 23;
my $debug = 'error';
my ( $op, $rp, $sp, $res );
my %handlerOR = ( op => [], rp => [], sp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -74,8 +73,7 @@ SKIP: {
}
# Initialization
ok( $op = op(), 'OP portal' );
$handlerOR{op} = \@Lemonldap::NG::Handler::Main::_onReload;
$op = register('op', \&op);
ok(
$res = $op->_get('/oauth2/jwks'),
@ -91,15 +89,9 @@ SKIP: {
expectOK($res);
my $metadata = $res->[2]->[0];
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$sp = register('sp', \&sp);
switch ('rp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $rp = rp( $jwks, $metadata ), 'RP portal' );
$handlerOR{rp} = \@Lemonldap::NG::Handler::Main::_onReload;
$rp = register('rp', sub { rp($jwks, $metadata) });
# Query RP for auth
ok( $res = $rp->_get( '/', accept => 'text/html' ), 'Unauth SP request' );
@ -328,15 +320,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 20;
my $maintests = 17;
my $debug = 'error';
my ( $idp, $sp, $rp, $res );
my %handlerOR = ( idp => [], sp => [], rp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -74,14 +73,8 @@ SKIP: {
}
# Initialization
switch ('idp');
ok( $idp = idp(), 'IdP portal' );
$handlerOR{idp} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'Proxy portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$idp = register('idp', \&idp);
$sp = register('sp', \&sp);
ok(
$res = $sp->_get('/oauth2/jwks'),
@ -97,10 +90,7 @@ SKIP: {
expectOK($res);
my $metadata = $res->[2]->[0];
switch ('rp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $rp = rp( $jwks, $metadata ), 'RP portal' );
$handlerOR{rp} = \@Lemonldap::NG::Handler::Main::_onReload;
$rp = register('rp', sub { rp($jwks, $metadata) } );
# Query RP for auth
ok( $res = $rp->_get( '/', accept => 'text/html' ), 'Unauth SP request' );
@ -294,15 +284,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub idp {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 19;
my $maintests = 16;
my $debug = 'error';
my ( $idp, $sp, $rp, $res );
my %handlerOR = ( idp => [], sp => [], rp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -74,14 +73,8 @@ SKIP: {
}
# Initialization
switch ('idp');
ok( $idp = idp(), 'IdP portal' );
$handlerOR{idp} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'Proxy portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$idp = register('idp', \&idp);
$sp = register('sp', \&sp);
ok(
$res = $sp->_get('/oauth2/jwks'),
@ -97,10 +90,7 @@ SKIP: {
expectOK($res);
my $metadata = $res->[2]->[0];
switch ('rp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $rp = rp( $jwks, $metadata ), 'RP portal' );
$handlerOR{rp} = \@Lemonldap::NG::Handler::Main::_onReload;
$rp = register('rp', sub { rp($jwks, $metadata) } );
# Query RP for auth
ok( $res = $rp->_get( '/', accept => 'text/html' ), 'Unauth SP request' );
@ -277,15 +267,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub idp {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 19;
my $maintests = 16;
my $debug = 'error';
my ( $idp, $sp, $rp, $res );
my %handlerOR = ( idp => [], sp => [], rp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -74,14 +73,9 @@ SKIP: {
}
# Initialization
switch ('idp');
ok( $idp = idp(), 'IdP portal' );
$handlerOR{idp} = \@Lemonldap::NG::Handler::Main::_onReload;
$idp = register('idp', \&idp);
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'Proxy portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$sp = register('sp', \&sp);
ok(
$res = $sp->_get('/oauth2/jwks'),
@ -97,10 +91,7 @@ SKIP: {
expectOK($res);
my $metadata = $res->[2]->[0];
switch ('rp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $rp = rp( $jwks, $metadata ), 'RP portal' );
$handlerOR{rp} = \@Lemonldap::NG::Handler::Main::_onReload;
$rp = register('rp', sub { rp($jwks, $metadata) } );
# Query RP for auth
ok( $res = $rp->_get( '/', accept => 'text/html' ), 'Unauth SP request' );
@ -279,15 +270,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub idp {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 13;
my $maintests = 10;
my $debug = 'error';
my ( $op, $proxy, $sp, $res );
my %handlerOR = ( op => [], proxy => [], sp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -74,8 +73,7 @@ SKIP: {
}
# Initialization
ok( $op = op(), 'OP portal' );
$handlerOR{op} = \@Lemonldap::NG::Handler::Main::_onReload;
$op = register('op', \&op);
ok(
$res = $op->_get('/oauth2/jwks'),
@ -91,15 +89,8 @@ SKIP: {
expectOK($res);
my $metadata = $res->[2]->[0];
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('proxy');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $proxy = proxy( $jwks, $metadata ), 'Proxy portal' );
$handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload;
$sp = register('sp', \&sp);
$proxy = register('proxy', sub { proxy($jwks, $metadata) } );
# SAML
switch ('sp');
@ -263,15 +254,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 16;
my $maintests = 13;
my $debug = 'error';
my ( $issuer, $proxy, $sp, $res );
my %handlerOR = ( issuer => [], proxy => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -65,20 +64,9 @@ SKIP: {
# Initialization
# Build CAS server
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
# Build proxy
switch ('proxy');
ok( $proxy = proxy(), 'Issuer portal' );
$handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload;
# Buils SAML SP
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$proxy = register('proxy', \&proxy);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -210,13 +198,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 14;
my $maintests = 11;
my $debug = 'error';
my ( $issuer, $proxy, $sp, $res );
my %handlerOR = ( issuer => [], proxy => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -65,21 +64,13 @@ SKIP: {
# Initialization
# Build CAS server
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
# Build proxy
switch ('proxy');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $proxy = proxy(), 'Issuer portal' );
$handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload;
$proxy = register('proxy', \&proxy);
# Buils SAML SP
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -195,13 +186,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 13;
my $maintests = 10;
my $debug = 'error';
my ( $op, $proxy, $sp, $res );
my %handlerOR = ( op => [], proxy => [], sp => [] );
LWP::Protocol::PSGI->register(
sub {
@ -74,8 +73,7 @@ SKIP: {
}
# Initialization
ok( $op = op(), 'OP portal' );
$handlerOR{op} = \@Lemonldap::NG::Handler::Main::_onReload;
$op = register('op', \&op);
ok(
$res = $op->_get('/oauth2/jwks'),
@ -91,15 +89,9 @@ SKIP: {
expectOK($res);
my $metadata = $res->[2]->[0];
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$sp = register('sp', \&sp);
switch ('proxy');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $proxy = proxy( $jwks, $metadata ), 'Proxy portal' );
$handlerOR{proxy} = \@Lemonldap::NG::Handler::Main::_onReload;
$proxy = register('proxy', sub { proxy($jwks, $metadata) } );
# SAML
switch ('sp');
@ -261,15 +253,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
pass( '==> Switching to ' . uc($type) . ' <==' );
count(1);
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub op {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -28,9 +28,8 @@ use Lemonldap::NG::Portal::Main::Constants qw(
require 't/test-lib.pm';
my $res;
my %handlerOR = ( portal => [], app => [] );
my $client = LLNG::Manager::Test->new( {
my $client = register('portal', sub { LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
useSafeJail => 1,
@ -38,8 +37,8 @@ my $client = LLNG::Manager::Test->new( {
logger => 'Lemonldap::NG::Common::Logger::Std',
}
}
);
$handlerOR{portal} = \@Lemonldap::NG::Handler::Main::_onReload;
)
} );
# CDA with unauthentified user
ok(
@ -75,9 +74,7 @@ use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib');
count(2);
my ( $cli, $app );
switch ('app');
ok( $app = LocalApp->run( $client->ini ), 'App' );
count(1);
$app = register('app', sub { LocalApp->run( $client->ini ) } );
ok(
$res = $app->( {
@ -137,10 +134,3 @@ clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}

View File

@ -9,18 +9,18 @@ use Lemonldap::NG::Portal::Main::Constants qw(
require 't/test-lib.pm';
my $res;
my %handlerOR = ( portal => [], app => [] );
my $client = LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
useSafeJail => 1,
cda => 1,
logger => 'Lemonldap::NG::Common::Logger::Std',
}
my $client = register('portal', sub {LLNG::Manager::Test->new( {
ini => {
logLevel => 'error',
useSafeJail => 1,
cda => 1,
logger => 'Lemonldap::NG::Common::Logger::Std',
}
}
)
}
);
$handlerOR{portal} = \@Lemonldap::NG::Handler::Main::_onReload;
# Try to authenticate
# -------------------
@ -64,8 +64,7 @@ count(2);
my ( $cli, $app );
switch ('app');
ok( $app = Lemonldap::NG::Handler::Server->run( $client->ini ), 'App' );
count(1);
$app = register('app', sub {Lemonldap::NG::Handler::Server->run( $client->ini ) } );
ok(
$res = $app->( {
@ -124,10 +123,3 @@ expectAuthenticatedAs( $res, 'dwho' );
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}

View File

@ -12,9 +12,8 @@ use Lemonldap::NG::Portal::Main::Constants qw(
require 't/test-lib.pm';
my $res;
my $maintests = 8;
my $maintests = 7;
my $debug = 'error';
my %handlerOR = ( portal => [], app => [] );
my $client;
# Redefine LWP methods for tests
@ -66,17 +65,19 @@ LWP::Protocol::PSGI->register(
}
);
$client = LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
useSafeJail => 1,
cda => 1,
restSessionServer => 1,
logger => 'Lemonldap::NG::Common::Logger::Std',
}
$client = register ('portal', sub {
LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
useSafeJail => 1,
cda => 1,
restSessionServer => 1,
logger => 'Lemonldap::NG::Common::Logger::Std',
}
}
);
}
);
$handlerOR{portal} = \@Lemonldap::NG::Handler::Main::_onReload;
# CDA with unauthentified user
ok(
@ -111,16 +112,16 @@ use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib');
my ( $cli, $app );
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
switch ('app');
ok(
$app = Lemonldap::NG::Handler::Server->run( {
%{ $client->ini },
globalStorage => 'Lemonldap::NG::Common::Apache::Session::REST',
globalStorageOptions =>
{ baseUrl => 'http://auth.example.com/sessions/global/' },
localSessionStorage => undef,
}
),
'App'
$app = register('app', sub {
Lemonldap::NG::Handler::Server->run( {
%{ $client->ini },
globalStorage => 'Lemonldap::NG::Common::Apache::Session::REST',
globalStorageOptions =>
{ baseUrl => 'http://auth.example.com/sessions/global/' },
localSessionStorage => undef,
}
)
}
);
ok(
@ -178,10 +179,3 @@ expectAuthenticatedAs( $res, 'dwho' );
clean_sessions();
done_testing( count($maintests) );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}

View File

@ -12,9 +12,8 @@ use Lemonldap::NG::Portal::Main::Constants qw(
require 't/test-lib.pm';
my $res;
my $maintests = 8;
my $maintests = 7;
my $debug = 'error';
my %handlerOR = ( portal => [], app => [] );
my $client;
# Redefine LWP methods for tests
@ -53,17 +52,19 @@ SKIP: {
if ($@) {
skip 'SOAP::Lite not found', $maintests;
}
$client = LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
useSafeJail => 1,
cda => 1,
soapSessionServer => 1,
logger => 'Lemonldap::NG::Common::Logger::Std',
}
$client = register('portal', sub {
LLNG::Manager::Test->new( {
ini => {
logLevel => $debug,
useSafeJail => 1,
cda => 1,
soapSessionServer => 1,
logger => 'Lemonldap::NG::Common::Logger::Std',
}
}
)
}
);
$handlerOR{portal} = \@Lemonldap::NG::Handler::Main::_onReload;
# CDA with unauthentified user
ok(
@ -100,16 +101,16 @@ SKIP: {
my ( $cli, $app );
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
switch ('app');
ok(
$app = Lemonldap::NG::Handler::Server->run( {
%{ $client->ini },
globalStorage => 'Lemonldap::NG::Common::Apache::Session::SOAP',
globalStorageOptions =>
{ proxy => 'http://auth.example.com/adminSessions' },
localSessionStorage => undef,
}
),
'App'
$app = register('app', sub {
Lemonldap::NG::Handler::Server->run( {
%{ $client->ini },
globalStorage => 'Lemonldap::NG::Common::Apache::Session::SOAP',
globalStorageOptions =>
{ proxy => 'http://auth.example.com/adminSessions' },
localSessionStorage => undef,
}
)
}
);
ok(
@ -168,10 +169,3 @@ SKIP: {
clean_sessions();
done_testing( count($maintests) );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}

View File

@ -9,7 +9,6 @@ use Lemonldap::NG::Portal::Main::Constants qw(
require 't/test-lib.pm';
my $res;
my %handlerOR = ( portal => [], app => [] );
my $client = LLNG::Manager::Test->new( {
ini => {
@ -20,7 +19,6 @@ my $client = LLNG::Manager::Test->new( {
}
}
);
$handlerOR{portal} = \@Lemonldap::NG::Handler::Main::_onReload;
# CDA with unauthentified user
ok(
@ -56,7 +54,6 @@ use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib');
count(2);
my ( $cli, $app );
switch ('app');
ok( $app = Lemonldap::NG::Handler::Server->run( $client->ini ), 'App' );
count(1);
@ -117,10 +114,3 @@ expectAuthenticatedAs( $res, 'dwho' );
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}

View File

@ -11,10 +11,9 @@ BEGIN {
require 't/saml-lib.pm';
}
my $maintests = 22;
my $maintests = 20;
my $debug = 'error';
my ( $issuer, $sp, $res );
my %handlerOR = ( issuer => [], sp => [] );
# Redefine LWP methods for tests
LWP::Protocol::PSGI->register(
@ -33,13 +32,8 @@ SKIP: {
}
# Initialization
ok( $issuer = issuer(), 'Issuer portal' );
$handlerOR{issuer} = \@Lemonldap::NG::Handler::Main::_onReload;
switch ('sp');
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok( $sp = sp(), 'SP portal' );
$handlerOR{sp} = \@Lemonldap::NG::Handler::Main::_onReload;
$issuer = register('issuer', \&issuer);
$sp = register('sp', \&sp);
# Simple SP access
my $res;
@ -374,13 +368,6 @@ count($maintests);
clean_sessions();
done_testing( count() );
sub switch {
my $type = shift;
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
sub issuer {
return LLNG::Manager::Test->new( {
ini => {

View File

@ -502,6 +502,41 @@ sub tempdb {
return "$tmpDir/userdb.db";
}
my %handlerOR;
=head4 register
Registers a new LLNG instance
=cut
sub register {
my ($type, $constructor) = @_;
my $obj;
@Lemonldap::NG::Handler::Main::_onReload = ();
&Lemonldap::NG::Handler::Main::cfgNum( 0, 0 );
ok($obj = $constructor->(), 'Register $type');
count(1);
$handlerOR{$type} = \@Lemonldap::NG::Handler::Main::_onReload;
return $obj;
}
=head4 register
Switch to a registered instance
=cut
sub switch {
my $type = shift;
return [] unless $handlerOR{$type};
note( '==> Switching to ' . uc($type) . ' <==' );
@Lemonldap::NG::Handler::Main::_onReload = @{
$handlerOR{$type};
};
}
=head2 LLNG::Manager::Test Class
=cut
@ -829,4 +864,5 @@ sub _put {
return $self->_post( $path, $body, %args );
}
1;