Commit 9e673d8e authored by Boxiang Sun's avatar Boxiang Sun Committed by Vincent Pelletier

caucase.test: get IP address from CAUCASE_LOC instead of hardcode IP

parent aa090b76
...@@ -3439,7 +3439,18 @@ class CaucaseTest(TestCase): ...@@ -3439,7 +3439,18 @@ class CaucaseTest(TestCase):
""" """
Test that it is possible to use a literal IPv4 as netloc. Test that it is possible to use a literal IPv4 as netloc.
""" """
self._testHttpCustomNetLoc(netloc='127.0.0.1') parsed_url = urllib_parse.urlparse(self._caucase_url)
try:
# pylint: disable=unused-variable
family, socktype, proto, canonname, (address, port) = socket.getaddrinfo(
parsed_url.hostname, None, socket.AF_INET, socket.SOCK_STREAM,
)[0] # Any is fine, pick the first one
# pylint: enable=unused-variable
except socket.gaierror: # pragma: no cover
raise unittest.SkipTest(
"Cannot resolve %r as AF_INET" % (parsed_url.hostname, )
)
self._testHttpCustomNetLoc(netloc=address)
def testHttpNetlocIPv6(self): def testHttpNetlocIPv6(self):
""" """
...@@ -3447,7 +3458,18 @@ class CaucaseTest(TestCase): ...@@ -3447,7 +3458,18 @@ class CaucaseTest(TestCase):
This used to fail because cryptography module would reject bare IPv6 This used to fail because cryptography module would reject bare IPv6
address in CRL distribution point extension (unlike IPv4). address in CRL distribution point extension (unlike IPv4).
""" """
self._testHttpCustomNetLoc(netloc='[::1]') parsed_url = urllib_parse.urlparse(self._caucase_url)
try:
# pylint: disable=unused-variable
family, socktype, proto, canonname, (address, port, flowinfo, scope_id) = socket.getaddrinfo(
parsed_url.hostname, None, socket.AF_INET6, socket.SOCK_STREAM,
)[0] # Any is fine, pick the first one
# pylint: enable=unused-variable
except socket.gaierror: # pragma: no cover
raise unittest.SkipTest(
"Cannot resolve %r as AF_INET6" % (parsed_url.hostname, )
)
self._testHttpCustomNetLoc(netloc='[' + address + ']')
def testServerFilePermissions(self): def testServerFilePermissions(self):
""" """
......
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