From 48883dbe4e965a550a07606845fe4912ebb6f095 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Tue, 27 Aug 2019 10:32:26 +0200 Subject: [PATCH] More tests --- .../NG/Portal/Plugins/GrantSession.pm | 2 +- lemonldap-ng-portal/t/99-Dont-load-Dumper.t | 45 ++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm index b14f58c64..6d4fad019 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/GrantSession.pm @@ -19,7 +19,7 @@ has rules => ( is => 'rw', default => sub { {} } ); sub init { my ($self) = @_; my $hd = $self->p->HANDLER; - foreach ( keys %{ $self->conf->{grantSessionRules} } ) { + foreach ( keys %{ $self->conf->{grantSessionRules} // {} } ) { $self->logger->debug("GrantRule key -> $_"); $self->logger->debug( "GrantRule value -> " . $self->conf->{grantSessionRules}->{$_} ); diff --git a/lemonldap-ng-portal/t/99-Dont-load-Dumper.t b/lemonldap-ng-portal/t/99-Dont-load-Dumper.t index 157eb5eb4..a73bfbeab 100644 --- a/lemonldap-ng-portal/t/99-Dont-load-Dumper.t +++ b/lemonldap-ng-portal/t/99-Dont-load-Dumper.t @@ -1,6 +1,49 @@ -use Test::More tests => 2; +use Test::More tests => 5; use_ok('Lemonldap::NG::Portal::Main'); +my ( $p, $app ); +my $ini = { + configStorage => { + type => 'File', + dirName => 't', + }, + localSessionStorage => 'Cache::FileCache', + localSessionStorageOptions => { + namespace => 'lemonldap-ng-session', + cache_root => 't/', + cache_depth => 0, + }, + logLevel => 'error', + cookieName => 'lemonldap', + domain => 'example.com', + templateDir => 'site/templates', + staticPrefix => '/static', + loginHistoryEnabled => 1, + securedCookie => 0, + https => 0, + portalDisplayResetPassword => 1, + portalStatus => 1, + cda => 1, + notification => 1, + portalCheckLogins => 1, + stayConnected => 1, + bruteForceProtection => 1, + grantSessionRules => 1, + upgradeSession => 1, + autoSigninRules => { a => 1 }, + checkState => 1, + portalForceAuthn => 1, + checkUser => 1, + impersonationRule => 1, + contextSwitchingRule => 1, + grantSessionRules => {}, + checkStateSecret => 'x', +}; + +ok( $p = Lemonldap::NG::Portal::Main->new, 'Portal object' ); +ok( $p->init($ini), 'Init' ); +ok( $app = $p->run, 'App' ); + eval { Data::Dumper::Dumper( {} ) }; ok( $@, "Portal don't depends on Data::Dumper" );