Correct test for CAS proxy mode activation (#242)

This commit is contained in:
Clément Oudot 2010-11-19 11:43:52 +00:00
parent 655c6484b7
commit 0d5144bce8
2 changed files with 28 additions and 8 deletions

View File

@ -65,7 +65,10 @@ sub extractFormInfo {
}
# Act as a proxy if proxied services configured
my $proxy = ref( $self->{CAS_proxiedServices} ) ? 1 : 0;
my $proxy =
ref( $self->{CAS_proxiedServices} ) eq 'HASH'
? ( %{ $self->{CAS_proxiedServices} } ? 1 : 0 )
: 0;
if ($proxy) {
$self->lmLog( "CAS: Proxy mode activated", 'debug' );

View File

@ -5,7 +5,7 @@
# change 'tests => 1' to 'tests => last_test_to_print';
use Test::More tests => 1;
use Test::More tests => 2;
#########################
@ -18,23 +18,40 @@ SKIP: {
eval { require AuthCAS };
skip
"AuthCAS is not installed, so Lemonldap::NG::Portal::AuthCAS will not be useable",
1
2
if ($@);
my $p;
eval { require Lemonldap::NG::Portal::Simple };
skip
"Problem with Lemonldap::NG::Portal::Simple, Lemonldap::NG::Portal::AuthCAS will not be tested",
1
2
if ($@);
$ENV{"REQUEST_METHOD"} = 'GET';
ok(
$p = Lemonldap::NG::Portal::Simple->new(
{
globalStorage => 'Apache::Session::File',
domain => 'example.com',
authentication => 'CAS',
globalStorage => 'Apache::Session::File',
domain => 'example.com',
authentication => 'CAS',
CAS_url => 'https://cas.example.com',
CAS_pgt => '/tmp/pgt.txt',
CAS_proxiedServices => {},
}
)
),
"CAS without proxy mode"
);
ok(
$p = Lemonldap::NG::Portal::Simple->new(
{
globalStorage => 'Apache::Session::File',
domain => 'example.com',
authentication => 'CAS',
CAS_url => 'https://cas.example.com',
CAS_pgt => '/tmp/pgt.txt',
CAS_proxiedServices => { 'CAS1' => 'http://cas1.example.com' },
}
),
"CAS with proxy mode"
);
}