Commit cd8146a1 authored by Xavier Guimard's avatar Xavier Guimard

Add test to check if vhostOptions are read (#1613)

parent 8d40de13
......@@ -66,6 +66,7 @@ t/63-Lemonldap-NG-Handler-PSGI-Try.t
t/64-Lemonldap-NG-Handler-PSGI-DevOps.t
t/65-Lemonldap-NG-Handler-PSGI-ServiceToken.t
t/66-Lemonldap-NG-Handler-PSGI-wildcard.t
t/67-Lemonldap-NG-Handler-PSGI-vhostoptions.t
t/99-pod.t
t/lmConf-1.json
t/sessions/lock/Apache-Session-f5eec18ebb9bc96352595e2d8ce962e8ecf7af7c9a98cb9a43f9cd181cf4b545.lock
......
use Test::More;
use JSON;
use MIME::Base64;
use Data::Dumper;
require 't/test-psgi-lib.pm';
init('Lemonldap::NG::Handler::PSGI', {
vhostOptions => {
'test1.example.com' => {
vhostHttps => 1,
vhostPort => 443,
},
},
locationRules => {
},
exportedHeaders => {
},
https => undef,
port => undef,
maintenance => undef,
});
my $res;
ok( $res = $client->_get('/'), 'Unauthentified query' );
ok( ref($res) eq 'ARRAY', 'Response is an array' ) or explain( $res, 'array' );
ok( $res->[0] == 302, 'Code is 302' ) or explain( $res->[0], 302 );
my %h = @{ $res->[1] };
ok(
$h{Location} eq 'http://auth.example.com/?url='
. encode_base64( 'https://test1.example.com/', '' ),
'Redirection points to portal and site is https'
)
or explain(
\%h,
'Location => http://auth.example.com/?url='
. encode_base64( 'https://test1.example.com/', '' )
);
count(4);
done_testing( count() );
clean();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment