Skip to content

Commit

Permalink
Try to fix IPv6 test
Browse files Browse the repository at this point in the history
  • Loading branch information
nabla-c0d3 committed Jan 3, 2025
1 parent 6e1e213 commit 38913c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from tests.openssl_server import ModernOpenSslServer, ClientAuthConfigEnum
import pytest

from tests.server_connectivity_tests.test_direct_connection import is_ipv6_available


class TestCertificateInfoPlugin:
def test_ca_file_bad_file(self):
Expand Down Expand Up @@ -190,9 +192,10 @@ def test_multiple_certificates(self):
# And multiple certificates were detected
assert len(plugin_result.certificate_deployments) > 1

@pytest.mark.skipif(not is_ipv6_available(), reason="IPv6 not available")
def test_ipv6_server_string(self):
# Given a server to scan for which SSLyze only received an IPv6 address
# Test for https://github.com/nabla-c0d3/sslyze/issues/675
# Given a server to scan for which SSLyze only received an IPv6 address
server_location = ServerNetworkLocation("2a00:1450:4007:80d::200e", 443, ip_address="2a00:1450:4007:80d::200e")
server_info = check_connectivity_to_server_and_return_info(server_location)

Expand Down
4 changes: 2 additions & 2 deletions tests/server_connectivity_tests/test_direct_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from tests.markers import can_only_run_on_linux_64


def _is_ipv6_available() -> bool:
def is_ipv6_available() -> bool:
has_ipv6 = False
s = socket.socket(socket.AF_INET6)
try:
Expand Down Expand Up @@ -103,7 +103,7 @@ def test_tls_1_only(self):
# And it detected that only TLS 1.0 is supported
assert tls_probing_result.highest_tls_version_supported == TlsVersionEnum.TLS_1_0

@pytest.mark.skipif(not _is_ipv6_available(), reason="IPv6 not available")
@pytest.mark.skipif(not is_ipv6_available(), reason="IPv6 not available")
def test_ipv6(self):
# Given a server accessible via IPv6
server_location = ServerNetworkLocation(
Expand Down

0 comments on commit 38913c9

Please sign in to comment.