Bug 24739: Skip tests when IPv6 support is found
Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
cad8540cbf
commit
d33c2506d5
1 changed files with 19 additions and 7 deletions
|
@ -85,10 +85,22 @@ t::lib::Mocks::mock_config('koha_trusted_proxies', '1.1.1.0:255.255.255.0');
|
|||
$address = Koha::Middleware::RealIP::get_real_ip( $remote_address, $x_forwarded_for_header );
|
||||
is($address,'2.2.2.2',"Trust proxy (1.1.1.1) using an IP address and netmask separated by a colon, so use the X-Forwarded-For header for the remote address");
|
||||
|
||||
$remote_address = "2001:db8:1234:5678:abcd:1234:abcd:1234";
|
||||
$x_forwarded_for_header = "2.2.2.2";
|
||||
t::lib::Mocks::mock_config('koha_trusted_proxies', '2001:db8:1234:5678::/64');
|
||||
warning_is {
|
||||
$address = Koha::Middleware::RealIP::get_real_ip( $remote_address, $x_forwarded_for_header );
|
||||
} "could not parse 2001:db8:1234:5678::/64","Warn on IPv6 koha_trusted_proxies";
|
||||
is($address,'2001:db8:1234:5678:abcd:1234:abcd:1234',"IPv6 support was added in 1.9104 version of Net::Netmask");
|
||||
require Net::Netmask;
|
||||
SKIP: {
|
||||
skip "Net::Netmask at 1.9104+ supports IPv6", 2 unless Net::Netmask->VERSION < 1.9104;
|
||||
|
||||
$remote_address = "2001:db8:1234:5678:abcd:1234:abcd:1234";
|
||||
$x_forwarded_for_header = "2.2.2.2";
|
||||
t::lib::Mocks::mock_config( 'koha_trusted_proxies', '2001:db8:1234:5678::/64' );
|
||||
warning_is {
|
||||
$address = Koha::Middleware::RealIP::get_real_ip( $remote_address,
|
||||
$x_forwarded_for_header );
|
||||
}
|
||||
"could not parse 2001:db8:1234:5678::/64",
|
||||
"Warn on IPv6 koha_trusted_proxies";
|
||||
is(
|
||||
$address,
|
||||
'2001:db8:1234:5678:abcd:1234:abcd:1234',
|
||||
"IPv6 support was added in 1.9104 version of Net::Netmask"
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue