lemonldap-ng/modules/lemonldap-ng-handler/t/01-Lemonldap-NG-Handler-Simple.t

58 lines
1.5 KiB
Perl
Raw Normal View History

# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl Lemonldap-NG-Handler.t'
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
2010-09-03 17:24:06 +02:00
use Test::More tests => 10;
BEGIN { use_ok( 'Lemonldap::NG::Handler::Simple', ':all' ) }
#########################
# 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.
my $h;
$h = bless {}, 'Lemonldap::NG::Handler::Simple';
ok(
$h->localInit(
{
localStorage => 'Cache::FileCache',
2009-04-02 18:05:38 +02:00
localStorageOptions => { 'namespace' => 'MyNamespaceTest', },
}
),
'localInit'
);
ok(
$h->locationRulesInit(
{
locationRules => {
default => 'accept',
'^/no' => 'deny',
'test' => '$groups =~ /\badmin\b/',
},
}
),
'locationRulesInit'
);
ok( $h->defaultValuesInit(), 'defaultValuesInit' );
ok( $h->portalInit( { portal => 'http://auth.example.com' } )
or 1, 'portalInit' );
ok(
$h->globalStorageInit(
{
globalStorage => 'Apache::Session::File',
globalStorageOptions => {},
}
),
'globalStorageInit'
);
ok( $h->forgeHeadersInit, 'forgeHeadersInit' );
ok( $h->forgeHeadersInit( { exportedHeaders => { Auth => '$uid', } } ),
'forgeHeadersInit 2' );
2010-09-23 18:41:39 +02:00
ok( $h->grant('/s'), 'grant OK' );
ok( !$h->grant('/no'), 'grant NOK' );