Bug 28200: Remove unit test using abbreviated format

This patch removes the unit test that uses the abbreviated format,
since it's not supported in newer versions of Net::Netmask without
a workaround.

Test plan:
0. Set up Koha dev environment on Debian 11
1. perl t/Koha/Middleware/RealIP.t
2. Tests should pass

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Alvaro Cornejo <cornejo.alvaro@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
David Cook 2021-05-10 23:33:19 +00:00 committed by Jonathan Druart
parent 3ec1b978e0
commit 06fe908a4e

View file

@ -100,19 +100,13 @@ subtest "Success multiple proxies" => sub {
};
subtest "Test alternative configuration styles" => sub {
plan tests => 3;
plan tests => 2;
$remote_address = "2.2.2.2";
$x_forwarded_for_header = "1.1.1.1";
t::lib::Mocks::mock_config('koha_trusted_proxies', '2.2.2.0/24');
$address = Koha::Middleware::RealIP::get_real_ip( $remote_address, $x_forwarded_for_header );
is($address,'1.1.1.1',"Trust proxy (2.2.2.2) using CIDR notation, so use the X-Forwarded-For header for the remote address");
$remote_address = "2.2.2.2";
$x_forwarded_for_header = "1.1.1.1";
t::lib::Mocks::mock_config('koha_trusted_proxies', '2.2.2');
$address = Koha::Middleware::RealIP::get_real_ip( $remote_address, $x_forwarded_for_header );
is($address,'1.1.1.1',"Trust proxy (2.2.2.2) using abbreviated notation, so use the X-Forwarded-For header for the remote address");
$remote_address = "2.2.2.2";
$x_forwarded_for_header = "1.1.1.1";
t::lib::Mocks::mock_config('koha_trusted_proxies', '2.2.2.0:255.255.255.0');