Test $ENV in macros (#595)

environments/ppa-mbqj77/deployments/1
Xavier Guimard 8 years ago
parent fbbe3aaf9b
commit 9afc806342
  1. 2
      _example/conf/lmConf-1.json
  2. 19
      _example/test/index.pl
  3. 3
      e2e-tests/handler/02-headers.js
  4. 2
      e2e-tests/lmConf-1.json

@ -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');
});
});
});
});

@ -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",

Loading…
Cancel
Save