Commit 9afc8063 authored by Xavier Guimard's avatar Xavier Guimard

Test $ENV in macros (#595)

parent fbbe3aaf
......@@ -136,7 +136,7 @@
},
"loginHistoryEnabled" : 1,
"macros" : {
"UA" : "HTTP_USER_AGENT",
"UA" : "$ENV{HTTP_USER_AGENT}",
"_whatToTrace" : "$_auth eq 'SAML' ? \"$_user\\@$_idpConfKey\" : $_auth eq 'OpenIDConnect' ? \"$_user\\@$_oidcConnectedRP\" : \"$_user\""
},
"mailUrl" : "http://auth.__DNSDOMAIN__/resetpwd",
......
......@@ -112,24 +112,7 @@ foreach ( sort keys %$headers ) {
<td><tt>$headers->{$_}</tt></td>
<td><tt>\$_SERVER{$headers->{$_}}</tt></td>
<td id="v-$_">};
my @tmp;
if ( $ENV{ $headers->{$_} }
and @tmp = grep /\S/, split( /;/, $ENV{ $headers->{$_} } ) )
{
if ($#tmp) {
print '<ul class="list-unstyled">';
foreach (@tmp) {
print "<li>$_</li>";
}
print '</ul>';
}
else {
print $ENV{ $headers->{$_} };
}
}
else {
print "",;
}
print $ENV{ $headers->{$_} } // "",;
print "</td></tr>\n";
}
print "</tbody></table>\n";
......
......@@ -7,6 +7,7 @@ describe('Lemonldap::NG handler', function() {
browser.driver.get('http://test1.example.com:' + process.env.TESTWEBSERVERPORT + '/');
expect(browser.driver.findElement(by.id('v-Auth-User')).getText()).toEqual('dwho');
expect(browser.driver.findElement(by.id('v-Ip-Addr')).getText()).toMatch(/^\d+\.\d+\.\d+\.\d+$/);
expect(browser.driver.findElement(by.id('v-Macro-Uri')).getText()).toMatch(/\w/);
});
it('should display custom functions results', function() {
expect(browser.driver.findElement(by.id('v-Hello')).getText()).toEqual('Hello');
......@@ -15,4 +16,4 @@ describe('Lemonldap::NG handler', function() {
expect(browser.driver.findElement(by.id('v-Base64')).getText()).toEqual('YTpi');
});
});
});
\ No newline at end of file
});
......@@ -104,6 +104,7 @@
"Ip-Addr": "$ipAddr",
"Hello": "hello()",
"Uri": "$ENV{REQUEST_URI}",
"Macro-Uri": "$UA",
"Additional-Arg": "get_additional_arg('header-added')",
"Base64": "encode_base64('a:b','')"
},
......@@ -148,6 +149,7 @@
},
"loginHistoryEnabled": 1,
"macros": {
"UA" : "$ENV{HTTP_USER_AGENT}",
"_whatToTrace": "$_auth eq 'SAML' ? \"$_user\\@$_idpConfKey\" : $_auth eq 'OpenIDConnect' ? \"$_user\\@$_oidcConnectedRP\" : \"$_user\""
},
"mailUrl": "http://auth.example.com:__port__/resetpwd",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment