Skip to content

Commit 0e381d0

Browse files
committed
Fix test
1 parent bc18d57 commit 0e381d0

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

tests/plugins_tests/test_session_resumption_plugin.py

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,42 @@
2020

2121

2222
class TestSessionResumptionSupport:
23-
def test(self) -> None:
24-
# Given a server that supports session resumption with both TLS tickets and session IDs
25-
server_location = ServerNetworkLocation("www.google.com", 443)
26-
server_info = check_connectivity_to_server_and_return_info(server_location)
23+
@can_only_run_on_linux_64
24+
def test_resumption_with_session_ids(self) -> None:
25+
# Given a server that supports session resumption with session IDs
26+
with ModernOpenSslServer() as server:
27+
server_location = ServerNetworkLocation(
28+
hostname=server.hostname, ip_address=server.ip_address, port=server.port
29+
)
30+
network_config = ServerNetworkConfiguration(
31+
tls_server_name_indication=server.hostname,
32+
)
33+
server_info = check_connectivity_to_server_and_return_info(server_location, network_config)
2734

28-
# When testing for resumption, it succeeds
29-
result: SessionResumptionSupportScanResult = SessionResumptionSupportImplementation.scan_server(server_info)
35+
# When testing for resumption, it succeeds
36+
result: SessionResumptionSupportScanResult = SessionResumptionSupportImplementation.scan_server(server_info)
3037

31-
# And it confirms that both session IDs and TLS tickets are supported
38+
# And it confirms that resumption with session IDs is supported
3239
assert result.session_id_resumption_result == TlsResumptionSupportEnum.FULLY_SUPPORTED
3340
assert result.session_id_attempted_resumptions_count
3441
assert result.session_id_successful_resumptions_count
3542

43+
# And a CLI output can be generated
44+
assert SessionResumptionSupportImplementation.cli_connector_cls.result_to_console_output(result)
45+
46+
# And the result can be converted to JSON
47+
result_as_json = SessionResumptionSupportScanResultAsJson.model_validate(result).model_dump_json()
48+
assert result_as_json
49+
50+
def test_resumption_with_tls_tickets(self) -> None:
51+
# Given a server that supports session resumption with TLS tickets
52+
server_location = ServerNetworkLocation("www.google.com", 443)
53+
server_info = check_connectivity_to_server_and_return_info(server_location)
54+
55+
# When testing for resumption, it succeeds
56+
result: SessionResumptionSupportScanResult = SessionResumptionSupportImplementation.scan_server(server_info)
57+
58+
# And it confirms that TLS tickets are supported
3659
assert result.tls_ticket_resumption_result == TlsResumptionSupportEnum.FULLY_SUPPORTED
3760
assert result.tls_ticket_attempted_resumptions_count
3861
assert result.tls_ticket_successful_resumptions_count

0 commit comments

Comments
 (0)