2006-12-18 12:32:33 +01:00
|
|
|
# Before `make install' is performed this script should be runnable with
|
|
|
|
# `make test'. After `make install' it should work as `perl Lemonldap-NG-Handler-Vhost.t'
|
|
|
|
|
|
|
|
#########################
|
|
|
|
|
|
|
|
# change 'tests => 1' to 'tests => last_test_to_print';
|
|
|
|
|
2007-04-15 14:44:29 +02:00
|
|
|
package My::Package;
|
|
|
|
|
2017-02-12 21:09:46 +01:00
|
|
|
use Test::More tests => 6;
|
2007-04-15 14:44:29 +02:00
|
|
|
|
|
|
|
BEGIN {
|
2014-06-30 20:34:23 +02:00
|
|
|
use_ok('Lemonldap::NG::Handler::Main');
|
2007-04-15 14:44:29 +02:00
|
|
|
}
|
2006-12-18 12:32:33 +01:00
|
|
|
|
|
|
|
#########################
|
|
|
|
|
|
|
|
# Insert your test code below, the Test::More module is use()ed here so read
|
|
|
|
# its man page ( perldoc Test::More ) for help writing this test script.
|
|
|
|
|
2014-03-31 18:25:09 +02:00
|
|
|
my $globalinit;
|
2007-04-15 14:44:29 +02:00
|
|
|
|
2014-06-30 20:34:23 +02:00
|
|
|
my $tsv = {};
|
2014-07-03 11:30:41 +02:00
|
|
|
|
2017-02-12 21:09:46 +01:00
|
|
|
sub Lemonldap::NG::Handler::Main::defaultLogger {
|
|
|
|
'Lemonldap::NG::Common::Logger::Std';
|
|
|
|
}
|
|
|
|
|
|
|
|
eval { Lemonldap::NG::Handler::Main->logLevelInit('error') };
|
|
|
|
ok( !$@, 'logLevelInit' );
|
|
|
|
|
2014-07-03 11:30:41 +02:00
|
|
|
ok(
|
2016-03-17 23:19:44 +01:00
|
|
|
Lemonldap::NG::Handler::Main->jailInit(
|
2014-07-03 11:30:41 +02:00
|
|
|
{
|
|
|
|
https => 0,
|
|
|
|
port => 0,
|
|
|
|
maintenance => 0,
|
|
|
|
vhostOptions => {
|
|
|
|
www1 => {
|
|
|
|
vhostHttps => 1,
|
|
|
|
vhostPort => 443,
|
|
|
|
vhostMaintenance => 1,
|
|
|
|
vhostAliases => 'www2 www3',
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
$tsv
|
|
|
|
),
|
|
|
|
'defaultValuesInit'
|
|
|
|
);
|
|
|
|
|
2013-10-03 12:48:52 +02:00
|
|
|
ok(
|
2016-03-17 23:19:44 +01:00
|
|
|
Lemonldap::NG::Handler::Main->defaultValuesInit(
|
2013-10-03 12:48:52 +02:00
|
|
|
{
|
|
|
|
https => 0,
|
|
|
|
port => 0,
|
|
|
|
maintenance => 0,
|
|
|
|
vhostOptions => {
|
|
|
|
www1 => {
|
|
|
|
vhostHttps => 1,
|
|
|
|
vhostPort => 443,
|
|
|
|
vhostMaintenance => 1,
|
|
|
|
vhostAliases => 'www2 www3',
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
2014-06-30 20:34:23 +02:00
|
|
|
},
|
|
|
|
$tsv
|
2013-10-03 12:48:52 +02:00
|
|
|
),
|
|
|
|
'defaultValuesInit'
|
|
|
|
);
|
|
|
|
|
2007-04-15 14:44:29 +02:00
|
|
|
ok(
|
2016-03-17 23:19:44 +01:00
|
|
|
Lemonldap::NG::Handler::Main->locationRulesInit(
|
2007-04-15 14:44:29 +02:00
|
|
|
{
|
2014-03-31 18:25:09 +02:00
|
|
|
'locationRules' => {
|
|
|
|
'www1' => {
|
|
|
|
'default' => 'accept',
|
|
|
|
'^/no' => 'deny',
|
|
|
|
'test' => '$groups =~ /\badmin\b/',
|
|
|
|
}
|
|
|
|
}
|
2014-06-30 20:34:23 +02:00
|
|
|
},
|
|
|
|
$tsv
|
2008-05-12 15:20:30 +02:00
|
|
|
),
|
|
|
|
'locationRulesInit'
|
2007-04-15 14:44:29 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
ok(
|
2016-03-17 23:19:44 +01:00
|
|
|
Lemonldap::NG::Handler::Main->headersInit(
|
2014-07-24 17:48:32 +02:00
|
|
|
{ exportedHeaders => { www1 => { Auth => '$uid', } } }, $tsv
|
2008-05-12 15:20:30 +02:00
|
|
|
),
|
|
|
|
'forgeHeadersInit'
|
2007-04-15 14:44:29 +02:00
|
|
|
);
|
|
|
|
|