Improve unit test (#2381)

This commit is contained in:
Christophe Maudoux 2020-11-20 12:56:31 +01:00
parent 6060a54536
commit d22bb7bc32
4 changed files with 11 additions and 7 deletions

View File

@ -17,7 +17,7 @@ sub accessToTrace {
my $params = $hash->{params};
my $session = $hash->{session};
return "$custom alias $params->[0]_$params->[1]:$session->{groups}";
return "$custom alias $params->[0]_$params->[1]:$session->{groups} with $session->{$params->[2]}";
}
1;

View File

@ -47,11 +47,13 @@ count(2);
%h = @{ $res->[1] };
ok(
$h{'Lm-Remote-Custom'} eq
'dwho@badwolf.org alias Doctor_Who:users; timelords',
'dwho@badwolf.org alias Doctor_Who:users; timelords by using Mozilla/5.0 (X11; VAX4000; rv:43.0) Gecko/20100101 Firefox/143.0 Iceweasel/143.0.1',
'Lm-Remote-Custom is overwriten'
)
or explain( \%h,
'Lm-Remote-Custom => "dwho@badwolf.org alias Doctor_Who:users; timelords"' );
or explain(
\%h,
'Lm-Remote-Custom => "dwho@badwolf.org alias Doctor_Who:users; timelords by using Mozilla/5.0 (X11; VAX4000; rv:43.0) Gecko/20100101 Firefox/143.0 Iceweasel/143.0.1"'
);
count(1);
# Authorized query

View File

@ -9,7 +9,8 @@ sub accessToTrace {
my $params = $hash->{params};
my $session = $hash->{session};
return "$custom alias $params->[0]_$params->[1]:$session->{groups}";
return
"$custom alias $params->[0]_$params->[1]:$session->{groups} by using $session->{ $params->[2] }";
}
1;

View File

@ -76,7 +76,8 @@
}
},
"macros": {
"_whatToTrace": "$_auth eq 'SAML' ? \"$_user\\@$_idpConfKey\" : \"$_user\""
"_whatToTrace": "$_auth eq 'SAML' ? \"$_user\\@$_idpConfKey\" : \"$_user\"",
"UA": "$ENV{HTTP_USER_AGENT}"
},
"portal": "http://auth.example.com/",
"reloadUrls": {},
@ -86,7 +87,7 @@
"vhostAuthnLevel": 5
},
"test4.example.com": {
"vhostAccessToTrace": "My::accessToTrace, Doctor, Who"
"vhostAccessToTrace": "My::accessToTrace, Doctor, Who, UA"
}
},
"whatToTrace": "_whatToTrace",