From f7bedaf088aa2cfc40e360dfa88ab7a8ea524406 Mon Sep 17 00:00:00 2001 From: Christophe Maudoux Date: Sat, 18 Apr 2020 19:01:56 +0200 Subject: [PATCH] Improve unit test (#1999) --- lemonldap-ng-portal/t/57-GlobalLogout.t | 6 +++--- .../t/59-Double-cookies-Refresh-and-Logout.t | 4 ++-- lemonldap-ng-portal/t/lmConf-1.json | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lemonldap-ng-portal/t/57-GlobalLogout.t b/lemonldap-ng-portal/t/57-GlobalLogout.t index 385d2b999..8530fd7b3 100644 --- a/lemonldap-ng-portal/t/57-GlobalLogout.t +++ b/lemonldap-ng-portal/t/57-GlobalLogout.t @@ -19,7 +19,7 @@ my $client = LLNG::Manager::Test->new( { requireToken => 0, restSessionServer => 1, globalLogoutRule => '$uid eq "dwho"', - globalLogoutCustomParam => 'authMode' + globalLogoutCustomParam => 'zeAUTHMODE_authmode' } } ); @@ -139,8 +139,8 @@ my ( $host, $url, $query ) = ok( $res->[2]->[0] =~ m%%, 'Found trspan="globalLogout"' ) or explain( $res->[2]->[0], 'trspan="globalLogout"' ); -ok( $res->[2]->[0] =~ m%DEMO%, 'CustomParam found "DEMO"' ) - or explain( $res->[2]->[0], 'CustomParam DEMO' ); +ok( $res->[2]->[0] =~ m%DEMO_demo%, 'Found CustomParam "DEMO_demo" macro' ) + or explain( $res->[2]->[0], 'CustomParam "DEMO_demo" macro' ); my @c = ( $res->[2]->[0] =~ m%127.0.0.1%gs ); my @d = ( $res->[2]->[0] =~ m%%gs ); my @e = ( $res->[2]->[0] =~ m%class="data-epoch">(\d{10})%gs ); diff --git a/lemonldap-ng-portal/t/59-Double-cookies-Refresh-and-Logout.t b/lemonldap-ng-portal/t/59-Double-cookies-Refresh-and-Logout.t index 50cba9b5c..11a9f0569 100644 --- a/lemonldap-ng-portal/t/59-Double-cookies-Refresh-and-Logout.t +++ b/lemonldap-ng-portal/t/59-Double-cookies-Refresh-and-Logout.t @@ -116,7 +116,7 @@ ok( 'POST checkuser' ); my %attributes = map /(.+)?<\/td>/g, $res->[2]->[0]; -ok( scalar keys %attributes == 18, 'Found 18 attributes' ) +ok( scalar keys %attributes == 19, 'Found 19 attributes' ) or print STDERR "Wrong number of attributes -> " . scalar keys %attributes; ok( $attributes{'_updateTime'} =~ /^\d{14}$/, 'Timestamp found' ) or print STDERR Dumper( \%attributes ); @@ -184,7 +184,7 @@ ok( 'POST checkuser' ); my %attributes2 = map /(.+)?<\/td>/g, $res->[2]->[0]; -ok( scalar keys %attributes2 == 18, 'Found 18 attributes' ) +ok( scalar keys %attributes2 == 19, 'Found 19 attributes' ) or print STDERR "Wrong nunber of attributes -> " . scalar keys %attributes2; ok( $attributes2{'_updateTime'} =~ /^\d{14}$/, 'Timestamp found' ) or print STDERR Dumper( \%attributes2 ); diff --git a/lemonldap-ng-portal/t/lmConf-1.json b/lemonldap-ng-portal/t/lmConf-1.json index 1e6047138..c378d8ce1 100644 --- a/lemonldap-ng-portal/t/lmConf-1.json +++ b/lemonldap-ng-portal/t/lmConf-1.json @@ -96,7 +96,8 @@ "macros": { "_whatToTrace": "$_auth eq 'SAML' ? \"$_user\\@$_idpConfKey\" : \"$_user\"", "array": "$uid eq 'french' ? 'doctor; who' : ''", - "authMode": "$authenticationLevel == 8 ? TOTP : 'DEMO'" + "authMode": "$authenticationLevel == 8 ? 'TOTP' : 'DEMO'", + "zeAUTHMODE_authmode": "$authMode. '_' . lc $authMode" }, "notifications": 0, "passwordDB": "Null",