test getIp with and without forwarding
This commit is contained in:
parent
9fb805525c
commit
a74df19091
1 changed files with 16 additions and 2 deletions
|
|
@ -15,8 +15,22 @@ use lib "$FindBin::Bin/../lib";
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
|
||||
use Test::More tests => 1; # increment this value for each test you create
|
||||
use Test::More tests => 3; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
ok($session->env->get("PATH") ne "", "get()");
|
||||
cmp_ok($session->env->get("PATH"), 'ne', "", "get() one entry");
|
||||
|
||||
#Replace the ENV hash so that we can test getIp.
|
||||
|
||||
my $origEnvHash = $session->env->{_env};
|
||||
|
||||
my %newEnv = ( REMOTE_ADDR => '192.168.0.2' );
|
||||
|
||||
$session->env->{_env} = \%newEnv;
|
||||
|
||||
is ($session->env->getIp(), $newEnv{'REMOTE_ADDR'}, 'getIp');
|
||||
|
||||
$newEnv{'HTTP_X_FORWARDED_FOR'} = '10.0.2.5';
|
||||
|
||||
is ($session->env->getIp(), $newEnv{'HTTP_X_FORWARDED_FOR'}, 'getIp with HTTP forwarding');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue